From 970eee3834d88bd7ebac763c59e45667bfebe73d Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 5 Mar 2002 23:17:32 +0000 Subject: [PATCH] Make FindBackground not QI to nsIHTMLBodyElement -- this makes it much faster. Bug 129079, r=rjesup@wgate.com, sr=jst, a=asa git-svn-id: svn://10.0.0.236/trunk@115871 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSRendering.cpp | 13 ++++++++++--- mozilla/layout/html/style/src/nsCSSRendering.cpp | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp index 04a9f210a3e..565ec6cf43e 100644 --- a/mozilla/layout/base/nsCSSRendering.cpp +++ b/mozilla/layout/base/nsCSSRendering.cpp @@ -2509,9 +2509,16 @@ FindElementBackground(nsIPresContext* aPresContext, nsCOMPtr content; aForFrame->GetContent(getter_AddRefs(content)); - nsCOMPtr body = do_QueryInterface(content); - if (!body || !parentFrame) - return PR_TRUE; // not frame for BODY element + if (!content || !content->IsContentOfType(nsIContent::eHTML)) + return PR_TRUE; // not frame for an HTML element + + if (!parentFrame) + return PR_TRUE; // no parent to look at + + nsCOMPtr tag; + content->GetTag(*getter_AddRefs(tag)); + if (tag != nsHTMLAtoms::body) + return PR_TRUE; // not frame for element // We should only look at the background if we're in an HTML document nsCOMPtr node(do_QueryInterface(content)); diff --git a/mozilla/layout/html/style/src/nsCSSRendering.cpp b/mozilla/layout/html/style/src/nsCSSRendering.cpp index 04a9f210a3e..565ec6cf43e 100644 --- a/mozilla/layout/html/style/src/nsCSSRendering.cpp +++ b/mozilla/layout/html/style/src/nsCSSRendering.cpp @@ -2509,9 +2509,16 @@ FindElementBackground(nsIPresContext* aPresContext, nsCOMPtr content; aForFrame->GetContent(getter_AddRefs(content)); - nsCOMPtr body = do_QueryInterface(content); - if (!body || !parentFrame) - return PR_TRUE; // not frame for BODY element + if (!content || !content->IsContentOfType(nsIContent::eHTML)) + return PR_TRUE; // not frame for an HTML element + + if (!parentFrame) + return PR_TRUE; // no parent to look at + + nsCOMPtr tag; + content->GetTag(*getter_AddRefs(tag)); + if (tag != nsHTMLAtoms::body) + return PR_TRUE; // not frame for element // We should only look at the background if we're in an HTML document nsCOMPtr node(do_QueryInterface(content));