Title: [89381] trunk
Revision
89381
Author
rwlb...@webkit.org
Date
2011-06-21 14:13:28 -0700 (Tue, 21 Jun 2011)

Log Message

2011-06-21  Rob Buis  <rb...@rim.com>

        Reviewed by Dirk Schulze.

        All pointer-events fail if text has visibility="hidden"
        https://bugs.webkit.org/show_bug.cgi?id=62209

        Update test results (improvement).

        * platform/mac/svg/custom/pointer-events-text-expected.png:
        * platform/mac/svg/custom/pointer-events-text-expected.txt:
2011-06-21  Rob Buis  <rb...@rim.com>

        Reviewed by Dirk Schulze.

        All pointer-events fail if text has visibility="hidden"
        https://bugs.webkit.org/show_bug.cgi?id=62209

        Use PointerEventsHitRules to make hit-testing for SVG text inline boxes work.

        No new tests; covered by existing test pointer-events-text.svg.

        * rendering/svg/SVGInlineTextBox.cpp:
        (WebCore::SVGInlineTextBox::nodeAtPoint):
        * rendering/svg/SVGInlineTextBox.h:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (89380 => 89381)


--- trunk/LayoutTests/ChangeLog	2011-06-21 21:09:58 UTC (rev 89380)
+++ trunk/LayoutTests/ChangeLog	2011-06-21 21:13:28 UTC (rev 89381)
@@ -1,3 +1,15 @@
+2011-06-21  Rob Buis  <rb...@rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        All pointer-events fail if text has visibility="hidden"
+        https://bugs.webkit.org/show_bug.cgi?id=62209
+
+        Update test results (improvement).
+
+        * platform/mac/svg/custom/pointer-events-text-expected.png:
+        * platform/mac/svg/custom/pointer-events-text-expected.txt:
+
 2011-06-21  Mark Pilgrim  <pilg...@chromium.org>
 
         Reviewed by Adam Barth.

Modified: trunk/LayoutTests/platform/mac/svg/custom/pointer-events-text-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/svg/custom/pointer-events-text-expected.txt (89380 => 89381)


--- trunk/LayoutTests/platform/mac/svg/custom/pointer-events-text-expected.txt	2011-06-21 21:09:58 UTC (rev 89380)
+++ trunk/LayoutTests/platform/mac/svg/custom/pointer-events-text-expected.txt	2011-06-21 21:13:28 UTC (rev 89381)
@@ -300,21 +300,21 @@
       RenderSVGText {text} at (385,309) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (385.00,345.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (390,321) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (390.00,335.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (390,321) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (390.00,335.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (442,309) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (442.00,345.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (447,321) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (447.00,335.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (447,321) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (447.00,335.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (499,309) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (499.00,345.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (504,321) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (504.00,335.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (504,321) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (504.00,335.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (0,388) size 17x18 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 17x18
           chunk 1 text run 1 at (0.00,402.00) startOffset 0 endOffset 4 width 17.00: "fill"
@@ -345,27 +345,27 @@
       RenderSVGText {text} at (328,366) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (328.00,402.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (333,378) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (333.00,392.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (333,378) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (333.00,392.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (385,366) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (385.00,402.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (390,378) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (390.00,392.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (390,378) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (390.00,392.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (442,366) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (442.00,402.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (447,378) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (447.00,392.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (447,378) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (447.00,392.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (499,366) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (499.00,402.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (504,378) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (504.00,392.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (504,378) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (504.00,392.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (0,445) size 38x18 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 38x18
           chunk 1 text run 1 at (0.00,459.00) startOffset 0 endOffset 6 width 38.00: "stroke"
@@ -396,27 +396,27 @@
       RenderSVGText {text} at (328,423) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (328.00,459.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (333,435) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (333.00,449.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (333,435) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (333.00,449.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (385,423) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (385.00,459.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (390,435) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (390.00,449.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (390,435) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (390.00,449.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (442,423) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (442.00,459.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (447,435) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (447.00,449.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (447,435) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (447.00,449.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (499,423) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (499.00,459.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (504,435) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (504.00,449.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (504,435) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (504.00,449.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (0,502) size 15x18 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 15x18
           chunk 1 text run 1 at (0.00,516.00) startOffset 0 endOffset 3 width 15.00: "all"
@@ -447,27 +447,27 @@
       RenderSVGText {text} at (328,480) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (328.00,516.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (333,492) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (333.00,506.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (333,492) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (333.00,506.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (385,480) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (385.00,516.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (390,492) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (390.00,506.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (390,492) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (390.00,506.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (442,480) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (442.00,516.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (447,492) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (447.00,506.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (447,492) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (447.00,506.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (499,480) size 20x46 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 20x46
           chunk 1 text run 1 at (499.00,516.00) startOffset 0 endOffset 1 width 20.00: "#"
-      RenderSVGText {text} at (504,492) size 28x18 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 28x18
-          chunk 1 text run 1 at (504.00,506.00) startOffset 0 endOffset 4 width 28.00: "miss"
+      RenderSVGText {text} at (504,492) size 27x18 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 27x18
+          chunk 1 text run 1 at (504.00,506.00) startOffset 0 endOffset 3 width 27.00: "HIT"
       RenderSVGText {text} at (0,559) size 31x18 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 31x18
           chunk 1 text run 1 at (0.00,573.00) startOffset 0 endOffset 4 width 31.00: "none"

Modified: trunk/Source/WebCore/ChangeLog (89380 => 89381)


--- trunk/Source/WebCore/ChangeLog	2011-06-21 21:09:58 UTC (rev 89380)
+++ trunk/Source/WebCore/ChangeLog	2011-06-21 21:13:28 UTC (rev 89381)
@@ -1,3 +1,18 @@
+2011-06-21  Rob Buis  <rb...@rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        All pointer-events fail if text has visibility="hidden"
+        https://bugs.webkit.org/show_bug.cgi?id=62209
+
+        Use PointerEventsHitRules to make hit-testing for SVG text inline boxes work.
+
+        No new tests; covered by existing test pointer-events-text.svg.
+
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::nodeAtPoint):
+        * rendering/svg/SVGInlineTextBox.h:
+
 2011-06-21  Mark Pilgrim  <pilg...@chromium.org>
 
         Reviewed by Adam Barth.

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (89380 => 89381)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2011-06-21 21:09:58 UTC (rev 89380)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2011-06-21 21:13:28 UTC (rev 89381)
@@ -26,7 +26,9 @@
 #include "FloatConversion.h"
 #include "FontCache.h"
 #include "GraphicsContext.h"
+#include "HitTestResult.h"
 #include "InlineFlowBox.h"
+#include "PointerEventsHitRules.h"
 #include "RenderBlock.h"
 #include "RenderSVGInlineText.h"
 #include "RenderSVGResource.h"
@@ -724,6 +726,29 @@
     return enclosingIntRect(textRect);
 }
 
+bool SVGInlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, int, int)
+{
+    // FIXME: integrate with InlineTextBox::nodeAtPoint better.
+    ASSERT(!isLineBreak());
+
+    PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, request, renderer()->style()->pointerEvents());
+    bool isVisible = renderer()->style()->visibility() == VISIBLE;
+    if (isVisible || !hitRules.requireVisible) {
+        if ((hitRules.canHitStroke && (renderer()->style()->svgStyle()->hasStroke() || !hitRules.requireStroke))
+            || (hitRules.canHitFill && (renderer()->style()->svgStyle()->hasFill() || !hitRules.requireFill))) {
+            FloatPoint boxOrigin = locationIncludingFlipping();
+            boxOrigin.moveBy(accumulatedOffset);
+            FloatRect rect(boxOrigin, IntSize(width(), height()));
+            if (rect.intersects(result.rectForPoint(pointInContainer))) {
+                renderer()->updateHitTestResult(result, pointInContainer - toSize(accumulatedOffset));
+                if (!result.addNodeToRectBasedTestResult(renderer()->node(), pointInContainer, rect))
+                    return true;
+             }
+        }
+    }
+    return false;
+}
+
 } // namespace WebCore
 
 #endif

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h (89380 => 89381)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h	2011-06-21 21:09:58 UTC (rev 89380)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h	2011-06-21 21:13:28 UTC (rev 89381)
@@ -77,6 +77,8 @@
     void paintTextWithShadows(GraphicsContext*, RenderStyle*, TextRun&, const SVGTextFragment&, int startPosition, int endPosition);
     void paintText(GraphicsContext*, RenderStyle*, RenderStyle* selectionStyle, const SVGTextFragment&, bool hasSelection, bool paintSelectedTextOnly);
 
+    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, int lineTop, int lineBottom);
+
 private:
     int m_logicalHeight;
     int m_paintingResourceMode;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to