Title: [134162] trunk/Source/WebCore
Revision
134162
Author
[email protected]
Date
2012-11-10 13:56:15 -0800 (Sat, 10 Nov 2012)

Log Message

Some minor optimizations in RenderLayer
https://bugs.webkit.org/show_bug.cgi?id=101847

Reviewed by Anders Carlsson.

Some minor performance improvements in RenderLayer code.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPosition): isRenderInline() is a virtual call,
so prefix it with an isInline() check which tests a bit on RenderObject.
(WebCore::RenderLayer::localBoundingBox): Ditto.
(WebCore::RenderLayer::calculateLayerBounds): Pull layer->renderer()
into a local variable.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134161 => 134162)


--- trunk/Source/WebCore/ChangeLog	2012-11-10 21:19:43 UTC (rev 134161)
+++ trunk/Source/WebCore/ChangeLog	2012-11-10 21:56:15 UTC (rev 134162)
@@ -1,3 +1,19 @@
+2012-11-10  Simon Fraser  <[email protected]>
+
+        Some minor optimizations in RenderLayer
+        https://bugs.webkit.org/show_bug.cgi?id=101847
+
+        Reviewed by Anders Carlsson.
+
+        Some minor performance improvements in RenderLayer code.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateLayerPosition): isRenderInline() is a virtual call,
+        so prefix it with an isInline() check which tests a bit on RenderObject.
+        (WebCore::RenderLayer::localBoundingBox): Ditto.
+        (WebCore::RenderLayer::calculateLayerBounds): Pull layer->renderer()
+        into a local variable.
+
 2012-11-10  Anders Carlsson  <[email protected]>
 
         Document::m_fullScreenElementStack should be a Vector

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (134161 => 134162)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-11-10 21:19:43 UTC (rev 134161)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-11-10 21:56:15 UTC (rev 134162)
@@ -848,7 +848,7 @@
 {
     LayoutPoint localPoint;
     LayoutSize inlineBoundingBoxOffset; // We don't put this into the RenderLayer x/y for inlines, so we need to subtract it out when done.
-    if (renderer()->isRenderInline()) {
+    if (renderer()->isInline() && renderer()->isRenderInline()) {
         RenderInline* inlineFlow = toRenderInline(renderer());
         IntRect lineBox = inlineFlow->linesBoundingBox();
         setSize(lineBox.size());
@@ -4319,7 +4319,7 @@
     // as part of our bounding box.  We do this because we are the responsible layer for both hit testing and painting those
     // floats.
     LayoutRect result;
-    if (renderer()->isRenderInline())
+    if (renderer()->isInline() && renderer()->isRenderInline())
         result = toRenderInline(renderer())->linesVisualOverflowBoundingBox();
     else if (renderer()->isTableRow()) {
         // Our bounding box is just the union of all of our cells' border/overflow rects.
@@ -4382,17 +4382,18 @@
     if ((flags & ExcludeHiddenDescendants) && layer != ancestorLayer && !layer->hasVisibleContent() && !layer->hasVisibleDescendant())
         return IntRect();
 
+    RenderLayerModelObject* renderer = layer->renderer();
     LayoutRect boundingBoxRect = layer->localBoundingBox();
-    if (layer->renderer()->isBox())
-        layer->renderBox()->flipForWritingMode(boundingBoxRect);
+    if (renderer->isBox())
+        toRenderBox(renderer)->flipForWritingMode(boundingBoxRect);
     else
-        layer->renderer()->containingBlock()->flipForWritingMode(boundingBoxRect);
+        renderer->containingBlock()->flipForWritingMode(boundingBoxRect);
 
-    if (layer->renderer()->isRoot()) {
+    if (renderer->isRoot()) {
         // If the root layer becomes composited (e.g. because some descendant with negative z-index is composited),
         // then it has to be big enough to cover the viewport in order to display the background. This is akin
         // to the code in RenderBox::paintRootBoxFillLayers().
-        if (FrameView* frameView = layer->renderer()->view()->frameView()) {
+        if (FrameView* frameView = renderer->view()->frameView()) {
             LayoutUnit contentsWidth = frameView->contentsWidth();
             LayoutUnit contentsHeight = frameView->contentsHeight();
         
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to