Title: [104332] trunk
Revision
104332
Author
jon...@apple.com
Date
2012-01-06 13:55:12 -0800 (Fri, 06 Jan 2012)

Log Message

Clicking on the cancel button on readonly and disabled search fields darkens as if the search field was editable
https://bugs.webkit.org/show_bug.cgi?id=69886
<rdar://problem/10070187>

Reviewed by Adele Peterson.

.:

* ManualTests/search-cancel-button.html: Added.

Source/WebCore:

Tests: ManualTests/search-cancel-button.html

* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintSearchFieldCancelButton): If the input is readonly and/or disabled, force the cell to
render without highlight.

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (104331 => 104332)


--- trunk/ChangeLog	2012-01-06 21:44:50 UTC (rev 104331)
+++ trunk/ChangeLog	2012-01-06 21:55:12 UTC (rev 104332)
@@ -1,3 +1,13 @@
+2012-01-04  Jon Lee  <jon...@apple.com>
+
+        Clicking on the cancel button on readonly and disabled search fields darkens as if the search field was editable
+        https://bugs.webkit.org/show_bug.cgi?id=69886
+        <rdar://problem/10070187>
+
+        Reviewed by Adele Peterson.
+
+        * ManualTests/search-cancel-button.html: Added.
+
 2012-01-06  Simon Hausmann  <simon.hausm...@nokia.com>
 
         [Qt] Fix compilation of app code against QtWebKit master header file

Added: trunk/ManualTests/search-cancel-button.html (0 => 104332)


--- trunk/ManualTests/search-cancel-button.html	                        (rev 0)
+++ trunk/ManualTests/search-cancel-button.html	2012-01-06 21:55:12 UTC (rev 104332)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<body>
+    <p>https://bugs.webkit.org/show_bug.cgi?id=69886 - Clicking on the cancel button on readonly and disabled search fields darkens as if the search field was editable</p>
+    <p>Clicking on the disabled/readonly search inputs should not render the cancel button dark when you click on them.</p>
+    <p>Normal search:<br/><input type=search value="This is a string of long text." /></p>
+    <p>Disabled search:<br/><input type=search value="This is a string of long text." disabled /></p>
+    <p>Readonly search:<br/><input type=search value="This is a string of long text." readonly /></p>
+    <p>Disabled and readonly search:<br/><input type=search value="This is a string of long text." disabled readonly /></p>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (104331 => 104332)


--- trunk/Source/WebCore/ChangeLog	2012-01-06 21:44:50 UTC (rev 104331)
+++ trunk/Source/WebCore/ChangeLog	2012-01-06 21:55:12 UTC (rev 104332)
@@ -1,3 +1,17 @@
+2012-01-04  Jon Lee  <jon...@apple.com>
+
+        Clicking on the cancel button on readonly and disabled search fields darkens as if the search field was editable
+        https://bugs.webkit.org/show_bug.cgi?id=69886
+        <rdar://problem/10070187>
+
+        Reviewed by Adele Peterson.
+
+        Tests: ManualTests/search-cancel-button.html
+
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::paintSearchFieldCancelButton): If the input is readonly and/or disabled, force the cell to
+        render without highlight.
+
 2012-01-06  Simon Fraser  <simon.fra...@apple.com>
 
         Mitigate scrollbar differences when running pixel tests

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (104331 => 104332)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2012-01-06 21:44:50 UTC (rev 104331)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2012-01-06 21:55:12 UTC (rev 104332)
@@ -1511,7 +1511,9 @@
 
 bool RenderThemeMac::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
 {
-    Node* input = o->node()->shadowAncestorNode();
+    Element* input = toElement(o->node()->shadowAncestorNode());
+    ASSERT(input);
+
     if (!input->renderer()->isBox())
         return false;
 
@@ -1520,8 +1522,12 @@
 
     NSSearchFieldCell* search = this->search();
 
-    updateActiveState([search cancelButtonCell], o);
-    updatePressedState([search cancelButtonCell], o);
+    if (input->isEnabledFormControl() && !input->isReadOnlyFormControl()) {
+        updateActiveState([search cancelButtonCell], o);
+        updatePressedState([search cancelButtonCell], o);
+    }
+    else if ([[search cancelButtonCell] isHighlighted])
+        [[search cancelButtonCell] setHighlighted:NO];
 
     GraphicsContextStateSaver stateSaver(*paintInfo.context);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to