Title: [90485] trunk/Source/WebCore
Revision
90485
Author
[email protected]
Date
2011-07-06 13:20:05 -0700 (Wed, 06 Jul 2011)

Log Message

2011-07-06  Emil A Eklund  <[email protected]>

        Reviewed by Eric Seidel.

        Switch RenderLayer::hitTest* to to new layout types
        https://bugs.webkit.org/show_bug.cgi?id=63640

        Switch hit testing and supporting methods for RenderLayer over to the new
        layout unit abstraction.

        No new tests, no functionality changes.

        * rendering/LayoutTypes.h:
        (WebCore::roundedLayoutPoint):
        Add roundedLayoutPoint abstraction, calls roundedIntPoint now but will be a
        no-op (and eventually go away) once we switch to float or fixed point.

        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::createLocalTransformState):
        (WebCore::RenderLayer::hitTestLayer):
        (WebCore::RenderLayer::hitTestList):
        (WebCore::RenderLayer::hitTestPaginatedChildLayer):
        (WebCore::RenderLayer::hitTestChildLayerColumns):
        (WebCore::RenderLayer::calculateRects):
        * rendering/RenderLayer.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90484 => 90485)


--- trunk/Source/WebCore/ChangeLog	2011-07-06 20:15:07 UTC (rev 90484)
+++ trunk/Source/WebCore/ChangeLog	2011-07-06 20:20:05 UTC (rev 90485)
@@ -1,3 +1,29 @@
+2011-07-06  Emil A Eklund  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        Switch RenderLayer::hitTest* to to new layout types
+        https://bugs.webkit.org/show_bug.cgi?id=63640
+
+        Switch hit testing and supporting methods for RenderLayer over to the new
+        layout unit abstraction.
+        
+        No new tests, no functionality changes.
+
+        * rendering/LayoutTypes.h:
+        (WebCore::roundedLayoutPoint):
+        Add roundedLayoutPoint abstraction, calls roundedIntPoint now but will be a
+        no-op (and eventually go away) once we switch to float or fixed point.
+        
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::createLocalTransformState):
+        (WebCore::RenderLayer::hitTestLayer):
+        (WebCore::RenderLayer::hitTestList):
+        (WebCore::RenderLayer::hitTestPaginatedChildLayer):
+        (WebCore::RenderLayer::hitTestChildLayerColumns):
+        (WebCore::RenderLayer::calculateRects):
+        * rendering/RenderLayer.h:
+
 2011-07-06  Simon Fraser  <[email protected]>
 
         Have RenderLayerCompositor take care of clearing backing store when entering the page cache

Modified: trunk/Source/WebCore/rendering/LayoutTypes.h (90484 => 90485)


--- trunk/Source/WebCore/rendering/LayoutTypes.h	2011-07-06 20:15:07 UTC (rev 90484)
+++ trunk/Source/WebCore/rendering/LayoutTypes.h	2011-07-06 20:20:05 UTC (rev 90485)
@@ -36,6 +36,7 @@
 #ifndef LayoutTypes_h
 #define LayoutTypes_h
 
+#include "FloatPoint.h"
 #include "IntRect.h"
 
 namespace WebCore {
@@ -45,6 +46,11 @@
 typedef IntSize LayoutSize;
 typedef IntRect LayoutRect;
 
+inline LayoutPoint roundedLayoutPoint(FloatPoint point)
+{
+    return roundedIntPoint(point);
+}
+
 } // namespace WebCore
 
 #endif // LayoutTypes_h

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (90484 => 90485)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-07-06 20:15:07 UTC (rev 90484)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-07-06 20:20:05 UTC (rev 90485)
@@ -2912,11 +2912,11 @@
 }
 
 PassRefPtr<HitTestingTransformState> RenderLayer::createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer,
-                                        const IntRect& hitTestRect, const IntPoint& hitTestPoint,
+                                        const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint,
                                         const HitTestingTransformState* containerTransformState) const
 {
     RefPtr<HitTestingTransformState> transformState;
-    IntPoint offset;
+    LayoutPoint offset;
     if (containerTransformState) {
         // If we're already computing transform state, then it's relative to the container (which we know is non-null).
         transformState = HitTestingTransformState::create(*containerTransformState);
@@ -2974,7 +2974,7 @@
 // If zOffset is non-null (which indicates that the caller wants z offset information), 
 //  *zOffset on return is the z offset of the hit point relative to the containing flattening layer.
 RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
-                                       const IntRect& hitTestRect, const IntPoint& hitTestPoint, bool appliedTransform,
+                                       const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, bool appliedTransform,
                                        const HitTestingTransformState* transformState, double* zOffset)
 {
     // The natural thing would be to keep HitTestingTransformState on the stack, but it's big, so we heap-allocate.
@@ -2985,7 +2985,7 @@
 #endif
     useTemporaryClipRects |= renderer()->view()->frameView()->containsScrollableAreaWithOverlayScrollbars();
 
-    IntRect hitTestArea = result.rectForPoint(hitTestPoint);
+    LayoutRect hitTestArea = result.rectForPoint(hitTestPoint);
 
     // Apply a transform if we have one.
     if (transform() && !appliedTransform) {
@@ -3010,8 +3010,8 @@
         //
         // We can't just map hitTestPoint and hitTestRect because they may have been flattened (losing z)
         // by our container.
-        IntPoint localPoint = roundedIntPoint(newTransformState->mappedPoint());
-        IntRect localHitTestRect;
+        LayoutPoint localPoint = roundedLayoutPoint(newTransformState->mappedPoint());
+        LayoutRect localHitTestRect;
 #if USE(ACCELERATED_COMPOSITING)
         if (isComposited()) {
             // It doesn't make sense to project hitTestRect into the plane of this layer, so use the same bounds we use for painting.
@@ -3055,10 +3055,10 @@
     }
     
     // Calculate the clip rects we should use.
-    IntRect layerBounds;
-    IntRect bgRect;
-    IntRect fgRect;
-    IntRect outlineRect;
+    LayoutRect layerBounds;
+    LayoutRect bgRect;
+    LayoutRect fgRect;
+    LayoutRect outlineRect;
     calculateRects(rootLayer, hitTestRect, layerBounds, bgRect, fgRect, outlineRect, useTemporaryClipRects, IncludeOverlayScrollbarSize);
     
     // The following are used for keeping track of the z-depth of the hit point of 3d-transformed
@@ -3180,7 +3180,7 @@
 
 RenderLayer* RenderLayer::hitTestList(Vector<RenderLayer*>* list, RenderLayer* rootLayer,
                                       const HitTestRequest& request, HitTestResult& result,
-                                      const IntRect& hitTestRect, const IntPoint& hitTestPoint,
+                                      const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint,
                                       const HitTestingTransformState* transformState, 
                                       double* zOffsetForDescendants, double* zOffset,
                                       const HitTestingTransformState* unflattenedTransformState,
@@ -3217,7 +3217,7 @@
 }
 
 RenderLayer* RenderLayer::hitTestPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result,
-                                                     const IntRect& hitTestRect, const IntPoint& hitTestPoint, const HitTestingTransformState* transformState, double* zOffset)
+                                                     const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, const HitTestingTransformState* transformState, double* zOffset)
 {
     Vector<RenderLayer*> columnLayers;
     RenderLayer* ancestorLayer = isNormalFlowOnly() ? parent() : stackingContext();
@@ -3234,7 +3234,7 @@
 }
 
 RenderLayer* RenderLayer::hitTestChildLayerColumns(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result,
-                                                   const IntRect& hitTestRect, const IntPoint& hitTestPoint, const HitTestingTransformState* transformState, double* zOffset,
+                                                   const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, const HitTestingTransformState* transformState, double* zOffset,
                                                    const Vector<RenderLayer*>& columnLayers, size_t columnIndex)
 {
     RenderBlock* columnBlock = toRenderBlock(columnLayers[columnIndex]->renderer());
@@ -3243,7 +3243,7 @@
     if (!columnBlock || !columnBlock->hasColumns())
         return 0;
 
-    IntPoint layerOffset;
+    LayoutPoint layerOffset;
     columnBlock->layer()->convertToLayerCoords(rootLayer, layerOffset);
     
     ColumnInfo* colInfo = columnBlock->columnInfo();
@@ -3251,12 +3251,12 @@
     
     // We have to go backwards from the last column to the first.
     bool isHorizontal = columnBlock->style()->isHorizontalWritingMode();
-    int logicalLeft = columnBlock->logicalLeftOffsetForContent();
-    int currLogicalTopOffset = 0;
+    LayoutUnit logicalLeft = columnBlock->logicalLeftOffsetForContent();
+    LayoutUnit currLogicalTopOffset = 0;
     int i;
     for (i = 0; i < colCount; i++) {
-        IntRect colRect = columnBlock->columnRectAt(colInfo, i);
-        int blockDelta =  (isHorizontal ? colRect.height() : colRect.width());
+        LayoutRect colRect = columnBlock->columnRectAt(colInfo, i);
+        LayoutUnit blockDelta =  (isHorizontal ? colRect.height() : colRect.width());
         if (columnBlock->style()->isFlippedBlocksWritingMode())
             currLogicalTopOffset += blockDelta;
         else
@@ -3264,20 +3264,20 @@
     }
     for (i = colCount - 1; i >= 0; i--) {
         // For each rect, we clip to the rect, and then we adjust our coords.
-        IntRect colRect = columnBlock->columnRectAt(colInfo, i);
+        LayoutRect colRect = columnBlock->columnRectAt(colInfo, i);
         columnBlock->flipForWritingMode(colRect);
-        int currLogicalLeftOffset = (isHorizontal ? colRect.x() : colRect.y()) - logicalLeft;
-        int blockDelta =  (isHorizontal ? colRect.height() : colRect.width());
+        LayoutUnit currLogicalLeftOffset = (isHorizontal ? colRect.x() : colRect.y()) - logicalLeft;
+        LayoutUnit blockDelta =  (isHorizontal ? colRect.height() : colRect.width());
         if (columnBlock->style()->isFlippedBlocksWritingMode())
             currLogicalTopOffset -= blockDelta;
         else
             currLogicalTopOffset += blockDelta;
         colRect.moveBy(layerOffset);
 
-        IntRect localClipRect(hitTestRect);
+        LayoutRect localClipRect(hitTestRect);
         localClipRect.intersect(colRect);
         
-        IntSize offset = isHorizontal ? IntSize(currLogicalLeftOffset, currLogicalTopOffset) : IntSize(currLogicalTopOffset, currLogicalLeftOffset);
+        LayoutSize offset = isHorizontal ? LayoutSize(currLogicalLeftOffset, currLogicalTopOffset) : LayoutSize(currLogicalTopOffset, currLogicalLeftOffset);
 
         if (!localClipRect.isEmpty() && localClipRect.intersects(result.rectForPoint(hitTestPoint))) {
             RenderLayer* hitLayer = 0;
@@ -3302,8 +3302,8 @@
                 RenderLayer* nextLayer = columnLayers[columnIndex - 1];
                 RefPtr<HitTestingTransformState> newTransformState = nextLayer->createLocalTransformState(rootLayer, nextLayer, localClipRect, hitTestPoint, transformState);
                 newTransformState->translate(offset.width(), offset.height(), HitTestingTransformState::AccumulateTransform);
-                IntPoint localPoint = roundedIntPoint(newTransformState->mappedPoint());
-                IntRect localHitTestRect = newTransformState->mappedQuad().enclosingBoundingBox();
+                LayoutPoint localPoint = roundedLayoutPoint(newTransformState->mappedPoint());
+                LayoutRect localHitTestRect = newTransformState->mappedQuad().enclosingBoundingBox();
                 newTransformState->flatten();
 
                 hitLayer = hitTestChildLayerColumns(childLayer, columnLayers[columnIndex - 1], request, result, localHitTestRect, localPoint,
@@ -3433,8 +3433,8 @@
     return backgroundRect;
 }
 
-void RenderLayer::calculateRects(const RenderLayer* rootLayer, const IntRect& paintDirtyRect, IntRect& layerBounds,
-                                 IntRect& backgroundRect, IntRect& foregroundRect, IntRect& outlineRect, bool temporaryClipRects,
+void RenderLayer::calculateRects(const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
+                                 LayoutRect& backgroundRect, LayoutRect& foregroundRect, LayoutRect& outlineRect, bool temporaryClipRects,
                                  OverlayScrollbarSizeRelevancy relevancy) const
 {
     if (rootLayer != this && parent()) {
@@ -3446,9 +3446,9 @@
     foregroundRect = backgroundRect;
     outlineRect = backgroundRect;
     
-    IntPoint offset;
+    LayoutPoint offset;
     convertToLayerCoords(rootLayer, offset);
-    layerBounds = IntRect(offset, size());
+    layerBounds = LayoutRect(offset, size());
     
     // Update the clip rects that will be passed to child layers.
     if (renderer()->hasOverflowClip() || renderer()->hasClip()) {
@@ -3457,7 +3457,7 @@
             foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(offset, relevancy));
         if (renderer()->hasClip()) {
             // Clip applies to *us* as well, so go ahead and update the damageRect.
-            IntRect newPosClip = toRenderBox(renderer())->clipRect(offset);
+            LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset);
             backgroundRect.intersect(newPosClip);
             foregroundRect.intersect(newPosClip);
             outlineRect.intersect(newPosClip);
@@ -3468,7 +3468,7 @@
         // FIXME: This could be changed to just use generic visual overflow.
         // See https://bugs.webkit.org/show_bug.cgi?id=37467 for more information.
         if (const ShadowData* boxShadow = renderer()->style()->boxShadow()) {
-            IntRect overflow = layerBounds;
+            LayoutRect overflow = layerBounds;
             do {
                 if (boxShadow->style() == Normal) {
                     IntRect shadowRect = layerBounds;

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (90484 => 90485)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2011-07-06 20:15:07 UTC (rev 90484)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2011-07-06 20:20:05 UTC (rev 90485)
@@ -375,8 +375,8 @@
     // This method figures out our layerBounds in coordinates relative to
     // |rootLayer}.  It also computes our background and foreground clip rects
     // for painting/event handling.
-    void calculateRects(const RenderLayer* rootLayer, const IntRect& paintDirtyRect, IntRect& layerBounds,
-                        IntRect& backgroundRect, IntRect& foregroundRect, IntRect& outlineRect, bool temporaryClipRects = false,
+    void calculateRects(const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
+                        LayoutRect& backgroundRect, LayoutRect& foregroundRect, LayoutRect& outlineRect, bool temporaryClipRects = false,
                         OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
 
     // Compute and cache clip rects computed with the given layer as the root
@@ -506,22 +506,22 @@
                                     PaintLayerFlags, const Vector<RenderLayer*>& columnLayers, size_t columnIndex);
 
     RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
-                              const IntRect& hitTestRect, const IntPoint& hitTestPoint, bool appliedTransform,
+                              const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, bool appliedTransform,
                               const HitTestingTransformState* transformState = 0, double* zOffset = 0);
     RenderLayer* hitTestList(Vector<RenderLayer*>*, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result,
-                             const IntRect& hitTestRect, const IntPoint& hitTestPoint,
+                             const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint,
                              const HitTestingTransformState* transformState, double* zOffsetForDescendants, double* zOffset,
                              const HitTestingTransformState* unflattenedTransformState, bool depthSortDescendants);
     RenderLayer* hitTestPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result,
-                                            const IntRect& hitTestRect, const IntPoint& hitTestPoint,
+                                            const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint,
                                             const HitTestingTransformState* transformState, double* zOffset);
     RenderLayer* hitTestChildLayerColumns(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result,
-                                          const IntRect& hitTestRect, const IntPoint& hitTestPoint,
+                                          const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint,
                                           const HitTestingTransformState* transformState, double* zOffset,
                                           const Vector<RenderLayer*>& columnLayers, size_t columnIndex);
                                     
     PassRefPtr<HitTestingTransformState> createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer,
-                            const IntRect& hitTestRect, const IntPoint& hitTestPoint,
+                            const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint,
                             const HitTestingTransformState* containerTransformState) const;
     
     bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect& layerBounds, const LayoutPoint& hitTestPoint, HitTestFilter) const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to