Title: [177193] trunk/Source/WebCore
Revision
177193
Author
[email protected]
Date
2014-12-11 16:46:19 -0800 (Thu, 11 Dec 2014)

Log Message

Optimize RenderElement::rendererForRootBackground() a bit
https://bugs.webkit.org/show_bug.cgi?id=139527

Reviewed by Andreas Kling.

Optimize RenderElement::rendererForRootBackground() a bit by not
calling Document::body(). We are only interested in the child element
with a <body> tag. However, Document::body() first checks if a
<frameset> child is present.

No new tests, no behavior change.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::rendererForRootBackground):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (177192 => 177193)


--- trunk/Source/WebCore/ChangeLog	2014-12-12 00:25:16 UTC (rev 177192)
+++ trunk/Source/WebCore/ChangeLog	2014-12-12 00:46:19 UTC (rev 177193)
@@ -1,3 +1,20 @@
+2014-12-11  Chris Dumez  <[email protected]>
+
+        Optimize RenderElement::rendererForRootBackground() a bit
+        https://bugs.webkit.org/show_bug.cgi?id=139527
+
+        Reviewed by Andreas Kling.
+
+        Optimize RenderElement::rendererForRootBackground() a bit by not
+        calling Document::body(). We are only interested in the child element
+        with a <body> tag. However, Document::body() first checks if a
+        <frameset> child is present.
+
+        No new tests, no behavior change.
+
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::rendererForRootBackground):
+
 2014-12-11  Brendan Long  <[email protected]>
 
         Remove DataCue "text" attribute

Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (177192 => 177193)


--- trunk/Source/WebCore/rendering/RenderElement.cpp	2014-12-12 00:25:16 UTC (rev 177192)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp	2014-12-12 00:46:19 UTC (rev 177193)
@@ -29,10 +29,12 @@
 #include "ContentData.h"
 #include "ControlStates.h"
 #include "CursorList.h"
+#include "ElementChildIterator.h"
 #include "EventHandler.h"
 #include "Frame.h"
 #include "FrameSelection.h"
-#include "HTMLElement.h"
+#include "HTMLBodyElement.h"
+#include "HTMLHtmlElement.h"
 #include "HTMLNames.h"
 #include "FlowThreadController.h"
 #include "RenderCounter.h"
@@ -1107,16 +1109,14 @@
 RenderElement& RenderElement::rendererForRootBackground()
 {
     ASSERT(isRoot());
-    if (!hasBackground() && element() && element()->hasTagName(HTMLNames::htmlTag)) {
+    if (!hasBackground() && is<HTMLHtmlElement>(element())) {
         // Locate the <body> element using the DOM. This is easier than trying
         // to crawl around a render tree with potential :before/:after content and
         // anonymous blocks created by inline <body> tags etc. We can locate the <body>
         // render object very easily via the DOM.
-        if (auto body = document().body()) {
-            if (body->hasTagName(HTMLNames::bodyTag)) {
-                if (auto renderer = body->renderer())
-                    return *renderer;
-            }
+        if (auto* body = childrenOfType<HTMLBodyElement>(*element()).first()) {
+            if (auto* renderer = body->renderer())
+                return *renderer;
         }
     }
     return *this;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to