Bug 660604 - Remove nsIHTMLDocument::GetBodyContentExternal; r=jst

This commit is contained in:
Ms2ger 2011-06-02 14:56:46 +02:00
Родитель 310249278d
Коммит 794c2ab922
5 изменённых файлов: 41 добавлений и 50 удалений

Просмотреть файл

@ -2367,12 +2367,6 @@ nsHTMLDocument::ResolveName(const nsAString& aName,
//---------------------------- //----------------------------
/* virtual */ nsIContent*
nsHTMLDocument::GetBodyContentExternal()
{
return GetBodyElement();
}
// forms related stuff // forms related stuff
NS_IMETHODIMP NS_IMETHODIMP

Просмотреть файл

@ -174,8 +174,6 @@ public:
mDisableCookieAccess = PR_TRUE; mDisableCookieAccess = PR_TRUE;
} }
virtual nsIContent* GetBodyContentExternal();
class nsAutoEditingState { class nsAutoEditingState {
public: public:
nsAutoEditingState(nsHTMLDocument* aDoc, EditingState aState) nsAutoEditingState(nsHTMLDocument* aDoc, EditingState aState)

Просмотреть файл

@ -49,8 +49,8 @@ class nsContentList;
class nsWrapperCache; class nsWrapperCache;
#define NS_IHTMLDOCUMENT_IID \ #define NS_IHTMLDOCUMENT_IID \
{ 0x30001b0c, 0xdb25, 0x4318, \ { 0x51a360fa, 0xd659, 0x4d85, \
{ 0x85, 0xb8, 0x48, 0xb4, 0xea, 0x54, 0x8f, 0x23 } } { 0xa5, 0xc5, 0x4a, 0xbb, 0x0d, 0x97, 0x0f, 0x7a } }
/** /**
@ -164,12 +164,6 @@ public:
*/ */
virtual void DisableCookieAccess() = 0; 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. * Called when this nsIHTMLDocument's editor is destroyed.
*/ */

Просмотреть файл

@ -67,7 +67,6 @@
#include "nsITheme.h" #include "nsITheme.h"
#include "nsThemeConstants.h" #include "nsThemeConstants.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsIHTMLDocument.h"
#include "nsLayoutUtils.h" #include "nsLayoutUtils.h"
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsBlockFrame.h" #include "nsBlockFrame.h"
@ -85,6 +84,8 @@
#include "nsCSSRenderingBorders.h" #include "nsCSSRenderingBorders.h"
using namespace mozilla;
/** /**
* This is a small wrapper class to encapsulate image drawing that can draw an * 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 * nsStyleImage image, which may internally be a real image, a sub image, or a
@ -937,36 +938,43 @@ nsCSSRendering::FindBackgroundStyleFrame(nsIFrame* aForFrame)
const nsStyleBackground* result = aForFrame->GetStyleBackground(); const nsStyleBackground* result = aForFrame->GetStyleBackground();
// Check if we need to do propagation from BODY rather than HTML. // Check if we need to do propagation from BODY rather than HTML.
if (result->IsTransparent()) { if (!result->IsTransparent()) {
nsIContent* content = aForFrame->GetContent(); return aForFrame;
// 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);
}
}
}
}
} }
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;
}
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);
} }
/** /**
@ -1027,11 +1035,10 @@ FindElementBackground(nsIFrame* aForFrame, nsIFrame* aRootElementFrame,
// We should only look at the <html> background if we're in an HTML document // We should only look at the <html> background if we're in an HTML document
nsIDocument* document = content->GetOwnerDoc(); nsIDocument* document = content->GetOwnerDoc();
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document); if (!document)
if (!htmlDoc)
return PR_TRUE; return PR_TRUE;
nsIContent* bodyContent = htmlDoc->GetBodyContentExternal(); dom::Element* bodyContent = document->GetBodyElement();
if (bodyContent != content) if (bodyContent != content)
return PR_TRUE; // this wasn't the background that was propagated return PR_TRUE; // this wasn't the background that was propagated

Просмотреть файл

@ -63,8 +63,6 @@
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIPresShell.h" #include "nsIPresShell.h"
#include "nsStyleConsts.h" #include "nsStyleConsts.h"
#include "nsIHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsCSSAnonBoxes.h" #include "nsCSSAnonBoxes.h"
#include "nsRuleWalker.h" #include "nsRuleWalker.h"
#include "nsRuleData.h" #include "nsRuleData.h"