Modified: trunk/LayoutTests/ChangeLog (111945 => 111946)
--- trunk/LayoutTests/ChangeLog 2012-03-24 00:53:34 UTC (rev 111945)
+++ trunk/LayoutTests/ChangeLog 2012-03-24 00:54:04 UTC (rev 111946)
@@ -1,3 +1,16 @@
+2012-03-23 Parag Radke <[email protected]>
+
+ REGRESSION: can select text of an input button
+ https://bugs.webkit.org/show_bug.cgi?id=13624
+
+ Reviewed by Ryosuke Niwa.
+
+ Added a pixel test case to test the selection background for button label text.
+
+ * editing/selection/selection-button-text.html: Added.
+ * platform/gtk/editing/selection/selection-button-text-expected.png: Added.
+ * platform/gtk/editing/selection/selection-button-text-expected.txt: Added.
+
2012-03-23 Dan Bernstein <[email protected]>
Added Mac WebKit2 expected results for this test. The fact that it is failing is tracked by
Added: trunk/LayoutTests/editing/selection/selection-button-text.html (0 => 111946)
--- trunk/LayoutTests/editing/selection/selection-button-text.html (rev 0)
+++ trunk/LayoutTests/editing/selection/selection-button-text.html 2012-03-24 00:54:04 UTC (rev 111946)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<p>To PASS this test case the text of the button label should not be selected in the selection.</p>
+<div>
+Buttons<br>
+with text <input type="button" value="too little"> too little
+<div>
+and text <input type="button" value="too much"> too much
+</div>
+Should not be selected in the selection.
+</div>
+</body>
+<script>
+document.execCommand("SelectAll");
+</script>
+</html>
Added: trunk/LayoutTests/platform/gtk/editing/selection/selection-button-text-expected.txt (0 => 111946)
--- trunk/LayoutTests/platform/gtk/editing/selection/selection-button-text-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/editing/selection/selection-button-text-expected.txt 2012-03-24 00:54:04 UTC (rev 111946)
@@ -0,0 +1,35 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x156
+ RenderBlock {HTML} at (0,0) size 800x156
+ RenderBody {BODY} at (8,16) size 784x132
+ RenderBlock {P} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 568x17
+ text run at (0,0) width 568: "To PASS this test case the text of the button label should not be selected in the selection."
+ RenderBlock {DIV} at (0,34) size 784x98
+ RenderBlock (anonymous) at (0,0) size 784x49
+ RenderText {#text} at (0,0) size 50x17
+ text run at (0,0) width 50: "Buttons"
+ RenderBR {BR} at (49,0) size 1x17
+ RenderText {#text} at (0,24) size 61x17
+ text run at (0,24) width 61: "with text "
+ RenderButton {INPUT} at (62,20) size 72x27 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+ RenderBlock (anonymous) at (8,4) size 56x18
+ RenderText at (0,0) size 56x17
+ text run at (0,0) width 56: "too little"
+ RenderText {#text} at (136,24) size 59x17
+ text run at (136,24) width 59: " too little"
+ RenderBlock {DIV} at (0,49) size 784x31
+ RenderText {#text} at (0,6) size 56x17
+ text run at (0,6) width 56: "and text "
+ RenderButton {INPUT} at (57,2) size 82x27 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+ RenderBlock (anonymous) at (8,4) size 66x18
+ RenderText at (0,0) size 66x17
+ text run at (0,0) width 66: "too much"
+ RenderText {#text} at (141,6) size 65x17
+ text run at (141,6) width 65: " too much"
+ RenderBlock (anonymous) at (0,80) size 784x18
+ RenderText {#text} at (0,0) size 250x17
+ text run at (0,0) width 250: "Should not be selected in the selection."
+selection start: position 0 of child 0 {#text} of child 1 {P} of body
+selection end: position 41 of child 6 {#text} of child 3 {DIV} of body
Modified: trunk/Source/WebCore/ChangeLog (111945 => 111946)
--- trunk/Source/WebCore/ChangeLog 2012-03-24 00:53:34 UTC (rev 111945)
+++ trunk/Source/WebCore/ChangeLog 2012-03-24 00:54:04 UTC (rev 111946)
@@ -1,3 +1,23 @@
+2012-03-23 Parag Radke <[email protected]>
+
+ REGRESSION: can select text of an input button
+ https://bugs.webkit.org/show_bug.cgi?id=13624
+
+ Reviewed by Ryosuke Niwa.
+
+ Text in a button should never have a selection background of its own painted
+ but if the button is inside an editable area, then the whole button should
+ have it's selection background painted.
+
+ Test: editing/selection/selection-button-text.html
+
+ * rendering/RenderButton.h:
+ Added implementation for the virtual function canBeSelectionLeaf()
+ which returns true if the button renderer is editable, false other wise.
+ * rendering/RenderTextFragment.h:
+ Added implementation for the virtual function canBeSelectionLeaf()
+ which returns true if the text fragment renderer is editable, false other wise.
+
2012-03-23 Eric Carlson <[email protected]>
Remove unnecessary ASSERT from LoadableTextTrack::trackElementIndex
Modified: trunk/Source/WebCore/rendering/RenderButton.h (111945 => 111946)
--- trunk/Source/WebCore/rendering/RenderButton.h 2012-03-24 00:53:34 UTC (rev 111945)
+++ trunk/Source/WebCore/rendering/RenderButton.h 2012-03-24 00:54:04 UTC (rev 111946)
@@ -40,6 +40,8 @@
virtual const char* renderName() const { return "RenderButton"; }
virtual bool isRenderButton() const { return true; }
+ virtual bool canBeSelectionLeaf() const OVERRIDE { return node() && node()->rendererIsEditable(); }
+
virtual void addChild(RenderObject* newChild, RenderObject *beforeChild = 0);
virtual void removeChild(RenderObject*);
virtual void removeLeftoverAnonymousBlock(RenderBlock*) { }
Modified: trunk/Source/WebCore/rendering/RenderTextFragment.h (111945 => 111946)
--- trunk/Source/WebCore/rendering/RenderTextFragment.h 2012-03-24 00:53:34 UTC (rev 111945)
+++ trunk/Source/WebCore/rendering/RenderTextFragment.h 2012-03-24 00:54:04 UTC (rev 111946)
@@ -39,6 +39,8 @@
virtual bool isTextFragment() const { return true; }
+ virtual bool canBeSelectionLeaf() const OVERRIDE { return node() && node()->rendererIsEditable(); }
+
unsigned start() const { return m_start; }
unsigned end() const { return m_end; }