Title: [123754] trunk/Source/WebCore
Revision
123754
Author
allan.jen...@nokia.com
Date
2012-07-26 09:15:27 -0700 (Thu, 26 Jul 2012)

Log Message

Move region from HitTestResult to HitTestPoint.
https://bugs.webkit.org/show_bug.cgi?id=92367

Reviewed by Antonio Gomes.

Moves the region to HitTestPoint where it makes more sense, and use this
change to simplify hit-testing a new region in RenderFlowThread.

No new functionality. No new tests.

* rendering/HitTestResult.cpp:
(WebCore::HitTestPoint::HitTestPoint):
(WebCore::HitTestPoint::operator=):
(WebCore::HitTestResult::HitTestResult):
(WebCore::HitTestResult::operator=):
* rendering/HitTestResult.h:
(HitTestPoint):
(WebCore::HitTestPoint::region):
(HitTestResult):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::nodeAtPoint):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::nodeAtPoint):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::hitTestRegion):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTestLayer):
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::nodeAtPoint):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::nodeAtPoint):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::nodeAtPoint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123753 => 123754)


--- trunk/Source/WebCore/ChangeLog	2012-07-26 16:12:32 UTC (rev 123753)
+++ trunk/Source/WebCore/ChangeLog	2012-07-26 16:15:27 UTC (rev 123754)
@@ -1,3 +1,39 @@
+2012-07-26  Allan Sandfeld Jensen  <allan.jen...@nokia.com>
+
+        Move region from HitTestResult to HitTestPoint.
+        https://bugs.webkit.org/show_bug.cgi?id=92367
+
+        Reviewed by Antonio Gomes.
+
+        Moves the region to HitTestPoint where it makes more sense, and use this
+        change to simplify hit-testing a new region in RenderFlowThread.
+
+        No new functionality. No new tests.
+
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestPoint::HitTestPoint):
+        (WebCore::HitTestPoint::operator=):
+        (WebCore::HitTestResult::HitTestResult):
+        (WebCore::HitTestResult::operator=):
+        * rendering/HitTestResult.h:
+        (HitTestPoint):
+        (WebCore::HitTestPoint::region):
+        (HitTestResult):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::nodeAtPoint):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::nodeAtPoint):
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::hitTestRegion):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::hitTestLayer):
+        * rendering/RenderRegion.cpp:
+        (WebCore::RenderRegion::nodeAtPoint):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::nodeAtPoint):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::nodeAtPoint):
+
 2012-07-26  Jan Keromnes  <j...@linux.com>
 
         Web Inspector: ExtensionView constructor shouldn't take parent argument

Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (123753 => 123754)


--- trunk/Source/WebCore/rendering/HitTestResult.cpp	2012-07-26 16:12:32 UTC (rev 123753)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp	2012-07-26 16:15:27 UTC (rev 123754)
@@ -49,7 +49,8 @@
 using namespace HTMLNames;
 
 HitTestPoint::HitTestPoint()
-    : m_isRectBased(false)
+    : m_region(0)
+    , m_isRectBased(false)
     , m_isRectilinear(true)
 {
 }
@@ -59,6 +60,7 @@
     , m_boundingBox(rectForPoint(point, 0, 0, 0, 0))
     , m_transformedPoint(point)
     , m_transformedRect(m_boundingBox)
+    , m_region(0)
     , m_isRectBased(false)
     , m_isRectilinear(true)
 {
@@ -69,6 +71,7 @@
     , m_boundingBox(rectForPoint(m_point, 0, 0, 0, 0))
     , m_transformedPoint(point)
     , m_transformedRect(m_boundingBox)
+    , m_region(0)
     , m_isRectBased(false)
     , m_isRectilinear(true)
 {
@@ -77,6 +80,7 @@
 HitTestPoint::HitTestPoint(const FloatPoint& point, const FloatQuad& quad)
     : m_transformedPoint(point)
     , m_transformedRect(quad)
+    , m_region(0)
     , m_isRectBased(true)
 {
     m_point = roundedLayoutPoint(point);
@@ -88,17 +92,31 @@
     : m_point(centerPoint)
     , m_boundingBox(rectForPoint(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding))
     , m_transformedPoint(centerPoint)
+    , m_region(0)
     , m_isRectBased(topPadding || rightPadding || bottomPadding || leftPadding)
     , m_isRectilinear(true)
 {
     m_transformedRect = FloatQuad(m_boundingBox);
 }
 
+HitTestPoint::HitTestPoint(const HitTestPoint& other, const LayoutSize& offset, RenderRegion* region)
+    : m_point(other.m_point)
+    , m_boundingBox(other.m_boundingBox)
+    , m_transformedPoint(other.m_transformedPoint)
+    , m_transformedRect(other.m_transformedRect)
+    , m_region(region)
+    , m_isRectBased(other.m_isRectBased)
+    , m_isRectilinear(other.m_isRectilinear)
+{
+    move(offset);
+}
+
 HitTestPoint::HitTestPoint(const HitTestPoint& other)
     : m_point(other.m_point)
     , m_boundingBox(other.m_boundingBox)
     , m_transformedPoint(other.m_transformedPoint)
     , m_transformedRect(other.m_transformedRect)
+    , m_region(other.m_region)
     , m_isRectBased(other.m_isRectBased)
     , m_isRectilinear(other.m_isRectilinear)
 {
@@ -114,6 +132,7 @@
     m_boundingBox = other.m_boundingBox;
     m_transformedPoint = other.m_transformedPoint;
     m_transformedRect = other.m_transformedRect;
+    m_region = other.m_region;
     m_isRectBased = other.m_isRectBased;
     m_isRectilinear = other.m_isRectilinear;
 
@@ -176,14 +195,12 @@
 HitTestResult::HitTestResult() : HitTestPoint()
     , m_isOverWidget(false)
     , m_shadowContentFilterPolicy(DoNotAllowShadowContent)
-    , m_region(0)
 {
 }
 
 HitTestResult::HitTestResult(const LayoutPoint& point) : HitTestPoint(point)
     , m_isOverWidget(false)
     , m_shadowContentFilterPolicy(DoNotAllowShadowContent)
-    , m_region(0)
 {
 }
 
@@ -191,7 +208,6 @@
     : HitTestPoint(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding)
     , m_isOverWidget(false)
     , m_shadowContentFilterPolicy(allowShadowContent)
-    , m_region(0)
 {
 }
 
@@ -199,7 +215,6 @@
     : HitTestPoint(other)
     , m_isOverWidget(false)
     , m_shadowContentFilterPolicy(allowShadowContent)
-    , m_region(0)
 {
 }
 
@@ -212,7 +227,6 @@
     , m_scrollbar(other.scrollbar())
     , m_isOverWidget(other.isOverWidget())
     , m_shadowContentFilterPolicy(other.shadowContentFilterPolicy())
-    , m_region(other.region())
 {
     // Only copy the NodeSet in case of rect hit test.
     m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(*other.m_rectBasedTestResult) : 0);
@@ -236,8 +250,6 @@
     m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(*other.m_rectBasedTestResult) : 0);
     m_shadowContentFilterPolicy  = other.shadowContentFilterPolicy();
 
-    m_region = other.m_region;
-
     return *this;
 }
 

Modified: trunk/Source/WebCore/rendering/HitTestResult.h (123753 => 123754)


--- trunk/Source/WebCore/rendering/HitTestResult.h	2012-07-26 16:12:32 UTC (rev 123753)
+++ trunk/Source/WebCore/rendering/HitTestResult.h	2012-07-26 16:15:27 UTC (rev 123754)
@@ -56,6 +56,8 @@
     HitTestPoint(const FloatPoint&, const FloatQuad&);
     // Pass non-zero padding values to perform a rect-based hit test.
     HitTestPoint(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
+    // Make a copy the HitTestPoint in a new region by applying given offset to internal point and area.
+    HitTestPoint(const HitTestPoint&, const LayoutSize& offset, RenderRegion*);
     HitTestPoint(const HitTestPoint&);
     ~HitTestPoint();
     HitTestPoint& operator=(const HitTestPoint&);
@@ -63,7 +65,7 @@
     LayoutPoint point() const { return m_point; }
     IntPoint roundedPoint() const { return roundedIntPoint(m_point); }
 
-    void move(const LayoutSize& offset);
+    RenderRegion* region() const { return m_region; }
 
     // Rect-based hit test related methods.
     bool isRectBasedTest() const { return m_isRectBased; }
@@ -85,6 +87,7 @@
 private:
     template<typename RectType>
     bool intersectsRect(const RectType&) const;
+    void move(const LayoutSize& offset);
 
     // This is cached forms of the more accurate point and area below.
     LayoutPoint m_point;
@@ -92,6 +95,9 @@
 
     FloatPoint m_transformedPoint;
     FloatQuad m_transformedRect;
+
+    RenderRegion* m_region; // The region we're inside.
+
     bool m_isRectBased;
     bool m_isRectilinear;
 };
@@ -116,9 +122,6 @@
     Scrollbar* scrollbar() const { return m_scrollbar.get(); }
     bool isOverWidget() const { return m_isOverWidget; }
 
-    RenderRegion* region() const { return m_region; }
-    void setRegion(RenderRegion* region) { m_region = region; }
-
     void setToNonShadowAncestor();
 
     const HitTestPoint& hitTestPoint() const { return *this; }
@@ -191,8 +194,6 @@
 
     ShadowContentFilterPolicy m_shadowContentFilterPolicy;
 
-    RenderRegion* m_region; // The region we're inside.
-
     mutable OwnPtr<NodeSet> m_rectBasedTestResult;
 };
 

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (123753 => 123754)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-07-26 16:12:32 UTC (rev 123753)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-07-26 16:15:27 UTC (rev 123754)
@@ -4672,7 +4672,7 @@
     // If we have clipping, then we can't have any spillout.
     bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer();
     bool useClip = (hasControlClip() || useOverflowClip);
-    bool checkChildren = !useClip || (hasControlClip() ? pointInContainer.intersects(controlClipRect(adjustedLocation)) : pointInContainer.intersects(overflowClipRect(adjustedLocation, result.region(), IncludeOverlayScrollbarSize)));
+    bool checkChildren = !useClip || (hasControlClip() ? pointInContainer.intersects(controlClipRect(adjustedLocation)) : pointInContainer.intersects(overflowClipRect(adjustedLocation, pointInContainer.region(), IncludeOverlayScrollbarSize)));
     if (checkChildren) {
         // Hit test descendants first.
         LayoutSize scrolledOffset(localOffset);

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (123753 => 123754)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-07-26 16:12:32 UTC (rev 123753)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-07-26 16:15:27 UTC (rev 123754)
@@ -757,7 +757,7 @@
 
     // Check our bounds next. For this purpose always assume that we can only be hit in the
     // foreground phase (which is true for replaced elements like images).
-    LayoutRect boundsRect = borderBoxRectInRegion(result.region());
+    LayoutRect boundsRect = borderBoxRectInRegion(pointInContainer.region());
     boundsRect.moveBy(adjustedLocation);
     if (visibleToHitTesting() && action == HitTestForeground && pointInContainer.intersects(boundsRect)) {
         updateHitTestResult(result, pointInContainer.point() - toLayoutSize(adjustedLocation));

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (123753 => 123754)


--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2012-07-26 16:12:32 UTC (rev 123753)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2012-07-26 16:15:27 UTC (rev 123754)
@@ -318,14 +318,10 @@
     // Always ignore clipping, since the RenderFlowThread has nothing to do with the bounds of the FrameView.
     HitTestRequest newRequest(request.type() | HitTestRequest::IgnoreClipping);
 
-    RenderRegion* oldRegion = result.region();
-    result.setRegion(region);
+    // Make a new temporary hitTestPoint in the new region.
+    HitTestPoint newHitTestPoint(pointInContainer, -renderFlowThreadOffset, region);
 
-    HitTestPoint newHitTestPoint(pointInContainer);
-    newHitTestPoint.move(-renderFlowThreadOffset);
-
     bool isPointInsideFlowThread = layer()->hitTest(newRequest, newHitTestPoint, result);
-    result.setRegion(oldRegion);
 
     // FIXME: Should we set result.m_localPoint back to the RenderRegion's coordinate space or leave it in the RenderFlowThread's coordinate
     // space? Right now it's staying in the RenderFlowThread's coordinate space, which may end up being ok. We will know more when we get around to

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (123753 => 123754)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-07-26 16:12:32 UTC (rev 123753)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-07-26 16:15:27 UTC (rev 123754)
@@ -3525,7 +3525,7 @@
     if (transform() && !appliedTransform) {
         // Make sure the parent's clip rects have been calculated.
         if (parent()) {
-            ClipRect clipRect = backgroundClipRect(rootLayer, result.region(), useTemporaryClipRects ? TemporaryClipRects : RootRelativeClipRects, IncludeOverlayScrollbarSize);
+            ClipRect clipRect = backgroundClipRect(rootLayer, hitTestPoint.region(), useTemporaryClipRects ? TemporaryClipRects : RootRelativeClipRects, IncludeOverlayScrollbarSize);
             // Go ahead and test the enclosing clip now.
             if (!clipRect.intersects(hitTestPoint))
                 return 0;
@@ -3592,7 +3592,7 @@
     ClipRect bgRect;
     ClipRect fgRect;
     ClipRect outlineRect;
-    calculateRects(rootLayer, result.region(), useTemporaryClipRects ? TemporaryClipRects : RootRelativeClipRects, hitTestRect, layerBounds, bgRect, fgRect, outlineRect, IncludeOverlayScrollbarSize);
+    calculateRects(rootLayer, hitTestPoint.region(), useTemporaryClipRects ? TemporaryClipRects : RootRelativeClipRects, hitTestRect, layerBounds, bgRect, fgRect, outlineRect, IncludeOverlayScrollbarSize);
     
     // The following are used for keeping track of the z-depth of the hit point of 3d-transformed
     // descendants.

Modified: trunk/Source/WebCore/rendering/RenderRegion.cpp (123753 => 123754)


--- trunk/Source/WebCore/rendering/RenderRegion.cpp	2012-07-26 16:12:32 UTC (rev 123753)
+++ trunk/Source/WebCore/rendering/RenderRegion.cpp	2012-07-26 16:15:27 UTC (rev 123754)
@@ -127,7 +127,7 @@
 
     // Check our bounds next. For this purpose always assume that we can only be hit in the
     // foreground phase (which is true for replaced elements like images).
-    LayoutRect boundsRect = borderBoxRectInRegion(result.region());
+    LayoutRect boundsRect = borderBoxRectInRegion(pointInContainer.region());
     boundsRect.moveBy(adjustedLocation);
     if (visibleToHitTesting() && action == HitTestForeground && pointInContainer.intersects(boundsRect)) {
         // Check the contents of the RenderFlowThread.

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (123753 => 123754)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2012-07-26 16:12:32 UTC (rev 123753)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2012-07-26 16:15:27 UTC (rev 123754)
@@ -1271,7 +1271,7 @@
     LayoutPoint adjustedLocation = accumulatedOffset + location();
 
     // Check kids first.
-    if (!hasOverflowClip() || pointInContainer.intersects(overflowClipRect(adjustedLocation, result.region()))) {
+    if (!hasOverflowClip() || pointInContainer.intersects(overflowClipRect(adjustedLocation, pointInContainer.region()))) {
         for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
             if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) {
                 LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), adjustedLocation);

Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (123753 => 123754)


--- trunk/Source/WebCore/rendering/RenderTableSection.cpp	2012-07-26 16:12:32 UTC (rev 123753)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp	2012-07-26 16:15:27 UTC (rev 123754)
@@ -1379,7 +1379,7 @@
     // Just forward to our children always.
     LayoutPoint adjustedLocation = accumulatedOffset + location();
 
-    if (hasOverflowClip() && !pointInContainer.intersects(overflowClipRect(adjustedLocation, result.region())))
+    if (hasOverflowClip() && !pointInContainer.intersects(overflowClipRect(adjustedLocation, pointInContainer.region())))
         return false;
 
     if (hasOverflowingCell()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to