WebCore:
authoradele@apple.com <adele@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Dec 2007 01:08:54 +0000 (01:08 +0000)
committeradele@apple.com <adele@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Dec 2007 01:08:54 +0000 (01:08 +0000)
        Reviewed by Darin.

        Fix for <rdar://problem/5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges

        * rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::setStyle):
        Adjust outline-offset so it doesn't extend beyond the border to interfere with typing

LayoutTests:

        Reviewed by Darin.

        Test for <rdar://problem/5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges

        * fast/forms/textfield-outline.html: Added.
        * platform/mac/fast/forms/textfield-outline-expected.checksum: Added.
        * platform/mac/fast/forms/textfield-outline-expected.png: Added.
        * platform/mac/fast/forms/textfield-outline-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/textfield-outline.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/textfield-outline-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/textfield-outline-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/textfield-outline-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderTextControl.cpp

index 893b4762980c0950018d09f4b159ca8e058018b7..4cdb041ccc946b76528557945303e6d911f885b3 100644 (file)
@@ -1,3 +1,14 @@
+2007-12-04  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Darin.
+
+        Test for <rdar://problem/5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges
+
+        * fast/forms/textfield-outline.html: Added.
+        * platform/mac/fast/forms/textfield-outline-expected.checksum: Added.
+        * platform/mac/fast/forms/textfield-outline-expected.png: Added.
+        * platform/mac/fast/forms/textfield-outline-expected.txt: Added.
+
 2007-12-04  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Adam Roben.
diff --git a/LayoutTests/fast/forms/textfield-outline.html b/LayoutTests/fast/forms/textfield-outline.html
new file mode 100644 (file)
index 0000000..935467d
--- /dev/null
@@ -0,0 +1,20 @@
+<html>
+    <head>
+        <script>
+        function test()
+        {
+            var tf = document.getElementById('tf');
+            tf.focus();
+            if (window.layoutTestController) {
+                eventSender.keyDown("a");
+                eventSender.keyDown("b");
+                eventSender.keyDown("c");
+            }
+        }
+        </script>
+    </head>
+    <body onload="test()">
+        This tests that a negative outline-offset won't get in the way of a cursor in a text control.<br>
+        <input id="tf" style="font-size: 20px; border: solid thin black;" value="This tests that typing doesn't cut holes in the focus outline"></input>
+    </body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.checksum b/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.checksum
new file mode 100644 (file)
index 0000000..817d1d7
--- /dev/null
@@ -0,0 +1 @@
+a4130e3ca141dfe0181212ace7c1f1bf
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.png b/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.png
new file mode 100644 (file)
index 0000000..6380006
Binary files /dev/null and b/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.txt b/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.txt
new file mode 100644 (file)
index 0000000..f5e9d28
--- /dev/null
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderText {#text} at (0,0) size 550x18
+        text run at (0,0) width 550: "This tests that a negative outline-offset won't get in the way of a cursor in a text control."
+      RenderBR {BR} at (550,14) size 0x0
+      RenderTextControl {INPUT} at (2,20) size 259x27 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+layer at (12,30) size 255x23
+  RenderBlock {DIV} at (2,2) size 255x23
+    RenderText {#text} at (1,0) size 34x23
+      text run at (1,0) width 34: "abc"
+caret: position 3 of child 0 {#text} of child 0 {DIV} of child 3 {INPUT} of child 1 {BODY} of child 0 {HTML} of document
index 498a0ffae934570698a066784265dd86d73d5ad0..59996ffa1704a7aa3846e3ddc44f3d82bac9affd 100644 (file)
@@ -1,3 +1,12 @@
+2007-12-04  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Darin.
+
+        Fix for <rdar://problem/5499918> REGRESSION: insertion point in input field with custom border cuts holes in focus ring interior edges
+
+        * rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::setStyle):
+        Adjust outline-offset so it doesn't extend beyond the border to interfere with typing
+
 2007-12-04  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Jon.
index 58358182c8ca9bd371a4eda309927f3c02570c6b..8ae739de3e34fe87730949972cae95de94218b47 100644 (file)
@@ -129,6 +129,11 @@ void RenderTextControl::setStyle(RenderStyle* style)
     if (m_cancelButton)
         m_cancelButton->renderer()->setStyle(createCancelButtonStyle(style));
 
+    // Adjust outline-offset so it doesn't extend beyond the border to interfere with typing
+    int maxBorderWidth = max(style->borderLeftWidth(), max(style->borderRightWidth(), max(style->borderTopWidth(), style->borderBottomWidth())));
+    if (style->outlineOffset() < -maxBorderWidth)
+        style->setOutlineOffset(-maxBorderWidth);
+
     setHasOverflowClip(false);
     setReplaced(isInline());
 }