Closed
Bug 78070
Opened 23 years ago
Closed 15 years ago
scrollbar code should be able to handle document root element being replaced
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
People
(Reporter: jruderman, Assigned: bzbarsky)
References
(Blocks 1 open bug, )
Details
(Whiteboard: [blocking2.0?])
Attachments
(1 file, 2 obsolete files)
60.88 KB,
patch
|
roc
:
review+
dbaron
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
From bug 55334, "No scrollbars for javascript-generated content". jst is currently working around a scrollbar problem for the case of javascript- generated content. evaughan@netscape.com has a stack trace (2000-10-13 13:26 comment in bug 55334) that shows the problem in the scrollbar code. jst said: The scrollbar code needs to be able to cope with the root element changing in a document, and currently that involves setting the document in the old root to null. jst also said: ------- Additional Comments From Johnny Stenback 2001-04-12 03:03 ------- Ok, workaround checked in, reassigning to evaughan in hope of getting a real fix for this problem in the scrollbar code. Eric, the scrollbar code must be able to function properly even if the root element in a document is removed and re-inserted, or simply just replaced. This can happen in the case where a script writer does document.open()... (see attached testcase) or if someone replaces or removes the root element in a document from script, both cases are valid cases and the scrollbar code simply needs to cope with this. To test this either back out my workaround and run the attached testcase or shout and I'll create a testcase that replaces the root in a document.
Updated•23 years ago
|
Target Milestone: --- → mozilla0.9.2
Comment 2•22 years ago
|
||
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 (you can query for this string to delete spam or retrieve the list of bugs I've moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Comment 3•22 years ago
|
||
Added the attachment from bug 140060 to the URL field. It is an ideal testcase for this bug. Jake
Comment 4•22 years ago
|
||
Taking, since Eric is not here anymore. This problem (and its attendant workarounds) really yuckifies our code.
Assignee: eric → jkeiser
Updated•22 years ago
|
Status: NEW → ASSIGNED
![]() |
Assignee | |
Comment 5•18 years ago
|
||
So there are several things going on here, depending on what one does with the document element. If one changes the document element, an obvious problem is that the root scrollframe has the root content node as its mContent and we do NOT reconstruct it when we move around the root content node. So its mContent has nothing to do with the document. I can get scrollbars at least on the testcases from bug 205725 to work by unbinding and rebinding the scrollbar mContents to the new root, but they display wrong.... The testcases in bug 205725 use the same document element; not sure why they still break. But really, given that the scrollframe points to the document element, I think we should blow away said scrollframe when the document element changes (and change nsViewportFrame to handle dynamic changes to its principal child list).
I agree.
Comment 7•16 years ago
|
||
Confirmed to exist on Mac. Mozilla 1.0.1 is gone long ago, removing. Nominating to block Mozilla 2 (we really need a blocking2.0 flag...)
OS: Windows 98 → All
Hardware: PC → All
Whiteboard: [blocking2.0?]
Target Milestone: mozilla1.0.1 → ---
Updated•16 years ago
|
Assignee: john → nobody
Status: ASSIGNED → NEW
QA Contact: chrispetersen → layout
Updated•15 years ago
|
Flags: blocking1.9.2?
This shouldn't be too hard to fix, but we need to make sure we handle switching between XUL, non-XUL, and framesets. It might be easiest to get rid of ReconstructDocElementHierarchyInternal and just completely destroy the frame tree and then rebuild it by calling ConstructRootFrame again.
![]() |
Assignee | |
Comment 10•15 years ago
|
||
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #370927 -
Flags: superreview?(roc)
Attachment #370927 -
Flags: review?(roc)
Attachment #370927 -
Flags: review?(dbaron)
![]() |
Assignee | |
Comment 11•15 years ago
|
||
Comment 12•15 years ago
|
||
Could you describe the approach you took to fixing this?
![]() |
Assignee | |
Comment 13•15 years ago
|
||
Sure. The basic idea is that the only frame we keep around no matter what is the viewport. The rest of the frames around the root (root scrollframe, root element box frame, root block, root svg, root table, canvas, page sequence, etc) we remove and recreate as needed when we get ContentRemoved()/ContentInserted() calls on the root element. The viewport frame continues to have a null mContent (and we might just need to keep that). In particular, this means that removing the root element removes all frames in the frame tree except the viewport. If a new root, or the same one, is then inserted, we'll create new scrollbars hooked up to the right content node, as needed. That's what fixes this bug. So the patch basically has three parts: 1) Move construction of everything but the viewport from ConstructRootFrame to ConstructDocElementFrame. 2) Make ContentRemoved on the root remove all the frames under the viewport, and clean up ContentInserted a bit. 3) Remove ReinsertContent and our existing ReconstructDocElementHierarchyInternal code; make all frame reconstruction go through RecreateFramesForContent.
Yippee!
+ nsresult ConstructRootFrame(nsIFrame** aNewFrame); +nsCSSFrameConstructor::ConstructRootFrame(nsIFrame** aNewFrame) Fix param indent + // Make sure to clean up the work that SetUpDocElementContainingBlock() might have done. + nsFrameManager* frameManager = mPresShell->FrameManager(); + nsIFrame* viewport = frameManager->GetRootFrame(); + nsIFrame* viewportChild = viewport->GetFirstChild(nsnull); Do we really need to do all this here? Could we just arrange for ContentRemoved to be a bit better behaved if it runs when we have no document element frame but the canvas and scrollbars were set up?
![]() |
Assignee | |
Comment 16•15 years ago
|
||
> Could we just arrange for ContentRemoved to be a bit better behaved
Yes, but it's a bit tricky; see the nice long comment in ContentRemoved. Good thing we have reftests and crashtests (esp. the latter) that trigger this code in all sorts of ... interesting ... ways.
Attachment #370927 -
Attachment is obsolete: true
Attachment #370928 -
Attachment is obsolete: true
Attachment #370927 -
Flags: superreview?(roc)
Attachment #370927 -
Flags: review?(roc)
Attachment #370927 -
Flags: review?(dbaron)
Attachment #371372 -
Flags: superreview?(roc)
Attachment #371372 -
Flags: review?(roc)
Attachment #371372 -
Flags: review?(dbaron)
Attachment #371372 -
Flags: superreview?(roc)
Attachment #371372 -
Flags: superreview+
Attachment #371372 -
Flags: review?(roc)
Attachment #371372 -
Flags: review+
Updated•15 years ago
|
Attachment #371372 -
Flags: review?(dbaron) → review+
Comment 17•15 years ago
|
||
Comment on attachment 371372 [details] [diff] [review] Same thing with the comments addressed r=dbaron. Sorry for the long delay on this.
![]() |
Assignee | |
Comment 18•15 years ago
|
||
Pushed http://hg.mozilla.org/mozilla-central/rev/b43f2b9e0c32
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Flags: blocking1.9.2?
You need to log in
before you can comment on or make changes to this bug.
Description
•