Title: [184177] releases/WebKitGTK/webkit-2.8/Source/WebCore
Revision
184177
Author
[email protected]
Date
2015-05-12 01:47:14 -0700 (Tue, 12 May 2015)

Log Message

Merge r183885 - Optimize topLeftLocationOffset() addition in updateLayerPosition
https://bugs.webkit.org/show_bug.cgi?id=144704

Reviewed by Dean Jackson.

* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
* page/FrameView.h:
Move the hasFlippedBlocks bit to FrameView instead of RenderView. Works better for inlining
the check in any renderer header, and it also makes more sense conceptually, since the RenderView
itself could be a flipped block.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::layoutOverflowRectForPropagation):
Change over to the FrameView bit.

* rendering/RenderBox.h:
(WebCore::RenderBox::applyTopLeftLocationOffset):
Add a new inlined function that can apply the top left location offset to a point without
multiple LayoutSize creations and copies. It invokes a helper for flipping that is not
inlined only in the case where actual flipped blocks exist in the render tree.

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::updateFromStyle):
Set the bit on the FrameView now instead of the RenderView.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPosition):
Call the new applyTopLeftLocationOffset function so that the point can have offsets added
in without any extra copies.

(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLineBoxList.cpp:
(WebCore::RenderLineBoxList::rangeIntersectsRect):
Switch over to the bit on the FrameView.

* rendering/RenderView.cpp:
(WebCore::RenderView::RenderView):
* rendering/RenderView.h:
Get rid of the bit on the RenderView.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (184176 => 184177)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-05-12 08:38:44 UTC (rev 184176)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-05-12 08:47:14 UTC (rev 184177)
@@ -1,5 +1,48 @@
 2015-05-06  David Hyatt  <[email protected]>
 
+        Optimize topLeftLocationOffset() addition in updateLayerPosition
+        https://bugs.webkit.org/show_bug.cgi?id=144704
+
+        Reviewed by Dean Jackson.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::FrameView):
+        * page/FrameView.h:
+        Move the hasFlippedBlocks bit to FrameView instead of RenderView. Works better for inlining
+        the check in any renderer header, and it also makes more sense conceptually, since the RenderView
+        itself could be a flipped block.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::layoutOverflowRectForPropagation):
+        Change over to the FrameView bit.
+
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::applyTopLeftLocationOffset):
+        Add a new inlined function that can apply the top left location offset to a point without
+        multiple LayoutSize creations and copies. It invokes a helper for flipping that is not
+        inlined only in the case where actual flipped blocks exist in the render tree.
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::updateFromStyle):
+        Set the bit on the FrameView now instead of the RenderView.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateLayerPosition):
+        Call the new applyTopLeftLocationOffset function so that the point can have offsets added
+        in without any extra copies.
+
+        (WebCore::RenderLayer::calculateClipRects):
+        * rendering/RenderLineBoxList.cpp:
+        (WebCore::RenderLineBoxList::rangeIntersectsRect):
+        Switch over to the bit on the FrameView.
+
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::RenderView):
+        * rendering/RenderView.h:
+        Get rid of the bit on the RenderView.
+
+2015-05-06  David Hyatt  <[email protected]>
+
         Optimize relativePositionOffset() to avoid doing unnecessary work
         https://bugs.webkit.org/show_bug.cgi?id=144698
 

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/page/FrameView.cpp (184176 => 184177)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/page/FrameView.cpp	2015-05-12 08:38:44 UTC (rev 184176)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/page/FrameView.cpp	2015-05-12 08:47:14 UTC (rev 184177)
@@ -202,6 +202,7 @@
     , m_footerHeight(0)
     , m_milestonesPendingPaint(0)
     , m_visualUpdatesAllowedByClient(true)
+    , m_hasFlippedBlockRenderers(false)
     , m_scrollPinningBehavior(DoNotPin)
 {
     init();

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/page/FrameView.h (184176 => 184177)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/page/FrameView.h	2015-05-12 08:38:44 UTC (rev 184176)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/page/FrameView.h	2015-05-12 08:47:14 UTC (rev 184177)
@@ -500,6 +500,9 @@
 
     ScrollBehaviorForFixedElements scrollBehaviorForFixedElements() const;
 
+    bool hasFlippedBlockRenderers() const { return m_hasFlippedBlockRenderers; }
+    void setHasFlippedBlockRenderers(bool b) { m_hasFlippedBlockRenderers = b; }
+
     void updateWidgetPositions();
     void didAddWidgetToRenderTree(Widget&);
     void willRemoveWidgetFromRenderTree(Widget&);
@@ -780,7 +783,8 @@
 #endif
 
     bool m_visualUpdatesAllowedByClient;
-    
+    bool m_hasFlippedBlockRenderers;
+
     ScrollPinningBehavior m_scrollPinningBehavior;
 
     IntRect* m_cachedWindowClipRect { nullptr };

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBox.cpp (184176 => 184177)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBox.cpp	2015-05-12 08:38:44 UTC (rev 184176)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBox.cpp	2015-05-12 08:47:14 UTC (rev 184177)
@@ -4749,7 +4749,7 @@
 
 LayoutPoint RenderBox::topLeftLocation() const
 {
-    if (!view().hasFlippedBlockDescendants())
+    if (!view().frameView().hasFlippedBlockRenderers())
         return location();
     
     RenderBlock* containerBlock = containingBlock();
@@ -4760,8 +4760,8 @@
 
 LayoutSize RenderBox::topLeftLocationOffset() const
 {
-    if (!view().hasFlippedBlockDescendants())
-        return LayoutSize(m_frameRect.x(), m_frameRect.y());
+    if (!view().frameView().hasFlippedBlockRenderers())
+        return locationOffset();
 
     RenderBlock* containerBlock = containingBlock();
     if (!containerBlock || containerBlock == this)
@@ -4772,6 +4772,19 @@
     return LayoutSize(rect.x(), rect.y());
 }
 
+void RenderBox::applyTopLeftLocationOffsetWithFlipping(LayoutPoint& point) const
+{
+    RenderBlock* containerBlock = containingBlock();
+    if (!containerBlock || containerBlock == this) {
+        point.move(m_frameRect.x(), m_frameRect.y());
+        return;
+    }
+    
+    LayoutRect rect(frameRect());
+    containerBlock->flipForWritingMode(rect); // FIXME: This is wrong if we are an absolutely positioned object  enclosed by a relative-positioned inline.
+    point.move(rect.x(), rect.y());
+}
+
 bool RenderBox::hasRelativeDimensions() const
 {
     return style().height().isPercent() || style().width().isPercent()

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBox.h (184176 => 184177)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBox.h	2015-05-12 08:38:44 UTC (rev 184176)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBox.h	2015-05-12 08:47:14 UTC (rev 184177)
@@ -23,6 +23,7 @@
 #ifndef RenderBox_h
 #define RenderBox_h
 
+#include "FrameView.h"
 #include "RenderBoxModelObject.h"
 #include "RenderOverflow.h"
 #include "ScrollTypes.h"
@@ -551,6 +552,14 @@
     // In layout related methods you almost always want the logical location (e.g. x() and y()).
     LayoutPoint topLeftLocation() const;
     LayoutSize topLeftLocationOffset() const;
+    void applyTopLeftLocationOffset(LayoutPoint& point) const
+    {
+        // This is inlined for speed, since it is used by updateLayerPosition() during scrolling.
+        if (!document().view()->hasFlippedBlockRenderers())
+            point.move(m_frameRect.x(), m_frameRect.y());
+        else
+            applyTopLeftLocationOffsetWithFlipping(point);
+    }
 
     LayoutRect logicalVisualOverflowRectForPropagation(RenderStyle*) const;
     LayoutRect visualOverflowRectForPropagation(RenderStyle*) const;
@@ -706,6 +715,8 @@
     virtual void computePreferredLogicalWidths() { setPreferredLogicalWidthsDirty(false); }
 
     virtual LayoutRect frameRectForStickyPositioning() const override final { return frameRect(); }
+    
+    void applyTopLeftLocationOffsetWithFlipping(LayoutPoint&) const;
 
 private:
     // The width/height of the contents + borders + padding.  The x/y location is relative to our container (which is not always our parent).

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBoxModelObject.cpp (184176 => 184177)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBoxModelObject.cpp	2015-05-12 08:38:44 UTC (rev 184176)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderBoxModelObject.cpp	2015-05-12 08:47:14 UTC (rev 184177)
@@ -220,7 +220,7 @@
     setPositionState(styleToUse.position());
     setHorizontalWritingMode(styleToUse.isHorizontalWritingMode());
     if (styleToUse.isFlippedBlocksWritingMode())
-        view().setHasFlippedBlockDescendants(true);
+        view().frameView().setHasFlippedBlockRenderers(true);
 }
 
 static LayoutSize accumulateInFlowPositionOffsets(const RenderObject* child)

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayer.cpp (184176 => 184177)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayer.cpp	2015-05-12 08:38:44 UTC (rev 184176)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLayer.cpp	2015-05-12 08:47:14 UTC (rev 184177)
@@ -1316,7 +1316,7 @@
     } else if (RenderBox* box = renderBox()) {
         // FIXME: Is snapping the size really needed here for the RenderBox case?
         setSize(box->pixelSnappedSize());
-        localPoint += box->topLeftLocationOffset();
+        box->applyTopLeftLocationOffset(localPoint);
     }
 
     RenderElement* ancestor;
@@ -5802,7 +5802,7 @@
 LayoutRect RenderLayer::boundingBox(const RenderLayer* ancestorLayer, const LayoutSize& offsetFromRoot, CalculateLayerBoundsFlags flags) const
 {    
     LayoutRect result = localBoundingBox(flags);
-    if (renderer().view().hasFlippedBlockDescendants()) {
+    if (renderer().view().frameView().hasFlippedBlockRenderers()) {
         if (renderer().isBox())
             renderBox()->flipForWritingMode(result);
         else
@@ -5867,7 +5867,7 @@
 
     LayoutRect boundingBoxRect = localBoundingBox(flags);
 
-    if (renderer().view().hasFlippedBlockDescendants()) {
+    if (renderer().view().frameView().hasFlippedBlockRenderers()) {
         if (is<RenderBox>(renderer()))
             downcast<RenderBox>(renderer()).flipForWritingMode(boundingBoxRect);
         else

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLineBoxList.cpp (184176 => 184177)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLineBoxList.cpp	2015-05-12 08:38:44 UTC (rev 184176)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderLineBoxList.cpp	2015-05-12 08:47:14 UTC (rev 184177)
@@ -154,7 +154,7 @@
 {
     LayoutUnit physicalStart = logicalTop;
     LayoutUnit physicalEnd = logicalBottom;
-    if (renderer->view().hasFlippedBlockDescendants()) {
+    if (renderer->view().frameView().hasFlippedBlockRenderers()) {
         RenderBox* block;
         if (is<RenderBox>(*renderer))
             block = downcast<RenderBox>(renderer);

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderView.cpp (184176 => 184177)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderView.cpp	2015-05-12 08:38:44 UTC (rev 184176)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderView.cpp	2015-05-12 08:47:14 UTC (rev 184177)
@@ -111,7 +111,6 @@
     , m_renderCounterCount(0)
     , m_selectionWasCaret(false)
     , m_hasSoftwareFilters(false)
-    , m_hasFlippedBlockDescendants(false)
 #if ENABLE(SERVICE_CONTROLS)
     , m_selectionRectGatherer(*this)
 #endif

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderView.h (184176 => 184177)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderView.h	2015-05-12 08:38:44 UTC (rev 184176)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderView.h	2015-05-12 08:47:14 UTC (rev 184177)
@@ -104,9 +104,6 @@
 
     LayoutRect viewRect() const;
 
-    bool hasFlippedBlockDescendants() const { return m_hasFlippedBlockDescendants; }
-    void setHasFlippedBlockDescendants(bool b) { m_hasFlippedBlockDescendants = b; }
-
     // layoutDelta is used transiently during layout to store how far an object has moved from its
     // last layout location, in order to repaint correctly.
     // If we're doing a full repaint m_layoutState will be 0, but in that case layoutDelta doesn't matter.
@@ -364,7 +361,6 @@
 
     bool m_selectionWasCaret;
     bool m_hasSoftwareFilters;
-    bool m_hasFlippedBlockDescendants;
 
     HashSet<RenderElement*> m_renderersWithPausedImageAnimation;
     Vector<RefPtr<RenderWidget>> m_protectedRenderWidgets;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to