From 4ce33a6c6df517edd1029f839fc3f3c26cd94883 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 11 May 2009 22:04:58 -0400 Subject: [PATCH] Bug 486741. Remove hack around broken scrollbars, since it's not needed anymore. r+sr=jst --- content/html/document/src/nsHTMLDocument.cpp | 54 +------------------ content/html/document/test/Makefile.in | 1 + .../html/document/test/test_bug486741.html | 46 ++++++++++++++++ 3 files changed, 48 insertions(+), 53 deletions(-) create mode 100644 content/html/document/test/test_bug486741.html diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 1ab2dc5efad4..c91cfb24faf3 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -1917,64 +1917,12 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace) } } - // XXX This is a nasty workaround for a scrollbar code bug - // (http://bugzilla.mozilla.org/show_bug.cgi?id=55334). - - // Hold on to our root element - nsCOMPtr root = GetRootContent(); - - if (root) { - PRInt32 rootIndex = mChildren.IndexOfChild(root); - NS_ASSERTION(rootIndex >= 0, "Root must be in list!"); - - PRUint32 count = root->GetChildCount(); - - // Remove all the children from the root. - while (count-- > 0) { - root->RemoveChildAt(count, PR_TRUE); - } - - count = root->GetAttrCount(); - - // Remove all attributes from the root element - while (count-- > 0) { - const nsAttrName* name = root->GetAttrNameAt(count); - // Hold a strong reference here so that the atom doesn't go away during - // UnsetAttr. - nsCOMPtr localName = name->LocalName(); - root->UnsetAttr(name->NamespaceID(), localName, PR_FALSE); - } - - // Remove the root from the childlist - mChildren.RemoveChildAt(rootIndex); - mCachedRootContent = nsnull; - } - - // Call Reset(), this will now do the full reset, except removing - // the root from the document, doing that confuses the scrollbar - // code in mozilla since the document in the root element and all - // the anonymous content (i.e. scrollbar elements) is set to - // null. - + // Call Reset(), this will now do the full reset Reset(channel, group); if (baseURI) { mDocumentBaseURI = baseURI; } - if (root) { - // Tear down the frames for the root element. - MOZ_AUTO_DOC_UPDATE(this, UPDATE_CONTENT_MODEL, PR_TRUE); - nsNodeUtils::ContentRemoved(this, root, 0); - - // Put the root element back into the document, we don't notify - // the document about this insertion since the sink will do that - // for us and that'll create frames for the root element and the - // scrollbars work as expected (since the document in the root - // element was never set to null) - - mChildren.AppendChild(root); - } - if (IsEditingOn()) { // Reset() blows away all event listeners in the document, and our // editor relies heavily on those. Midas is turned on, to make it diff --git a/content/html/document/test/Makefile.in b/content/html/document/test/Makefile.in index def7a0527aec..d4c884d84558 100644 --- a/content/html/document/test/Makefile.in +++ b/content/html/document/test/Makefile.in @@ -93,6 +93,7 @@ _TEST_FILES = test_bug1682.html \ test_bug481440.html \ test_bug481647.html \ test_bug482659.html \ + test_bug486741.html \ $(NULL) libs:: $(_TEST_FILES) diff --git a/content/html/document/test/test_bug486741.html b/content/html/document/test/test_bug486741.html new file mode 100644 index 000000000000..5853a03fb323 --- /dev/null +++ b/content/html/document/test/test_bug486741.html @@ -0,0 +1,46 @@ + + + + + Test for Bug 486741 + + + + + +Mozilla Bug 486741 +

+ +
+
+
+ +