Title: [153509] trunk
- Revision
- 153509
- Author
- [email protected]
- Date
- 2013-07-30 21:55:02 -0700 (Tue, 30 Jul 2013)
Log Message
Gmail reply email - Bold and Italic style get stuck
https://bugs.webkit.org/show_bug.cgi?id=118185
Patch by Vani Hegde <[email protected]> on 2013-07-30
Reviewed by Ryosuke Niwa.
Source/WebCore:
When bold/italic style is applied to a content with mixed editability,
style is applied appropriately for the first time.
But after this, style toggling does not work any more. Same behavior
can be observed when the content on which style is applied contains
text node without renderer (Ex: text node corresponding to tab/space etc)
When bold/italic style is applied on a selection, we actually apply the
style only for text nodes that have renderers and also are contenteditable.
Similarly during style toggling, to check whether a style has been already
applied on a selection
Tests: editing/style/toggle-style-bold-italic-mixed-editability.html
editing/style/toggle-style-bold-italic.html
* editing/EditingStyle.cpp:
(WebCore::EditingStyle::triStateOfStyle):
A particular selection on which style is applied may contain text nodes
without renderers(text nodes corresponding to tab/space) or text nodes
that are not contenteditable. We do not apply style to such text nodes.
Hence, even during style toggling we should not consider the styles
present in such nodes.
LayoutTests:
Layout tests added to test bold/italic style toggling on a content
with mixed editability.
* editing/editing.js:
(runDumpAsTextEditingTest): Replaced markupResultList with
elementsForDumpingMarkupList to store all markup data to be logged
at the end of test.
(debugForDumpAsText): Changed to use elementsForDumpingMarkupList.
(startNewMarkupGroup): Added utility function to hold intermediate
data by separating <ol>.
* editing/style/toggle-style-bold-italic-expected.txt: Added.
* editing/style/toggle-style-bold-italic-mixed-editability-expected.txt: Added.
* editing/style/toggle-style-bold-italic-mixed-editability.html: Added.
* editing/style/toggle-style-bold-italic.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (153508 => 153509)
--- trunk/LayoutTests/ChangeLog 2013-07-31 01:59:00 UTC (rev 153508)
+++ trunk/LayoutTests/ChangeLog 2013-07-31 04:55:02 UTC (rev 153509)
@@ -1,3 +1,25 @@
+2013-07-30 Vani Hegde <[email protected]>
+
+ Gmail reply email - Bold and Italic style get stuck
+ https://bugs.webkit.org/show_bug.cgi?id=118185
+
+ Reviewed by Ryosuke Niwa.
+
+ Layout tests added to test bold/italic style toggling on a content
+ with mixed editability.
+
+ * editing/editing.js:
+ (runDumpAsTextEditingTest): Replaced markupResultList with
+ elementsForDumpingMarkupList to store all markup data to be logged
+ at the end of test.
+ (debugForDumpAsText): Changed to use elementsForDumpingMarkupList.
+ (startNewMarkupGroup): Added utility function to hold intermediate
+ data by separating <ol>.
+ * editing/style/toggle-style-bold-italic-expected.txt: Added.
+ * editing/style/toggle-style-bold-italic-mixed-editability-expected.txt: Added.
+ * editing/style/toggle-style-bold-italic-mixed-editability.html: Added.
+ * editing/style/toggle-style-bold-italic.html: Added.
+
2013-07-30 Rob Buis <[email protected]>
XMLSerializer should reset default namespace when necessary
Modified: trunk/LayoutTests/editing/editing.js (153508 => 153509)
--- trunk/LayoutTests/editing/editing.js 2013-07-31 01:59:00 UTC (rev 153508)
+++ trunk/LayoutTests/editing/editing.js 2013-07-31 04:55:02 UTC (rev 153509)
@@ -904,7 +904,7 @@
}
var dumpAsText = false;
-var markupResultList = document.createElement('ol');
+var elementsForDumpingMarkupList = [document.createElement('ol')];
function runDumpAsTextEditingTest(enableCallbacks) {
if (window.testRunner) {
@@ -920,17 +920,26 @@
selection.setPosition(elem, 0);
editingTest();
- document.body.appendChild(markupResultList);
+ for (var i = 0; i < elementsForDumpingMarkupList.length; i++)
+ document.body.appendChild(elementsForDumpingMarkupList[i]);
}
function debugForDumpAsText(name) {
if (dumpAsText && document.getElementById("root")) {
var newItem = document.createElement('li');
newItem.appendChild(document.createTextNode(name+": "+document.getElementById("root").innerHTML));
- markupResultList.appendChild(newItem);
+ elementsForDumpingMarkupList[elementsForDumpingMarkupList.length - 1].appendChild(newItem);
}
}
+function startNewMarkupGroup(label) {
+ if (!elementsForDumpingMarkupList[elementsForDumpingMarkupList.length - 1].hasChildNodes())
+ elementsForDumpingMarkupList.pop();
+ elementsForDumpingMarkupList.push(document.createElement('br'));
+ elementsForDumpingMarkupList.push(document.createTextNode(label));
+ elementsForDumpingMarkupList.push(document.createElement('ol'));
+}
+
//-------------------------------------------------------------------------------------------------------
Added: trunk/LayoutTests/editing/style/toggle-style-bold-italic-expected.txt (0 => 153509)
--- trunk/LayoutTests/editing/style/toggle-style-bold-italic-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/style/toggle-style-bold-italic-expected.txt 2013-07-31 04:55:02 UTC (rev 153509)
@@ -0,0 +1,71 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > B > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > B > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > B > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of B > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > I > B > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > I > B > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > I > B > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > I > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > I > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > I > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > B > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > B > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > B > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of B > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > I > B > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > I > B > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > I > B > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > I > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > I > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > I > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > B > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > B > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > B > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of B > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > I > B > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > I > B > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > I > B > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > I > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > I > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > I > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > P > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > DIV > DIV > BODY > HTML > #document to 14 of #text > P > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+Tests bold/italic style toggling on a content that has text node without renderer (Ex: Tab/Space used for indentation)
+
+Some text
+Some more text
+
+
+Test for mac
+execBoldCommand: <div id="test"> <div><b>Some text</b></div> <p><b>Some more text</b></p> </div>
+execItalicCommand: <div id="test"> <div><b><i>Some text</i></b></div> <p><b><i>Some more text</i></b></p> </div>
+execBoldCommand: <div id="test"> <div><i>Some text</i></div> <p><i>Some more text</i></p> </div>
+execItalicCommand: <div id="test"> <div>Some text</div> <p>Some more text</p> </div>
+
+Test for win
+execBoldCommand: <div id="test"> <div><b>Some text</b></div> <p><b>Some more text</b></p> </div>
+execItalicCommand: <div id="test"> <div><b><i>Some text</i></b></div> <p><b><i>Some more text</i></b></p> </div>
+execBoldCommand: <div id="test"> <div><i>Some text</i></div> <p><i>Some more text</i></p> </div>
+execItalicCommand: <div id="test"> <div>Some text</div> <p>Some more text</p> </div>
+
+Test for unix
+execBoldCommand: <div id="test"> <div><b>Some text</b></div> <p><b>Some more text</b></p> </div>
+execItalicCommand: <div id="test"> <div><b><i>Some text</i></b></div> <p><b><i>Some more text</i></b></p> </div>
+execBoldCommand: <div id="test"> <div><i>Some text</i></div> <p><i>Some more text</i></p> </div>
+execItalicCommand: <div id="test"> <div>Some text</div> <p>Some more text</p> </div>
+
Added: trunk/LayoutTests/editing/style/toggle-style-bold-italic-mixed-editability-expected.txt (0 => 153509)
--- trunk/LayoutTests/editing/style/toggle-style-bold-italic-mixed-editability-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/style/toggle-style-bold-italic-mixed-editability-expected.txt 2013-07-31 04:55:02 UTC (rev 153509)
@@ -0,0 +1,69 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > BODY > HTML > #document to 9 of #text > B > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > B > DIV > DIV > BODY > HTML > #document to 9 of #text > B > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of B > DIV > DIV > BODY > HTML > #document to 9 of #text > I > B > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > I > B > DIV > DIV > BODY > HTML > #document to 9 of #text > I > B > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > BODY > HTML > #document to 9 of #text > I > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > I > DIV > DIV > BODY > HTML > #document to 9 of #text > I > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > BODY > HTML > #document to 9 of #text > B > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > B > DIV > DIV > BODY > HTML > #document to 9 of #text > B > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of B > DIV > DIV > BODY > HTML > #document to 9 of #text > I > B > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > I > B > DIV > DIV > BODY > HTML > #document to 9 of #text > I > B > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > BODY > HTML > #document to 9 of #text > I > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > I > DIV > DIV > BODY > HTML > #document to 9 of #text > I > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > BODY > HTML > #document to 9 of #text > B > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > B > DIV > DIV > BODY > HTML > #document to 9 of #text > B > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of B > DIV > DIV > BODY > HTML > #document to 9 of #text > I > B > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > I > B > DIV > DIV > BODY > HTML > #document to 9 of #text > I > B > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > BODY > HTML > #document to 9 of #text > I > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > I > DIV > DIV > BODY > HTML > #document to 9 of #text > I > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+This tests bold/italic style toggling for a content with mixed editability
+
+Editable Non-editable Editable
+
+Test for mac
+execBoldCommand: <div id="test"><b> Editable </b><span contenteditable="false">Non-editable</span><b> Editable </b></div>
+execItalicCommand: <div id="test"><b><i> Editable </i></b><span contenteditable="false">Non-editable</span><b><i> Editable </i></b></div>
+execBoldCommand: <div id="test"><i> Editable </i><span contenteditable="false">Non-editable</span><i> Editable </i></div>
+execItalicCommand: <div id="test"> Editable <span contenteditable="false">Non-editable</span> Editable </div>
+
+Test for win
+execBoldCommand: <div id="test"><b> Editable </b><span contenteditable="false">Non-editable</span><b> Editable </b></div>
+execItalicCommand: <div id="test"><b><i> Editable </i></b><span contenteditable="false">Non-editable</span><b><i> Editable </i></b></div>
+execBoldCommand: <div id="test"><i> Editable </i><span contenteditable="false">Non-editable</span><i> Editable </i></div>
+execItalicCommand: <div id="test"> Editable <span contenteditable="false">Non-editable</span> Editable </div>
+
+Test for unix
+execBoldCommand: <div id="test"><b> Editable </b><span contenteditable="false">Non-editable</span><b> Editable </b></div>
+execItalicCommand: <div id="test"><b><i> Editable </i></b><span contenteditable="false">Non-editable</span><b><i> Editable </i></b></div>
+execBoldCommand: <div id="test"><i> Editable </i><span contenteditable="false">Non-editable</span><i> Editable </i></div>
+execItalicCommand: <div id="test"> Editable <span contenteditable="false">Non-editable</span> Editable </div>
+
Added: trunk/LayoutTests/editing/style/toggle-style-bold-italic-mixed-editability.html (0 => 153509)
--- trunk/LayoutTests/editing/style/toggle-style-bold-italic-mixed-editability.html (rev 0)
+++ trunk/LayoutTests/editing/style/toggle-style-bold-italic-mixed-editability.html 2013-07-31 04:55:02 UTC (rev 153509)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p id="description">This tests bold/italic style toggling for a content with mixed editability</p>
+<div contenteditable id="root">
+<div id="test">
+Editable <span contenteditable=false>Non-editable</span> Editable
+</div>
+</div>
+<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script>
+test('mac');
+test('win');
+test('unix');
+function test(platform) {
+ if (window.internals)
+ internals.settings.setEditingBehavior(platform);
+ startNewMarkupGroup('Test for '+platform);
+ runDumpAsTextEditingTest(true);
+}
+function editingTest() {
+ execSelectAllCommand();
+ execBoldCommand();
+ execItalicCommand();
+ execBoldCommand();
+ execItalicCommand();
+}
+</script>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/editing/style/toggle-style-bold-italic.html (0 => 153509)
--- trunk/LayoutTests/editing/style/toggle-style-bold-italic.html (rev 0)
+++ trunk/LayoutTests/editing/style/toggle-style-bold-italic.html 2013-07-31 04:55:02 UTC (rev 153509)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p id="description">Tests bold/italic style toggling on a content that has text node without renderer (Ex: Tab/Space used for indentation)</p>
+<div contenteditable id="root">
+<div id="test">
+<div>Some text</div>
+<p>Some more text</p>
+</div>
+</div>
+<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script>
+test('mac');
+test('win');
+test('unix');
+function test(platform) {
+ if (window.internals)
+ internals.settings.setEditingBehavior(platform);
+ startNewMarkupGroup('Test for '+platform);
+ runDumpAsTextEditingTest(true);
+}
+function editingTest() {
+ execSelectAllCommand();
+ execBoldCommand();
+ execItalicCommand();
+ execBoldCommand();
+ execItalicCommand();
+}
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (153508 => 153509)
--- trunk/Source/WebCore/ChangeLog 2013-07-31 01:59:00 UTC (rev 153508)
+++ trunk/Source/WebCore/ChangeLog 2013-07-31 04:55:02 UTC (rev 153509)
@@ -1,3 +1,32 @@
+2013-07-30 Vani Hegde <[email protected]>
+
+ Gmail reply email - Bold and Italic style get stuck
+ https://bugs.webkit.org/show_bug.cgi?id=118185
+
+ Reviewed by Ryosuke Niwa.
+
+ When bold/italic style is applied to a content with mixed editability,
+ style is applied appropriately for the first time.
+ But after this, style toggling does not work any more. Same behavior
+ can be observed when the content on which style is applied contains
+ text node without renderer (Ex: text node corresponding to tab/space etc)
+
+ When bold/italic style is applied on a selection, we actually apply the
+ style only for text nodes that have renderers and also are contenteditable.
+ Similarly during style toggling, to check whether a style has been already
+ applied on a selection
+
+ Tests: editing/style/toggle-style-bold-italic-mixed-editability.html
+ editing/style/toggle-style-bold-italic.html
+
+ * editing/EditingStyle.cpp:
+ (WebCore::EditingStyle::triStateOfStyle):
+ A particular selection on which style is applied may contain text nodes
+ without renderers(text nodes corresponding to tab/space) or text nodes
+ that are not contenteditable. We do not apply style to such text nodes.
+ Hence, even during style toggling we should not consider the styles
+ present in such nodes.
+
2013-07-30 Rob Buis <[email protected]>
XMLSerializer should reset default namespace when necessary
Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (153508 => 153509)
--- trunk/Source/WebCore/editing/EditingStyle.cpp 2013-07-31 01:59:00 UTC (rev 153508)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp 2013-07-31 04:55:02 UTC (rev 153509)
@@ -683,15 +683,20 @@
return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection).get());
TriState state = FalseTriState;
+ bool nodeIsStart = true;
for (Node* node = selection.start().deprecatedNode(); node; node = NodeTraversal::next(node)) {
- ComputedStyleExtractor computedStyle(node);
- TriState nodeState = triStateOfStyle(&computedStyle, node->isTextNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTextOnlyProperties);
- if (node == selection.start().deprecatedNode())
- state = nodeState;
- else if (state != nodeState && node->isTextNode()) {
- state = MixedTriState;
- break;
+ if (node->renderer() && node->rendererIsEditable()) {
+ ComputedStyleExtractor computedStyle(node);
+ TriState nodeState = triStateOfStyle(&computedStyle, node->isTextNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTextOnlyProperties);
+ if (nodeIsStart) {
+ state = nodeState;
+ nodeIsStart = false;
+ } else if (state != nodeState && node->isTextNode()) {
+ state = MixedTriState;
+ break;
+ }
}
+
if (node == selection.end().deprecatedNode())
break;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes