Diff
Modified: trunk/LayoutTests/ChangeLog (95644 => 95645)
--- trunk/LayoutTests/ChangeLog 2011-09-21 17:00:43 UTC (rev 95644)
+++ trunk/LayoutTests/ChangeLog 2011-09-21 17:06:53 UTC (rev 95645)
@@ -1,3 +1,22 @@
+2011-09-20 Ryosuke Niwa <rn...@webkit.org>
+
+ Span element gets produced using backspace/delete to merge header with paragraph
+ https://bugs.webkit.org/show_bug.cgi?id=68413
+
+ Reviewed by Darin Adler.
+
+ Add a test to remove the line break before a p element. WebKit should not preserve
+ the font color from the style rule but should preserve the font style from inline style declaration.
+
+ Also fix merge-paragraph-from-h6* to actually h6 instead of h1.
+
+ * editing/deleting/merge-paragraph-from-h6-expected.txt:
+ * editing/deleting/merge-paragraph-from-h6-with-style-expected.txt:
+ * editing/deleting/merge-paragraph-from-h6-with-style.html:
+ * editing/deleting/merge-paragraph-from-h6.html:
+ * editing/deleting/merge-paragraph-from-p-with-style-expected.txt: Added.
+ * editing/deleting/merge-paragraph-from-p-with-style.html: Added.
+
2011-09-21 Ojan Vafai <o...@chromium.org>
[flexbox] rename classnames and methods in the tests to not assume horizontal
Modified: trunk/LayoutTests/editing/deleting/merge-paragraph-from-h6-expected.txt (95644 => 95645)
--- trunk/LayoutTests/editing/deleting/merge-paragraph-from-h6-expected.txt 2011-09-21 17:00:43 UTC (rev 95644)
+++ trunk/LayoutTests/editing/deleting/merge-paragraph-from-h6-expected.txt 2011-09-21 17:06:53 UTC (rev 95645)
@@ -2,7 +2,7 @@
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldDeleteDOMRange:range from 7 of #text > DIV > BODY > HTML > #document to 0 of H1 > DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldDeleteDOMRange:range from 7 of #text > DIV > BODY > HTML > #document to 0 of H6 > DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
Modified: trunk/LayoutTests/editing/deleting/merge-paragraph-from-h6-with-style-expected.txt (95644 => 95645)
--- trunk/LayoutTests/editing/deleting/merge-paragraph-from-h6-with-style-expected.txt 2011-09-21 17:00:43 UTC (rev 95644)
+++ trunk/LayoutTests/editing/deleting/merge-paragraph-from-h6-with-style-expected.txt 2011-09-21 17:06:53 UTC (rev 95645)
@@ -2,7 +2,7 @@
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldDeleteDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 0 of H1 > DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldDeleteDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 0 of H6 > DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 5 of #text > EM > DIV > BODY > HTML > #document to 5 of #text > EM > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
Modified: trunk/LayoutTests/editing/deleting/merge-paragraph-from-h6-with-style.html (95644 => 95645)
--- trunk/LayoutTests/editing/deleting/merge-paragraph-from-h6-with-style.html 2011-09-21 17:00:43 UTC (rev 95644)
+++ trunk/LayoutTests/editing/deleting/merge-paragraph-from-h6-with-style.html 2011-09-21 17:06:53 UTC (rev 95645)
@@ -5,7 +5,7 @@
WebKit should not cancel styles added by h6 by those of document's default style but still keep "hello" italicized and "world" in red.</p>
<div id="test" contenteditable>
<em>hello</em>
-<h1><font color="red">world</font></h1>
+<h6><font color="red">world</font></h6>
</div>
</div>
<script src=""
Modified: trunk/LayoutTests/editing/deleting/merge-paragraph-from-h6.html (95644 => 95645)
--- trunk/LayoutTests/editing/deleting/merge-paragraph-from-h6.html 2011-09-21 17:00:43 UTC (rev 95644)
+++ trunk/LayoutTests/editing/deleting/merge-paragraph-from-h6.html 2011-09-21 17:06:53 UTC (rev 95645)
@@ -5,7 +5,7 @@
WebKit should not cancel styles added by h6 by those of document's default style.</p>
<div id="test" contenteditable>
hello
-<h1>world</h1>
+<h6>world</h6>
</div>
</div>
<script src=""
Added: trunk/LayoutTests/editing/deleting/merge-paragraph-from-p-with-style-expected.txt (0 => 95645)
--- trunk/LayoutTests/editing/deleting/merge-paragraph-from-p-with-style-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/deleting/merge-paragraph-from-p-with-style-expected.txt 2011-09-21 17:06:53 UTC (rev 95645)
@@ -0,0 +1,20 @@
+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: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldDeleteDOMRange:range from 7 of #text > DIV > BODY > HTML > #document to 0 of P > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+This tests deleting line break before p.
+"helloworld" should both be in black text (no p element) and "world" should be italicized.
+| "
+hello<#selection-caret>"
+| <span>
+| style="font-style: italic; "
+| "world"
+| "
+"
Added: trunk/LayoutTests/editing/deleting/merge-paragraph-from-p-with-style.html (0 => 95645)
--- trunk/LayoutTests/editing/deleting/merge-paragraph-from-p-with-style.html (rev 0)
+++ trunk/LayoutTests/editing/deleting/merge-paragraph-from-p-with-style.html 2011-09-21 17:06:53 UTC (rev 95645)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+p {color: red;}
+</style>
+</head>
+<body>
+<p id="description">This tests deleting line break before p.
+"helloworld" should both be in black text (no p element) and "world" should be italicized.</p>
+<div id="test" contenteditable>
+hello
+<p style="font-style: italic;">world</p>
+</div>
+</div>
+<script src=""
+<script src=""
+<script>
+
+function editingTest() {
+ moveSelectionForwardByLineCommand();
+ deleteCommand();
+
+ Markup.description(document.getElementById('description').textContent);
+ Markup.dump('test');
+}
+
+runEditingTest();
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (95644 => 95645)
--- trunk/Source/WebCore/ChangeLog 2011-09-21 17:00:43 UTC (rev 95644)
+++ trunk/Source/WebCore/ChangeLog 2011-09-21 17:06:53 UTC (rev 95645)
@@ -1,3 +1,25 @@
+2011-09-20 Ryosuke Niwa <rn...@webkit.org>
+
+ Span element gets produced using backspace/delete to merge header with paragraph
+ https://bugs.webkit.org/show_bug.cgi?id=68413
+
+ Reviewed by Darin Adler.
+
+ Add p element to the list of elements to retain appearance. Also modified removeStyleFromNode
+ (and renamed to removeStyleFromRules) not to remove inline style declarations because
+ inline styles need to stay on copy.
+
+ Test: editing/deleting/merge-paragraph-from-p-with-style.html
+
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::saveTypingStyleState):
+ * editing/EditingStyle.cpp:
+ (WebCore::EditingStyle::removeStyleFromRules): Renamed from removeStyleFromNode.
+ * editing/EditingStyle.h:
+ * editing/markup.cpp:
+ (WebCore::isBlockNodeToRetainAppearance):
+ (WebCore::StyledMarkupAccumulator::serializeNodes):
+
2011-09-21 Alice Boxhall <aboxh...@chromium.org>
Report AXValueChanged when value changes in element with role=textbox.
Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (95644 => 95645)
--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2011-09-21 17:00:43 UTC (rev 95644)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2011-09-21 17:06:53 UTC (rev 95645)
@@ -283,7 +283,7 @@
// Figure out the typing style in effect before the delete is done.
m_typingStyle = EditingStyle::create(m_selectionToDelete.start());
- m_typingStyle->removeStyleAddedByNode(enclosingAnchorElement(m_selectionToDelete.start()));
+ m_typingStyle->removeStyleFromRules(enclosingAnchorElement(m_selectionToDelete.start()));
// If we're deleting into a Mail blockquote, save the style at end() instead of start()
// We'll use this later in computeTypingStyleAfterDelete if we end up outside of a Mail blockquote
Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (95644 => 95645)
--- trunk/Source/WebCore/editing/EditingStyle.cpp 2011-09-21 17:00:43 UTC (rev 95644)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp 2011-09-21 17:06:53 UTC (rev 95645)
@@ -519,13 +519,17 @@
m_mutableStyle->removeBlockProperties();
}
-void EditingStyle::removeStyleAddedByNode(Node* node)
+void EditingStyle::removeStyleFromRules(Node* node)
{
+ // FIXME: This should share code with removeStyleFromRulesAndContext
+ // but it's hard to do until we figure out how to compare font-size property without computed style.
if (!node || !node->parentNode())
return;
RefPtr<CSSMutableStyleDeclaration> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()));
RefPtr<CSSMutableStyleDeclaration> nodeStyle = editingStyleFromComputedStyle(computedStyle(node));
parentStyle->diff(nodeStyle.get());
+ if (node->isStyledElement() && static_cast<StyledElement*>(node)->inlineStyleDecl())
+ nodeStyle = getPropertiesNotIn(nodeStyle.get(), static_cast<StyledElement*>(node)->inlineStyleDecl());
nodeStyle->diff(m_mutableStyle.get());
}
Modified: trunk/Source/WebCore/editing/EditingStyle.h (95644 => 95645)
--- trunk/Source/WebCore/editing/EditingStyle.h 2011-09-21 17:00:43 UTC (rev 95644)
+++ trunk/Source/WebCore/editing/EditingStyle.h 2011-09-21 17:06:53 UTC (rev 95645)
@@ -102,7 +102,7 @@
PassRefPtr<EditingStyle> extractAndRemoveBlockProperties();
PassRefPtr<EditingStyle> extractAndRemoveTextDirection();
void removeBlockProperties();
- void removeStyleAddedByNode(Node*);
+ void removeStyleFromRules(Node*);
void removeStyleConflictingWithStyleOfNode(Node*);
void removeNonEditingProperties();
void collapseTextDecorationProperties();
Modified: trunk/Source/WebCore/editing/markup.cpp (95644 => 95645)
--- trunk/Source/WebCore/editing/markup.cpp 2011-09-21 17:00:43 UTC (rev 95644)
+++ trunk/Source/WebCore/editing/markup.cpp 2011-09-21 17:06:53 UTC (rev 95645)
@@ -349,6 +349,7 @@
names.add(h5Tag.impl());
names.add(h6Tag.impl());
names.add(listingTag.impl());
+ names.add(pTag.impl());
names.add(preTag.impl());
}
return node->isElementNode() && names.contains(toElement(node)->tagQName().impl());
@@ -368,7 +369,7 @@
// Styles that Mail blockquotes contribute should only be placed on the Mail blockquote,
// to help us differentiate those styles from ones that the user has applied.
// This helps us get the color of content pasted into blockquotes right.
- m_wrappingStyle->removeStyleAddedByNode(enclosingNodeOfType(firstPositionInOrBeforeNode(parentOfHighestNode), isBlockNodeToRetainAppearance, CanCrossEditingBoundary));
+ m_wrappingStyle->removeStyleFromRules(enclosingNodeOfType(firstPositionInOrBeforeNode(parentOfHighestNode), isBlockNodeToRetainAppearance, CanCrossEditingBoundary));
// Call collapseTextDecorationProperties first or otherwise it'll copy the value over from in-effect to text-decorations.
m_wrappingStyle->collapseTextDecorationProperties();