Changeset 92537 in webkit
- Timestamp:
- Aug 5, 2011 6:47:07 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r92531 r92537 1 2011-08-05 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r92330. 4 http://trac.webkit.org/changeset/92330 5 https://bugs.webkit.org/show_bug.cgi?id=65804 6 7 caused various regressions in paste (Requested by rniwa on 8 #webkit). 9 10 * editing/pasteboard/5065605-expected.txt: 11 * editing/pasteboard/copy-paste-text-in-h1-expected.txt: Removed. 12 * editing/pasteboard/copy-paste-text-in-h1.html: Removed. 13 * editing/pasteboard/display-block-on-spans-expected.txt: 14 * editing/pasteboard/paste-pre-001-expected.txt: 15 * editing/pasteboard/paste-pre-002-expected.txt: 16 * editing/pasteboard/paste-text-011-expected.txt: 17 1 18 2011-08-05 Ryosuke Niwa <rniwa@webkit.org> 2 19 -
trunk/LayoutTests/editing/pasteboard/5065605-expected.txt
r92330 r92537 22 22 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 23 23 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 24 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:FALSE24 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 25 25 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 26 26 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 37 37 | color="#ff0000" 38 38 | "This text should be red." 39 | <font>40 | class="Apple-style-span"41 | color="#ff0000"42 | "This text should be red."43 39 | <div> 44 40 | <font> 45 41 | class="Apple-style-span" 46 42 | color="#ff0000" 47 | "This text should be red.<#selection-caret>" 43 | <span> 44 | class="Apple-style-span" 45 | style="color: rgb(0, 0, 0); " 46 | <font> 47 | class="Apple-style-span" 48 | color="#ff0000" 49 | "This text should be red." 50 | <div> 51 | <font> 52 | class="Apple-style-span" 53 | color="#ff0000" 54 | "This text should be red.<#selection-caret>" -
trunk/LayoutTests/editing/pasteboard/display-block-on-spans-expected.txt
r92330 r92537 30 30 | style="display:block" 31 31 | <b> 32 | <span> 33 | class="Apple-style-span" 34 | style="font-weight: normal; " 35 | <b> 36 | "This<#selection-caret>" 32 | "This<#selection-caret>" 33 | <b> 37 34 | " is another paragraph." 38 35 | <br> -
trunk/LayoutTests/editing/pasteboard/paste-pre-001-expected.txt
r92330 r92537 8 8 bar 9 9 execCutCommand: <div id="test" class="editing"> <pre><br></pre> </div> 10 execPasteCommand: <div id="test" class="editing"> <pre> foo bar</pre> </div>10 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> -
trunk/LayoutTests/editing/pasteboard/paste-pre-002-expected.txt
r92330 r92537 3 3 bar 4 4 execCopyCommand: <div id="test" class="editing"> <pre>foo bar</pre> </div> 5 execPasteCommand: <div id="test" class="editing"> <pre> foo bar</pre> </div>5 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> -
trunk/LayoutTests/editing/pasteboard/paste-text-011-expected.txt
r92330 r92537 7 7 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of P > BODY > HTML > #document to 0 of P > BODY > HTML > #document givenAction:WebViewInsertActionPasted 8 8 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 9 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:FALSE9 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 10 10 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 11 11 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 31 31 | face="Monaco" 32 32 | <b> 33 | "hello" 34 | <p> 35 | <font> 36 | face="Monaco" 37 | <b> 38 | "there<#selection-caret>" 33 | <span> 34 | class="Apple-style-span" 35 | style="font-family: Times; font-weight: normal; " 36 | <p> 37 | <font> 38 | face="Monaco" 39 | <b> 40 | "hello" 41 | <p> 42 | <font> 43 | face="Monaco" 44 | <b> 45 | "there<#selection-caret>" 39 46 | " 40 47 -
trunk/Source/WebCore/ChangeLog
r92533 r92537 1 2011-08-05 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r92330. 4 http://trac.webkit.org/changeset/92330 5 https://bugs.webkit.org/show_bug.cgi?id=65804 6 7 caused various regressions in paste (Requested by rniwa on 8 #webkit). 9 10 * editing/ReplaceSelectionCommand.cpp: 11 (WebCore::isInlineNodeWithStyle): 12 (WebCore::ReplaceSelectionCommand::doApply): 13 * editing/markup.cpp: 14 (WebCore::ancestorToRetainStructureAndAppearance): 15 * editing/markup.h: 16 1 17 2011-08-05 Kent Tamura <tkent@chromium.org> 2 18 -
trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp
r92330 r92537 761 761 } 762 762 763 static bool nodeHasAttributesToPreserve(const HTMLElement* element)764 {765 const NamedNodeMap* attributeMap = element->attributeMap();766 return attributeMap && !attributeMap->isEmpty() && (attributeMap->length() > 1 || !element->hasAttribute(styleAttr));767 }768 769 763 static bool isInlineNodeWithStyle(const Node* node) 770 764 { … … 788 782 // We can skip inline elements that don't have attributes or whose only 789 783 // attribute is the style attribute. 790 return !nodeHasAttributesToPreserve(static_cast<const HTMLElement*>(node)); 784 const NamedNodeMap* attributeMap = element->attributeMap(); 785 if (!attributeMap || attributeMap->isEmpty() || (attributeMap->length() == 1 && element->hasAttribute(styleAttr))) 786 return true; 787 788 return false; 791 789 } 792 790 … … 940 938 // our style spans and for positions inside list items 941 939 // since insertAsListItems already does the right thing. 942 if (!m_matchStyle && !enclosingList(insertionPos.containerNode()) && isStyleSpan(fragment.firstChild()) 943 && VisiblePosition(firstPositionInNode(insertionPos.containerNode())) == VisiblePosition(lastPositionInNode(insertionPos.containerNode()))) { 940 if (!m_matchStyle && !enclosingList(insertionPos.containerNode()) && isStyleSpan(fragment.firstChild())) { 944 941 if (insertionPos.containerNode()->isTextNode() && insertionPos.offsetInContainerNode() && !insertionPos.atLastEditingPositionForNode()) { 945 942 splitTextNodeContainingElement(insertionPos.containerText(), insertionPos.offsetInContainerNode()); … … 947 944 } 948 945 949 RefPtr<Node> nodeToSplitTo = highestEnclosingNodeOfType(insertionPos, isInlineNodeWithStyle); 950 if (HTMLElement* ancestor = ancestorToRetainStructureAndAppearance(nodeToSplitTo ? nodeToSplitTo.get() : insertionPos.containerNode(), IncludeParagraphSeparators)) { 951 if (ancestor->parentNode() && unsplittableElementForPosition(insertionPos)->contains(ancestor->parentNode()) && !nodeHasAttributesToPreserve(ancestor)) 952 nodeToSplitTo = ancestor; 953 } 954 if (nodeToSplitTo) { 955 if (insertionPos.containerNode() != nodeToSplitTo->parentNode()) { 956 nodeToSplitTo = splitTreeToNode(insertionPos.anchorNode(), nodeToSplitTo->parentNode()).get(); 946 // FIXME: isInlineNodeWithStyle does not check editability. 947 if (RefPtr<Node> nodeToSplitTo = highestEnclosingNodeOfType(insertionPos, isInlineNodeWithStyle)) { 948 if (insertionPos.containerNode() != nodeToSplitTo) { 949 nodeToSplitTo = splitTreeToNode(insertionPos.anchorNode(), nodeToSplitTo.get(), true).get(); 957 950 insertionPos = positionInParentBeforeNode(nodeToSplitTo.get()); 958 951 } -
trunk/Source/WebCore/editing/markup.cpp
r92330 r92537 351 351 } 352 352 353 HTMLElement* ancestorToRetainStructureAndAppearance(Node* commonAncestor, ShouldIncludeParagraphSeparators shouldIncludeParagraphSeparators)353 static Node* ancestorToRetainStructureAndAppearance(Node* commonAncestor) 354 354 { 355 355 Node* commonAncestorBlock = enclosingBlock(commonAncestor); … … 363 363 table = table->parentNode(); 364 364 365 return t oHTMLElement(table);365 return table; 366 366 } 367 367 … … 377 377 || commonAncestorBlock->hasTagName(h4Tag) 378 378 || commonAncestorBlock->hasTagName(h5Tag)) 379 return toHTMLElement(commonAncestorBlock); 380 381 if (shouldIncludeParagraphSeparators == IncludeParagraphSeparators 382 && (commonAncestorBlock->hasTagName(pTag) || commonAncestorBlock->hasTagName(divTag))) 383 return toHTMLElement(commonAncestorBlock); 379 return commonAncestorBlock; 384 380 385 381 return 0; -
trunk/Source/WebCore/editing/markup.h
r92330 r92537 34 34 namespace WebCore { 35 35 36 class Document; 37 class DocumentFragment; 38 class Element; 39 class HTMLElement; 40 class KURL; 41 class Node; 42 class Range; 36 class Document; 37 class DocumentFragment; 38 class Element; 39 class KURL; 40 class Node; 41 class Range; 43 42 44 enum EChildrenOnly { IncludeNode, ChildrenOnly };45 enum EAbsoluteURLs { DoNotResolveURLs, AbsoluteURLs };43 enum EChildrenOnly { IncludeNode, ChildrenOnly }; 44 enum EAbsoluteURLs { DoNotResolveURLs, AbsoluteURLs }; 46 45 47 PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String& text);48 PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document*, const String& markup, const String& baseURL, FragmentScriptingPermission = FragmentScriptingAllowed);49 PassRefPtr<DocumentFragment> createFragmentFromNodes(Document*, const Vector<Node*>&);46 PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String& text); 47 PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document*, const String& markup, const String& baseURL, FragmentScriptingPermission = FragmentScriptingAllowed); 48 PassRefPtr<DocumentFragment> createFragmentFromNodes(Document*, const Vector<Node*>&); 50 49 51 bool isPlainTextMarkup(Node*);50 bool isPlainTextMarkup(Node *node); 52 51 53 String createMarkup(const Range*, Vector<Node*>* = 0, EAnnotateForInterchange = DoNotAnnotateForInterchange, bool convertBlocksToInlines = false, EAbsoluteURLs = DoNotResolveURLs); 54 String createMarkup(const Node*, EChildrenOnly = IncludeNode, Vector<Node*>* = 0, EAbsoluteURLs = DoNotResolveURLs); 52 String createMarkup(const Range*, 53 Vector<Node*>* = 0, EAnnotateForInterchange = DoNotAnnotateForInterchange, bool convertBlocksToInlines = false, EAbsoluteURLs = DoNotResolveURLs); 54 String createMarkup(const Node*, EChildrenOnly = IncludeNode, Vector<Node*>* = 0, EAbsoluteURLs = DoNotResolveURLs); 55 56 String createFullMarkup(const Node*); 57 String createFullMarkup(const Range*); 55 58 56 String createFullMarkup(const Node*); 57 String createFullMarkup(const Range*); 58 59 String urlToMarkup(const KURL&, const String& title); 60 String imageToMarkup(const KURL&, Element*); 61 62 enum ShouldIncludeParagraphSeparators { DoNotIncludeParagraphSeparators, IncludeParagraphSeparators }; 63 HTMLElement* ancestorToRetainStructureAndAppearance(Node*, ShouldIncludeParagraphSeparators = DoNotIncludeParagraphSeparators); 64 59 String urlToMarkup(const KURL&, const String& title); 60 String imageToMarkup(const KURL&, Element*); 65 61 } 66 62
Note: See TracChangeset
for help on using the changeset viewer.