- Revision
- 114926
- Author
- e...@chromium.org
- Date
- 2012-04-23 11:59:59 -0700 (Mon, 23 Apr 2012)
Log Message
Clean up subpixel unit handling in hit testing code
https://bugs.webkit.org/show_bug.cgi?id=84496
Reviewed by Eric Seidel.
Fix use of IntRect and LayoutRect in hit testing code in preparation for
subpixel layout.
No new tests, no change in functionality.
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::rectForPoint):
Revert rectForPoint to IntRect as all call sites converted it to an
IntRect anyway to compare it with an IntPoint or another IntRect.
* rendering/HitTestingTransformState.cpp:
(WebCore::HitTestingTransformState::boundsOfMappedQuad):
* rendering/HitTestingTransformState.h:
Convert boundsOfMappedQuad to LayoutRect as the TransformationMatrix now
has subpixel precision.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (114925 => 114926)
--- trunk/Source/WebCore/ChangeLog 2012-04-23 18:47:43 UTC (rev 114925)
+++ trunk/Source/WebCore/ChangeLog 2012-04-23 18:59:59 UTC (rev 114926)
@@ -1,3 +1,26 @@
+2012-04-23 Emil A Eklund <e...@chromium.org>
+
+ Clean up subpixel unit handling in hit testing code
+ https://bugs.webkit.org/show_bug.cgi?id=84496
+
+ Reviewed by Eric Seidel.
+
+ Fix use of IntRect and LayoutRect in hit testing code in preparation for
+ subpixel layout.
+
+ No new tests, no change in functionality.
+
+ * rendering/HitTestResult.cpp:
+ (WebCore::HitTestResult::rectForPoint):
+ Revert rectForPoint to IntRect as all call sites converted it to an
+ IntRect anyway to compare it with an IntPoint or another IntRect.
+
+ * rendering/HitTestingTransformState.cpp:
+ (WebCore::HitTestingTransformState::boundsOfMappedQuad):
+ * rendering/HitTestingTransformState.h:
+ Convert boundsOfMappedQuad to LayoutRect as the TransformationMatrix now
+ has subpixel precision.
+
2012-04-23 Kentaro Hara <hara...@chromium.org>
[V8] Pass Isolate to toV8() (Part3)
Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (114925 => 114926)
--- trunk/Source/WebCore/rendering/HitTestResult.cpp 2012-04-23 18:47:43 UTC (rev 114925)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp 2012-04-23 18:59:59 UTC (rev 114926)
@@ -652,16 +652,16 @@
}
}
-LayoutRect HitTestResult::rectForPoint(const LayoutPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
+IntRect HitTestResult::rectForPoint(const LayoutPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
{
- LayoutPoint actualPoint(point);
- actualPoint -= LayoutSize(leftPadding, topPadding);
+ IntPoint actualPoint(roundedIntPoint(point));
+ actualPoint -= IntSize(leftPadding, topPadding);
IntSize actualPadding(leftPadding + rightPadding, topPadding + bottomPadding);
// As IntRect is left inclusive and right exclusive (seeing IntRect::contains(x, y)), adding "1".
actualPadding += IntSize(1, 1);
- return LayoutRect(actualPoint, actualPadding);
+ return IntRect(actualPoint, actualPadding);
}
const HitTestResult::NodeSet& HitTestResult::rectBasedTestResult() const
Modified: trunk/Source/WebCore/rendering/HitTestResult.h (114925 => 114926)
--- trunk/Source/WebCore/rendering/HitTestResult.h 2012-04-23 18:47:43 UTC (rev 114925)
+++ trunk/Source/WebCore/rendering/HitTestResult.h 2012-04-23 18:59:59 UTC (rev 114926)
@@ -112,8 +112,8 @@
// Rect-based hit test related methods.
bool isRectBasedTest() const { return m_isRectBased; }
- LayoutRect rectForPoint(const LayoutPoint&) const;
- static LayoutRect rectForPoint(const LayoutPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
+ IntRect rectForPoint(const LayoutPoint&) const;
+ static IntRect rectForPoint(const LayoutPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
int topPadding() const { return m_topPadding; }
int rightPadding() const { return m_rightPadding; }
int bottomPadding() const { return m_bottomPadding; }
@@ -162,7 +162,7 @@
// y = p.y() - topPadding
// width = leftPadding + rightPadding + 1
// height = topPadding + bottomPadding + 1
-inline LayoutRect HitTestResult::rectForPoint(const LayoutPoint& point) const
+inline IntRect HitTestResult::rectForPoint(const LayoutPoint& point) const
{
return rectForPoint(point, m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding);
}
Modified: trunk/Source/WebCore/rendering/HitTestingTransformState.cpp (114925 => 114926)
--- trunk/Source/WebCore/rendering/HitTestingTransformState.cpp 2012-04-23 18:47:43 UTC (rev 114925)
+++ trunk/Source/WebCore/rendering/HitTestingTransformState.cpp 2012-04-23 18:59:59 UTC (rev 114926)
@@ -73,7 +73,7 @@
return m_accumulatedTransform.inverse().projectQuad(m_lastPlanarQuad);
}
-IntRect HitTestingTransformState::boundsOfMappedQuad() const
+LayoutRect HitTestingTransformState::boundsOfMappedQuad() const
{
return m_accumulatedTransform.inverse().clampedBoundsOfProjectedQuad(m_lastPlanarQuad);
}
Modified: trunk/Source/WebCore/rendering/HitTestingTransformState.h (114925 => 114926)
--- trunk/Source/WebCore/rendering/HitTestingTransformState.h 2012-04-23 18:47:43 UTC (rev 114925)
+++ trunk/Source/WebCore/rendering/HitTestingTransformState.h 2012-04-23 18:59:59 UTC (rev 114926)
@@ -58,7 +58,7 @@
FloatPoint mappedPoint() const;
FloatQuad mappedQuad() const;
- IntRect boundsOfMappedQuad() const;
+ LayoutRect boundsOfMappedQuad() const;
void flatten();
FloatPoint m_lastPlanarPoint;