REGRESSION(r147602): Search text field doesn't render selection when it has some...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jun 2013 21:25:07 +0000 (21:25 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jun 2013 21:25:07 +0000 (21:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=117747

Reviewed by Kent Tamura.

.:

* ManualTests/search-select-all-with-focus-style.html: Added.

Source/WebCore:

Merge https://chromium.googlesource.com/chromium/blink/+/7ff656c8239ce3b125246abcc8b149a603fcff28

r147612 added setNeedsLayout(true, MarkOnlyThis) for
TextControlInnerTextElement renderer. It's ok for input[type=text]
because RenderTextControlSingleLine also has needsLayout flag, and it
has only the inner text renderer as a child.

As for input[type=search], it doesn't work. Renderer structure for
input[type=search] is:

RenderTextControlSingleLine
└Renderer for TextControlInnerContainer
  └Renderer for TextControlInnerElement
    └Renderer for TextControlInnerTextElement

After r147612, there is a case that only RenderTextControlSingleLine
and TextControlInnerTextElement renderer have needsLayout flag, and
others don't.  It won't trigger layout for
TextControlInnerTextElement renderer.

We should set needsLayout flags of TextControlInnerContainer renderer
and TextControlInnerElement renderer by MarkContainingBlockChain.

Manual Tests: search-select-all-with-focus-style.html
(I tried but couldn't make a test that works in DRT)

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

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

ChangeLog
ManualTests/search-select-all-with-focus-style.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderTextControlSingleLine.cpp

index eb09ba1ab73e4513a75ca4a926d0a1d515210774..fbf87a2ddfeaecba176c164404bad7f3e5e29996 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-06-18  Ryosuke Niwa  <rniwa@webkit.org>
+
+        REGRESSION(r147602): Search text field doesn't render selection when it has some :focus rules
+        https://bugs.webkit.org/show_bug.cgi?id=117747
+
+        Reviewed by Kent Tamura.
+
+        * ManualTests/search-select-all-with-focus-style.html: Added.
+
 2013-06-18  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Update NEWS and Versions.m4 for 2.1.2 release.
 2013-06-18  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Update NEWS and Versions.m4 for 2.1.2 release.
diff --git a/ManualTests/search-select-all-with-focus-style.html b/ManualTests/search-select-all-with-focus-style.html
new file mode 100644 (file)
index 0000000..02b5394
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<body>
+<style>
+input[type="search"]:focus {
+    border:1px solid #4d90fe;
+}
+
+input[type="search"] {
+    -webkit-appearance: textfield;
+}
+</style>
+<p>To test, focus the search text field below and select-all the content by pressing command/control and a.</p>
+<input value="foo bar " type="search">
+</body>
+</html>
index 3785a793f91621c86014a77af60fd3d50e85d8ea..3fd54263cd86c3e03d3fb2bd4bc7b43ec1e5a835 100644 (file)
@@ -1,3 +1,39 @@
+2013-06-18  Ryosuke Niwa  <rniwa@webkit.org>
+
+        REGRESSION(r147602): Search text field doesn't render selection when it has some :focus rules
+        https://bugs.webkit.org/show_bug.cgi?id=117747
+
+        Reviewed by Kent Tamura.
+
+        Merge https://chromium.googlesource.com/chromium/blink/+/7ff656c8239ce3b125246abcc8b149a603fcff28
+
+        r147612 added setNeedsLayout(true, MarkOnlyThis) for
+        TextControlInnerTextElement renderer. It's ok for input[type=text]
+        because RenderTextControlSingleLine also has needsLayout flag, and it
+        has only the inner text renderer as a child.
+
+        As for input[type=search], it doesn't work. Renderer structure for
+        input[type=search] is:
+
+        RenderTextControlSingleLine
+        └Renderer for TextControlInnerContainer
+          └Renderer for TextControlInnerElement
+            └Renderer for TextControlInnerTextElement
+
+        After r147612, there is a case that only RenderTextControlSingleLine
+        and TextControlInnerTextElement renderer have needsLayout flag, and
+        others don't.  It won't trigger layout for
+        TextControlInnerTextElement renderer.
+
+        We should set needsLayout flags of TextControlInnerContainer renderer
+        and TextControlInnerElement renderer by MarkContainingBlockChain.
+
+        Manual Tests: search-select-all-with-focus-style.html
+        (I tried but couldn't make a test that works in DRT)
+
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::styleDidChange):
+
 2013-06-18  Dean Jackson  <dino@apple.com>
 
         Attempted build fix for non-Mac.
 2013-06-18  Dean Jackson  <dino@apple.com>
 
         Attempted build fix for non-Mac.
index 0aa0476590b67c4aba57f961f1fb13f824e4bcf1..8ba8ea13b4814cbb429ed706ee5968655952822a 100644 (file)
@@ -255,7 +255,7 @@ void RenderTextControlSingleLine::styleDidChange(StyleDifference diff, const Ren
     }
     RenderObject* innerTextRenderer = innerTextElement()->renderer();
     if (innerTextRenderer && diff == StyleDifferenceLayout)
     }
     RenderObject* innerTextRenderer = innerTextElement()->renderer();
     if (innerTextRenderer && diff == StyleDifferenceLayout)
-        innerTextRenderer->setNeedsLayout(true, MarkOnlyThis);
+        innerTextRenderer->setNeedsLayout(true, MarkContainingBlockChain);
     if (HTMLElement* placeholder = inputElement()->placeholderElement())
         placeholder->setInlineStyleProperty(CSSPropertyTextOverflow, textShouldBeTruncated() ? CSSValueEllipsis : CSSValueClip);
     setHasOverflowClip(false);
     if (HTMLElement* placeholder = inputElement()->placeholderElement())
         placeholder->setInlineStyleProperty(CSSPropertyTextOverflow, textShouldBeTruncated() ? CSSValueEllipsis : CSSValueClip);
     setHasOverflowClip(false);