Closed Bug 264926 Opened 20 years ago Closed 19 years ago

view source->view->syntax highlighting totally horked on URLs with anchor identifier

Categories

(Toolkit :: View Source, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jmd, Assigned: bugs)

References

Details

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041017 Firefox/1.0

1) Load a URL with an anchor identifier ("#foo"), eg:
   https://bugzilla.mozilla.org/show_bug.cgi?id=57724#c29
2) View source.
3) Now toggle syntax highlighting in the View menu.

Instead of changing the display, the window instead scrolls itself either ALL
the way to the right, or both ALL the way left and to the bottom, or rarely,
just all the way to the bottom. As there's no indication this scroll happens, at
first I thought the window was simply blanking itself.

In rare cases toggling syntax on will correctly redraw the page without color
(in addition to wrongly scrolling), but I've never see it the other way around.

Strange how random the action seems to be.
It seems to me that this is due to the fact that the toggling of syntax
highlighting was implemented sub-optimally (same code in SeaMonkey & Firefox).
It does a full-blown reload of the URL, rather than just enabling/disabling the
viewsource.css stylesheet (like the normal Use Style switcher does).
The back-end code doesn't generate all the goop that syntax highlighting needs
when syntax highlighting is off (for performance reasons).  That behavior
predates the dynamic syntax highlighting switch.

Given that not doing syntax highlighting is 4-10 times faster than doing it
(even without the front-end stylesheet applied; this is just the back-end
changes), I don't think we want to change the back end to unconditionally
generate the highlighting markup.

Perhaps we should look into why this scrolling actually happens?

Note that in SeaMonkey the dynamic switch doesn't even seem to work -- nothing
happens unless I close and reopen view-source.
> The back-end code doesn't generate all the goop that syntax highlighting

That ruse slipped from my mind... I remembered it after posting my comment...
*** Bug 238470 has been marked as a duplicate of this bug. ***
OS: Linux → All
Hardware: PC → All
Version: unspecified → Trunk
http://lxr.mozilla.org/seamonkey/source/toolkit/components/viewsource/content/viewSource.js#578

The view_source.syntax_highlight set works fine just before the loadPage call,
loadPage doesn't throw an exception, and nothing happens. It really looks to me
that something's wrong with the back-end code here.

One thing that I don't quite understand... It works like this

Load page: DISPLAY_NORMAL -> descriptor 1
View source: descriptor 1 and DISPLAY_AS_SOURCE -> descriptor 2
Enable/disable hilighting: descriptor 2 and DISPLAY_NORMAL -> descriptor 3

I would've thought that using descriptor 2 and DISPLAY_NORMAL would've either
given (essentially?) descriptor 1 back or would've left it as (essentially?)
descriptor 2 and syntax hilighting would have no effect, because it would only
apply if DISPLAY_AS_SOURCE was passed.

I tried it like this instead:

Load page: DISPLAY_NORMAL -> descriptor 1
View source: descriptor 1 and DISPLAY_AS_SOURCE -> descriptor 2
Enable/disable hilighting: descriptor 1 and DISPLAY_AS_SOURCE -> descriptor 3

and it works exactly the same.
By exactly the same do you mean having the same issues?
Yuppers.
So... This seems to be working ok on current trunk, unless I'm missing
something.    Jeremy, Jason, are you still seeing issues?

I tried to figure out what fixed this, but haven't really succeeded...
Yeah, seems to work now.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → WORKSFORME
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.