2009-03-02 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Mar 2009 06:15:51 +0000 (06:15 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Mar 2009 06:15:51 +0000 (06:15 +0000)
        Reviewed by Adele Peterson

        https://bugs.webkit.org/show_bug.cgi?id=24313

        If RenderTextControlSingleLine::nodeAtPoint() pokes a node into the
        HitTestResult, then it had better well return |true|. And m_innerBlock
        could never have been set as the hit node by the superclass, because
        the superclass knows nothing about m_innerBlock.

        Test: fast/forms/input-hit-test-border.html

        * rendering/RenderTextControlSingleLine.cpp:
        (WebCore::RenderTextControlSingleLine::nodeAtPoint):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41379 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/forms/input-hit-test-border-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/input-hit-test-border.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderTextControlSingleLine.cpp

index 41a044f..14360d6 100644 (file)
@@ -1,3 +1,15 @@
+2009-03-02  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Adele Peterson
+        
+        https://bugs.webkit.org/show_bug.cgi?id=24313
+        
+        Test hit testing on the border and padding of inputs, after
+        touching code that referenced <rdar://problem/4617841>.
+
+        * fast/forms/input-hit-test-border-expected.txt: Added.
+        * fast/forms/input-hit-test-border.html: Added.
+
 2009-03-01  David Levin  <levin@chromium.org>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/LayoutTests/fast/forms/input-hit-test-border-expected.txt b/LayoutTests/fast/forms/input-hit-test-border-expected.txt
new file mode 100644 (file)
index 0000000..8c5f90b
--- /dev/null
@@ -0,0 +1 @@
+This tests hit testing on the border and padding areas of an input. Clicks in either should hit the input element. Test Passed
diff --git a/LayoutTests/fast/forms/input-hit-test-border.html b/LayoutTests/fast/forms/input-hit-test-border.html
new file mode 100644 (file)
index 0000000..ce35426
--- /dev/null
@@ -0,0 +1,29 @@
+<html>
+<head>
+<script>
+function runTest() {
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+        
+    var result = document.getElementById('res');
+    var input = document.getElementById('tf');
+    
+    var borderElement = document.elementFromPoint(18, 34);  // in border
+    var paddingElement = document.elementFromPoint(25, 41);  // in padding
+
+    if (borderElement == input && paddingElement == input)
+        result.innerHTML = "Test Passed";
+}
+
+window.addEventListener('click', function(e) {
+  window.console.log('page x ' + e.pageX + ' page y ' + e.pageY);
+}, false);
+</script>
+</head>
+<body onload="runTest()">
+This tests hit testing on the border and padding areas of an input. Clicks in either should hit
+the input element.
+<input id="tf" style="position: absolute; top: 25px; left: 10px; border: 10px inset gray; padding: 10px;">
+<div id="res" style="position: absolute; top: 100px; left: 10px;">Test Failed</div>
+</body>
+</html>
\ No newline at end of file
index 9c0e3c7..3a264c0 100644 (file)
@@ -1,3 +1,19 @@
+2009-03-02  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Adele Peterson
+
+        https://bugs.webkit.org/show_bug.cgi?id=24313
+        
+        If RenderTextControlSingleLine::nodeAtPoint() pokes a node into the
+        HitTestResult, then it had better well return |true|. And m_innerBlock
+        could never have been set as the hit node by the superclass, because
+        the superclass knows nothing about m_innerBlock.
+        
+        Test: fast/forms/input-hit-test-border.html
+
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::nodeAtPoint):
+
 2009-03-02  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Mark Rowe.
index d45859b..ca885f8 100644 (file)
@@ -270,7 +270,7 @@ bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, Hit
     if (!RenderTextControl::nodeAtPoint(request, result, xPos, yPos, tx, ty, hitTestAction))
         return false;
 
-    if (result.innerNode() != node() && result.innerNode() != m_innerBlock.get())
+    if (result.innerNode() != node() && result.innerNode() != innerTextElement())
         return false;
 
     hitInnerTextBlock(result, xPos, yPos, tx, ty);