Diff
Modified: trunk/LayoutTests/ChangeLog (92536 => 92537)
--- trunk/LayoutTests/ChangeLog 2011-08-06 01:45:51 UTC (rev 92536)
+++ trunk/LayoutTests/ChangeLog 2011-08-06 01:47:07 UTC (rev 92537)
@@ -1,3 +1,20 @@
+2011-08-05 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r92330.
+ http://trac.webkit.org/changeset/92330
+ https://bugs.webkit.org/show_bug.cgi?id=65804
+
+ caused various regressions in paste (Requested by rniwa on
+ #webkit).
+
+ * editing/pasteboard/5065605-expected.txt:
+ * editing/pasteboard/copy-paste-text-in-h1-expected.txt: Removed.
+ * editing/pasteboard/copy-paste-text-in-h1.html: Removed.
+ * editing/pasteboard/display-block-on-spans-expected.txt:
+ * editing/pasteboard/paste-pre-001-expected.txt:
+ * editing/pasteboard/paste-pre-002-expected.txt:
+ * editing/pasteboard/paste-text-011-expected.txt:
+
2011-08-05 Ryosuke Niwa <[email protected]>
Skip a failing test added by r92526 to Qt's skipped list.
Modified: trunk/LayoutTests/editing/pasteboard/5065605-expected.txt (92536 => 92537)
--- trunk/LayoutTests/editing/pasteboard/5065605-expected.txt 2011-08-06 01:45:51 UTC (rev 92536)
+++ trunk/LayoutTests/editing/pasteboard/5065605-expected.txt 2011-08-06 01:47:07 UTC (rev 92537)
@@ -21,7 +21,7 @@
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 24 of #text > FONT > DIV > DIV > BODY > HTML > #document to 24 of #text > FONT > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 24 of #text > FONT > DIV > SPAN > FONT > DIV > DIV > BODY > HTML > #document to 24 of #text > FONT > DIV > SPAN > FONT > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
@@ -36,12 +36,19 @@
| class="Apple-style-span"
| color="#ff0000"
| "This text should be red."
-| <font>
-| class="Apple-style-span"
-| color="#ff0000"
-| "This text should be red."
| <div>
| <font>
| class="Apple-style-span"
| color="#ff0000"
-| "This text should be red.<#selection-caret>"
+| <span>
+| class="Apple-style-span"
+| style="color: rgb(0, 0, 0); "
+| <font>
+| class="Apple-style-span"
+| color="#ff0000"
+| "This text should be red."
+| <div>
+| <font>
+| class="Apple-style-span"
+| color="#ff0000"
+| "This text should be red.<#selection-caret>"
Deleted: trunk/LayoutTests/editing/pasteboard/copy-paste-text-in-h1-expected.txt (92536 => 92537)
--- trunk/LayoutTests/editing/pasteboard/copy-paste-text-in-h1-expected.txt 2011-08-06 01:45:51 UTC (rev 92536)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-text-in-h1-expected.txt 2011-08-06 01:47:07 UTC (rev 92537)
@@ -1,11 +0,0 @@
-This tests copying and pasting text in h1. WebKit should not nest h1s.
-To manually test, copy and paste "hello world". You should see single border around "hello world".
-| "
-"
-| <h1>
-| "hello"
-| " "
-| <em>
-| "world<#selection-caret>"
-| "
-"
Deleted: trunk/LayoutTests/editing/pasteboard/copy-paste-text-in-h1.html (92536 => 92537)
--- trunk/LayoutTests/editing/pasteboard/copy-paste-text-in-h1.html 2011-08-06 01:45:51 UTC (rev 92536)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-text-in-h1.html 2011-08-06 01:47:07 UTC (rev 92537)
@@ -1,33 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<style>
-h1 { border: solid 1px black; padding: 5px; }
-</style>
-</head>
-<body>
-<p id="description">This tests copying and pasting text in h1. WebKit should not nest h1s.
-To manually test, copy and paste "hello world". You should see single border around "hello world".</p>
-<div id="test" contenteditable>
-<h1>hello <em>world</em></h1>
-</div>
-<script src=""
-<script>
-
-var test = document.getElementById('test');
-test.focus();
-
-Markup.description(document.getElementById('description').textContent);
-
-document.execCommand('SelectAll', false, null);
-document.execCommand('Copy', false, null);
-document.execCommand('Paste', false, null);
-
-if (window.layoutTestController)
- Markup.dump(test);
-else
- Markup.noAutoDump();
-
-</script>
-</body>
-</html>
Modified: trunk/LayoutTests/editing/pasteboard/display-block-on-spans-expected.txt (92536 => 92537)
--- trunk/LayoutTests/editing/pasteboard/display-block-on-spans-expected.txt 2011-08-06 01:45:51 UTC (rev 92536)
+++ trunk/LayoutTests/editing/pasteboard/display-block-on-spans-expected.txt 2011-08-06 01:47:07 UTC (rev 92537)
@@ -29,11 +29,8 @@
| <span>
| style="display:block"
| <b>
-| <span>
-| class="Apple-style-span"
-| style="font-weight: normal; "
-| <b>
-| "This<#selection-caret>"
+| "This<#selection-caret>"
+| <b>
| " is another paragraph."
| <br>
| "
Modified: trunk/LayoutTests/editing/pasteboard/paste-pre-001-expected.txt (92536 => 92537)
--- trunk/LayoutTests/editing/pasteboard/paste-pre-001-expected.txt 2011-08-06 01:45:51 UTC (rev 92536)
+++ trunk/LayoutTests/editing/pasteboard/paste-pre-001-expected.txt 2011-08-06 01:47:07 UTC (rev 92537)
@@ -7,4 +7,4 @@
foo
bar
execCutCommand: <div id="test" class="editing"> <pre><br></pre> </div>
-execPasteCommand: <div id="test" class="editing"> <pre>foo bar</pre> </div>
+execPasteCommand: <div id="test" class="editing"> <pre><span class="Apple-style-span" style="font-family: Times; white-space: normal; "><pre>foo bar</pre></span></pre> </div>
Modified: trunk/LayoutTests/editing/pasteboard/paste-pre-002-expected.txt (92536 => 92537)
--- trunk/LayoutTests/editing/pasteboard/paste-pre-002-expected.txt 2011-08-06 01:45:51 UTC (rev 92536)
+++ trunk/LayoutTests/editing/pasteboard/paste-pre-002-expected.txt 2011-08-06 01:47:07 UTC (rev 92537)
@@ -2,4 +2,4 @@
foo
bar
execCopyCommand: <div id="test" class="editing"> <pre>foo bar</pre> </div>
-execPasteCommand: <div id="test" class="editing"> <pre>foo bar</pre> </div>
+execPasteCommand: <div id="test" class="editing"> <pre><span class="Apple-style-span" style="font-family: Times; white-space: normal; "><pre>foo bar</pre></span></pre> </div>
Modified: trunk/LayoutTests/editing/pasteboard/paste-text-011-expected.txt (92536 => 92537)
--- trunk/LayoutTests/editing/pasteboard/paste-text-011-expected.txt 2011-08-06 01:45:51 UTC (rev 92536)
+++ trunk/LayoutTests/editing/pasteboard/paste-text-011-expected.txt 2011-08-06 01:47:07 UTC (rev 92537)
@@ -6,7 +6,7 @@
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of P > BODY > HTML > #document to 0 of P > BODY > HTML > #document givenAction:WebViewInsertActionPasted
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 5 of #text > B > FONT > P > BODY > HTML > #document to 5 of #text > B > FONT > P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 5 of #text > B > FONT > P > SPAN > B > FONT > P > BODY > HTML > #document to 5 of #text > B > FONT > P > SPAN > B > FONT > P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
@@ -30,12 +30,19 @@
| <font>
| face="Monaco"
| <b>
-| "hello"
-| <p>
-| <font>
-| face="Monaco"
-| <b>
-| "there<#selection-caret>"
+| <span>
+| class="Apple-style-span"
+| style="font-family: Times; font-weight: normal; "
+| <p>
+| <font>
+| face="Monaco"
+| <b>
+| "hello"
+| <p>
+| <font>
+| face="Monaco"
+| <b>
+| "there<#selection-caret>"
| "
Modified: trunk/Source/WebCore/ChangeLog (92536 => 92537)
--- trunk/Source/WebCore/ChangeLog 2011-08-06 01:45:51 UTC (rev 92536)
+++ trunk/Source/WebCore/ChangeLog 2011-08-06 01:47:07 UTC (rev 92537)
@@ -1,3 +1,19 @@
+2011-08-05 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r92330.
+ http://trac.webkit.org/changeset/92330
+ https://bugs.webkit.org/show_bug.cgi?id=65804
+
+ caused various regressions in paste (Requested by rniwa on
+ #webkit).
+
+ * editing/ReplaceSelectionCommand.cpp:
+ (WebCore::isInlineNodeWithStyle):
+ (WebCore::ReplaceSelectionCommand::doApply):
+ * editing/markup.cpp:
+ (WebCore::ancestorToRetainStructureAndAppearance):
+ * editing/markup.h:
+
2011-08-05 Kent Tamura <[email protected]>
Unreviewed, rolling out r92477.
Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (92536 => 92537)
--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp 2011-08-06 01:45:51 UTC (rev 92536)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp 2011-08-06 01:47:07 UTC (rev 92537)
@@ -760,12 +760,6 @@
return node;
}
-static bool nodeHasAttributesToPreserve(const HTMLElement* element)
-{
- const NamedNodeMap* attributeMap = element->attributeMap();
- return attributeMap && !attributeMap->isEmpty() && (attributeMap->length() > 1 || !element->hasAttribute(styleAttr));
-}
-
static bool isInlineNodeWithStyle(const Node* node)
{
// We don't want to skip over any block elements.
@@ -787,7 +781,11 @@
// We can skip inline elements that don't have attributes or whose only
// attribute is the style attribute.
- return !nodeHasAttributesToPreserve(static_cast<const HTMLElement*>(node));
+ const NamedNodeMap* attributeMap = element->attributeMap();
+ if (!attributeMap || attributeMap->isEmpty() || (attributeMap->length() == 1 && element->hasAttribute(styleAttr)))
+ return true;
+
+ return false;
}
void ReplaceSelectionCommand::doApply()
@@ -939,21 +937,16 @@
// We can skip this optimization for fragments not wrapped in one of
// our style spans and for positions inside list items
// since insertAsListItems already does the right thing.
- if (!m_matchStyle && !enclosingList(insertionPos.containerNode()) && isStyleSpan(fragment.firstChild())
- && VisiblePosition(firstPositionInNode(insertionPos.containerNode())) == VisiblePosition(lastPositionInNode(insertionPos.containerNode()))) {
+ if (!m_matchStyle && !enclosingList(insertionPos.containerNode()) && isStyleSpan(fragment.firstChild())) {
if (insertionPos.containerNode()->isTextNode() && insertionPos.offsetInContainerNode() && !insertionPos.atLastEditingPositionForNode()) {
splitTextNodeContainingElement(insertionPos.containerText(), insertionPos.offsetInContainerNode());
insertionPos = firstPositionInNode(insertionPos.containerNode());
}
- RefPtr<Node> nodeToSplitTo = highestEnclosingNodeOfType(insertionPos, isInlineNodeWithStyle);
- if (HTMLElement* ancestor = ancestorToRetainStructureAndAppearance(nodeToSplitTo ? nodeToSplitTo.get() : insertionPos.containerNode(), IncludeParagraphSeparators)) {
- if (ancestor->parentNode() && unsplittableElementForPosition(insertionPos)->contains(ancestor->parentNode()) && !nodeHasAttributesToPreserve(ancestor))
- nodeToSplitTo = ancestor;
- }
- if (nodeToSplitTo) {
- if (insertionPos.containerNode() != nodeToSplitTo->parentNode()) {
- nodeToSplitTo = splitTreeToNode(insertionPos.anchorNode(), nodeToSplitTo->parentNode()).get();
+ // FIXME: isInlineNodeWithStyle does not check editability.
+ if (RefPtr<Node> nodeToSplitTo = highestEnclosingNodeOfType(insertionPos, isInlineNodeWithStyle)) {
+ if (insertionPos.containerNode() != nodeToSplitTo) {
+ nodeToSplitTo = splitTreeToNode(insertionPos.anchorNode(), nodeToSplitTo.get(), true).get();
insertionPos = positionInParentBeforeNode(nodeToSplitTo.get());
}
}
Modified: trunk/Source/WebCore/editing/markup.cpp (92536 => 92537)
--- trunk/Source/WebCore/editing/markup.cpp 2011-08-06 01:45:51 UTC (rev 92536)
+++ trunk/Source/WebCore/editing/markup.cpp 2011-08-06 01:47:07 UTC (rev 92537)
@@ -350,7 +350,7 @@
return lastClosed;
}
-HTMLElement* ancestorToRetainStructureAndAppearance(Node* commonAncestor, ShouldIncludeParagraphSeparators shouldIncludeParagraphSeparators)
+static Node* ancestorToRetainStructureAndAppearance(Node* commonAncestor)
{
Node* commonAncestorBlock = enclosingBlock(commonAncestor);
@@ -362,7 +362,7 @@
while (table && !table->hasTagName(tableTag))
table = table->parentNode();
- return toHTMLElement(table);
+ return table;
}
if (commonAncestorBlock->hasTagName(listingTag)
@@ -376,12 +376,8 @@
|| commonAncestorBlock->hasTagName(h3Tag)
|| commonAncestorBlock->hasTagName(h4Tag)
|| commonAncestorBlock->hasTagName(h5Tag))
- return toHTMLElement(commonAncestorBlock);
+ return commonAncestorBlock;
- if (shouldIncludeParagraphSeparators == IncludeParagraphSeparators
- && (commonAncestorBlock->hasTagName(pTag) || commonAncestorBlock->hasTagName(divTag)))
- return toHTMLElement(commonAncestorBlock);
-
return 0;
}
Modified: trunk/Source/WebCore/editing/markup.h (92536 => 92537)
--- trunk/Source/WebCore/editing/markup.h 2011-08-06 01:45:51 UTC (rev 92536)
+++ trunk/Source/WebCore/editing/markup.h 2011-08-06 01:47:07 UTC (rev 92537)
@@ -33,35 +33,31 @@
namespace WebCore {
-class Document;
-class DocumentFragment;
-class Element;
-class HTMLElement;
-class KURL;
-class Node;
-class Range;
+ class Document;
+ class DocumentFragment;
+ class Element;
+ class KURL;
+ class Node;
+ class Range;
-enum EChildrenOnly { IncludeNode, ChildrenOnly };
-enum EAbsoluteURLs { DoNotResolveURLs, AbsoluteURLs };
+ enum EChildrenOnly { IncludeNode, ChildrenOnly };
+ enum EAbsoluteURLs { DoNotResolveURLs, AbsoluteURLs };
-PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String& text);
-PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document*, const String& markup, const String& baseURL, FragmentScriptingPermission = FragmentScriptingAllowed);
-PassRefPtr<DocumentFragment> createFragmentFromNodes(Document*, const Vector<Node*>&);
+ PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String& text);
+ PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document*, const String& markup, const String& baseURL, FragmentScriptingPermission = FragmentScriptingAllowed);
+ PassRefPtr<DocumentFragment> createFragmentFromNodes(Document*, const Vector<Node*>&);
-bool isPlainTextMarkup(Node*);
+ bool isPlainTextMarkup(Node *node);
-String createMarkup(const Range*, Vector<Node*>* = 0, EAnnotateForInterchange = DoNotAnnotateForInterchange, bool convertBlocksToInlines = false, EAbsoluteURLs = DoNotResolveURLs);
-String createMarkup(const Node*, EChildrenOnly = IncludeNode, Vector<Node*>* = 0, EAbsoluteURLs = DoNotResolveURLs);
+ String createMarkup(const Range*,
+ Vector<Node*>* = 0, EAnnotateForInterchange = DoNotAnnotateForInterchange, bool convertBlocksToInlines = false, EAbsoluteURLs = DoNotResolveURLs);
+ String createMarkup(const Node*, EChildrenOnly = IncludeNode, Vector<Node*>* = 0, EAbsoluteURLs = DoNotResolveURLs);
+
+ String createFullMarkup(const Node*);
+ String createFullMarkup(const Range*);
-String createFullMarkup(const Node*);
-String createFullMarkup(const Range*);
-
-String urlToMarkup(const KURL&, const String& title);
-String imageToMarkup(const KURL&, Element*);
-
-enum ShouldIncludeParagraphSeparators { DoNotIncludeParagraphSeparators, IncludeParagraphSeparators };
-HTMLElement* ancestorToRetainStructureAndAppearance(Node*, ShouldIncludeParagraphSeparators = DoNotIncludeParagraphSeparators);
-
+ String urlToMarkup(const KURL&, const String& title);
+ String imageToMarkup(const KURL&, Element*);
}
#endif // markup_h