Bug 660604 - Remove nsIHTMLDocument::GetBodyContentExternal; r=jst
authorMs2ger <ms2ger@gmail.com>
Thu, 02 Jun 2011 14:56:46 +0200
changeset 70461 5e556151026ca87fbc1fbcce9f79a540e8ab66a4
parent 70460 0ad16300542f69d7e7f93d05c2ba78016248f189
child 70462 1f19c58519297d0a0ff772dfaad24914c8942de8
push id20326
push userMs2ger@gmail.com
push dateThu, 02 Jun 2011 13:07:28 +0000
treeherdermozilla-central@e3f863f8bf4a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs660604
milestone7.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 660604 - Remove nsIHTMLDocument::GetBodyContentExternal; r=jst
content/html/document/src/nsHTMLDocument.cpp
content/html/document/src/nsHTMLDocument.h
content/html/document/src/nsIHTMLDocument.h
layout/base/nsCSSRendering.cpp
layout/style/nsHTMLStyleSheet.cpp
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -2362,22 +2362,16 @@ nsHTMLDocument::ResolveName(const nsAStr
     }
   }
 
   return NS_OK;
 }
 
 //----------------------------
 
-/* virtual */ nsIContent*
-nsHTMLDocument::GetBodyContentExternal()
-{
-  return GetBodyElement();
-}
-
 // forms related stuff
 
 NS_IMETHODIMP
 nsHTMLDocument::GetForms(nsIDOMHTMLCollection** aForms)
 {
   nsContentList *forms = nsHTMLDocument::GetForms();
   if (!forms)
     return NS_ERROR_OUT_OF_MEMORY;
--- a/content/html/document/src/nsHTMLDocument.h
+++ b/content/html/document/src/nsHTMLDocument.h
@@ -169,18 +169,16 @@ public:
     return mEditingState;
   }
 
   virtual void DisableCookieAccess()
   {
     mDisableCookieAccess = PR_TRUE;
   }
 
-  virtual nsIContent* GetBodyContentExternal();
-
   class nsAutoEditingState {
   public:
     nsAutoEditingState(nsHTMLDocument* aDoc, EditingState aState)
       : mDoc(aDoc), mSavedState(aDoc->mEditingState)
     {
       aDoc->mEditingState = aState;
     }
     ~nsAutoEditingState() {
--- a/content/html/document/src/nsIHTMLDocument.h
+++ b/content/html/document/src/nsIHTMLDocument.h
@@ -44,18 +44,18 @@
 class nsIDOMHTMLFormElement;
 class nsIContent;
 class nsIScriptElement;
 class nsIEditor;
 class nsContentList;
 class nsWrapperCache;
 
 #define NS_IHTMLDOCUMENT_IID \
-{ 0x30001b0c, 0xdb25, 0x4318, \
-  { 0x85, 0xb8, 0x48, 0xb4, 0xea, 0x54, 0x8f, 0x23 } }
+{ 0x51a360fa, 0xd659, 0x4d85, \
+  { 0xa5, 0xc5, 0x4a, 0xbb, 0x0d, 0x97, 0x0f, 0x7a } }
 
 
 /**
  * HTML document extensions to nsIDocument.
  */
 class nsIHTMLDocument : public nsISupports
 {
 public:
@@ -160,22 +160,16 @@ public:
   virtual nsresult SetEditingState(EditingState aState) = 0;
 
   /**
    * Disables getting and setting cookies
    */
   virtual void DisableCookieAccess() = 0;
 
   /**
-   * Get the first <body> child of the root <html>, but don't do
-   * anything <frameset>-related (like nsIDOMHTMLDocument::GetBody).
-   */
-  virtual nsIContent* GetBodyContentExternal() = 0;
-
-  /**
    * Called when this nsIHTMLDocument's editor is destroyed.
    */
   virtual void TearingDownEditor(nsIEditor *aEditor) = 0;
 
   virtual void SetIsXHTML(PRBool aXHTML) = 0;
 
   virtual void SetDocWriteDisabled(PRBool aDisabled) = 0;
 };
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -62,17 +62,16 @@
 #include "nsIScrollableFrame.h"
 #include "imgIRequest.h"
 #include "imgIContainer.h"
 #include "nsCSSRendering.h"
 #include "nsCSSColorUtils.h"
 #include "nsITheme.h"
 #include "nsThemeConstants.h"
 #include "nsIServiceManager.h"
-#include "nsIHTMLDocument.h"
 #include "nsLayoutUtils.h"
 #include "nsINameSpaceManager.h"
 #include "nsBlockFrame.h"
 #include "gfxContext.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "gfxPlatform.h"
 #include "gfxImageSurface.h"
 #include "nsStyleStructInlines.h"
@@ -80,16 +79,18 @@
 #include "nsCSSProps.h"
 #include "nsContentUtils.h"
 #include "nsSVGEffects.h"
 #include "nsSVGIntegrationUtils.h"
 #include "gfxDrawable.h"
 
 #include "nsCSSRenderingBorders.h"
 
+using namespace mozilla;
+
 /**
  * This is a small wrapper class to encapsulate image drawing that can draw an
  * nsStyleImage image, which may internally be a real image, a sub image, or a
  * CSS gradient.
  *
  * @note Always call the member functions in the order of PrepareImage(),
  * ComputeSize(), and Draw().
  */
@@ -932,46 +933,53 @@ nsCSSRendering::IsCanvasFrame(nsIFrame* 
 }
 
 nsIFrame*
 nsCSSRendering::FindBackgroundStyleFrame(nsIFrame* aForFrame)
 {
   const nsStyleBackground* result = aForFrame->GetStyleBackground();
 
   // Check if we need to do propagation from BODY rather than HTML.
-  if (result->IsTransparent()) {
-    nsIContent* content = aForFrame->GetContent();
-    // The root element content can't be null. We wouldn't know what
-    // frame to create for aFrame.
-    // Use |GetOwnerDoc| so it works during destruction.
-    if (content) {
-      nsIDocument* document = content->GetOwnerDoc();
-      nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document);
-      if (htmlDoc) {
-        nsIContent* bodyContent = htmlDoc->GetBodyContentExternal();
-        // We need to null check the body node (bug 118829) since
-        // there are cases, thanks to the fix for bug 5569, where we
-        // will reflow a document with no body.  In particular, if a
-        // SCRIPT element in the head blocks the parser and then has a
-        // SCRIPT that does "document.location.href = 'foo'", then
-        // nsParser::Terminate will call |DidBuildModel| methods
-        // through to the content sink, which will call |StartLayout|
-        // and thus |InitialReflow| on the pres shell.  See bug 119351
-        // for the ugly details.
-        if (bodyContent) {
-          nsIFrame *bodyFrame = bodyContent->GetPrimaryFrame();
-          if (bodyFrame) {
-            return nsLayoutUtils::GetStyleFrame(bodyFrame);
-          }
-        }
-      }
-    }
+  if (!result->IsTransparent()) {
+    return aForFrame;
+  }
+
+  nsIContent* content = aForFrame->GetContent();
+  // The root element content can't be null. We wouldn't know what
+  // frame to create for aFrame.
+  // Use |GetOwnerDoc| so it works during destruction.
+  if (!content) {
+    return aForFrame;
+  }
+
+  nsIDocument* document = content->GetOwnerDoc();
+  if (!document) {
+    return aForFrame;
   }
 
-  return aForFrame;
+  dom::Element* bodyContent = document->GetBodyElement();
+  // We need to null check the body node (bug 118829) since
+  // there are cases, thanks to the fix for bug 5569, where we
+  // will reflow a document with no body.  In particular, if a
+  // SCRIPT element in the head blocks the parser and then has a
+  // SCRIPT that does "document.location.href = 'foo'", then
+  // nsParser::Terminate will call |DidBuildModel| methods
+  // through to the content sink, which will call |StartLayout|
+  // and thus |InitialReflow| on the pres shell.  See bug 119351
+  // for the ugly details.
+  if (!bodyContent) {
+    return aForFrame;
+  }
+
+  nsIFrame *bodyFrame = bodyContent->GetPrimaryFrame();
+  if (!bodyFrame) {
+    return aForFrame;
+  }
+
+  return nsLayoutUtils::GetStyleFrame(bodyFrame);
 }
 
 /**
  * |FindBackground| finds the correct style data to use to paint the
  * background.  It is responsible for handling the following two
  * statements in section 14.2 of CSS2:
  *
  *   The background of the box generated by the root element covers the
@@ -1022,21 +1030,20 @@ FindElementBackground(nsIFrame* aForFram
   // It could be a non-HTML "body" element but that's OK, we'd fail the
   // bodyContent check below
 
   if (aForFrame->GetStyleContext()->GetPseudo())
     return PR_TRUE; // A pseudo-element frame.
 
   // We should only look at the <html> background if we're in an HTML document
   nsIDocument* document = content->GetOwnerDoc();
-  nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document);
-  if (!htmlDoc)
+  if (!document)
     return PR_TRUE;
 
-  nsIContent* bodyContent = htmlDoc->GetBodyContentExternal();
+  dom::Element* bodyContent = document->GetBodyElement();
   if (bodyContent != content)
     return PR_TRUE; // this wasn't the background that was propagated
 
   // This can be called even when there's no root element yet, during frame
   // construction, via nsLayoutUtils::FrameHasTransparency and
   // nsContainerFrame::SyncFrameViewProperties.
   if (!aRootElementFrame)
     return PR_TRUE;
--- a/layout/style/nsHTMLStyleSheet.cpp
+++ b/layout/style/nsHTMLStyleSheet.cpp
@@ -58,18 +58,16 @@
 #include "nsIFrame.h"
 #include "nsStyleContext.h"
 #include "nsGkAtoms.h"
 #include "nsPresContext.h"
 #include "nsEventStates.h"
 #include "nsIDocument.h"
 #include "nsIPresShell.h"
 #include "nsStyleConsts.h"
-#include "nsIHTMLDocument.h"
-#include "nsIDOMHTMLElement.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsRuleWalker.h"
 #include "nsRuleData.h"
 #include "nsContentErrors.h"
 #include "nsRuleProcessorData.h"
 #include "nsCSSRuleProcessor.h"
 #include "mozilla/dom/Element.h"
 #include "nsCSSFrameConstructor.h"