Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: third_party/WebKit/LayoutTests/svg/hittest/text-small-font-size.html

Issue 1870983002: Only hit-test SVG <text> foreground (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test fixup Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/svg/hittest/text-small-font-size.html
diff --git a/third_party/WebKit/LayoutTests/svg/hittest/text-small-font-size.html b/third_party/WebKit/LayoutTests/svg/hittest/text-small-font-size.html
new file mode 100644
index 0000000000000000000000000000000000000000..7d33c7da2744bdc5f65daef499e409bc1bca8bc4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/svg/hittest/text-small-font-size.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<title>Hit-test of &lt;text> does not hit-test the "background" (w/ small font size)</title>
+<script src="../../resources/ahem.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style>
+body {
+ margin: 0;
+ padding: 0;
+}
+g text:hover {
+ fill: red;
+ cursor: crosshair;
+}
+</style>
+<svg font-family="Ahem" font-size="1.6" fill="blue" width="600" height="300">
+ <g transform="matrix(50,0,0,50,-400,-800)">
+ <text x="9.4" y="17.80">SELECT</text>
+ </g>
+</svg>
+<script>
+test(function() {
+ var textElement = document.querySelector('text');
+ // Should hit <text>.
+ [
+ { x: 71, y: 28 },
+ { x: 71, y: 105 },
+ { x: 540, y: 105 },
+ { x: 540, y: 28 },
+ ].forEach(function(point) {
+ assert_equals(document.elementFromPoint(point.x, point.y), textElement, point.x + ',' + point.y);
+ });
+
+ var svgRoot = document.querySelector('svg');
+ // Should not hit <text>.
+ [
+ { x: 69, y: 26 },
+ { x: 69, y: 105 },
+ { x: 69, y: 107 },
+ { x: 300, y: 26 },
+ { x: 300, y: 107 },
+ { x: 550, y: 26 },
+ { x: 550, y: 105 },
+ { x: 550, y: 107 },
+ ].forEach(function(point) {
+ assert_equals(document.elementFromPoint(point.x, point.y), svgRoot, point.x + ',' + point.y);
+ });
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698