Changeset 95335 in webkit
- Timestamp:
- Sep 16, 2011 5:00:07 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 15 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r95332 r95335 1 2011-09-14 Ryosuke Niwa <rniwa@webkit.org> 2 3 Deleting line break before h1 converts h1 to span 4 https://bugs.webkit.org/show_bug.cgi?id=45784 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Added a bunch of tests to ensure WebKit does not keep block elements' style when merging paragraphs. 9 When removing line breaks between <h1>hello</h1>world and hello<pre>world</pre> for example, 10 we should not be overriding and preserving styles from h1 in the merge paragraph respectively. 11 12 * editing/deleting/merge-paragraph-from-address-expected.txt: Added. 13 * editing/deleting/merge-paragraph-from-address.html: Added. 14 * editing/deleting/merge-paragraph-from-h6-expected.txt: Added. 15 * editing/deleting/merge-paragraph-from-h6-with-style-expected.txt: Added. 16 * editing/deleting/merge-paragraph-from-h6-with-style.html: Added. 17 * editing/deleting/merge-paragraph-from-h6.html: Added. 18 * editing/deleting/merge-paragraph-from-listing-expected.txt: Added. 19 * editing/deleting/merge-paragraph-from-listing.html: Added. 20 * editing/deleting/merge-paragraph-into-h1-expected.txt: Added. 21 * editing/deleting/merge-paragraph-into-h1-style-expected.txt: Added. 22 * editing/deleting/merge-paragraph-into-h1-with-style-expected.txt: Added. 23 * editing/deleting/merge-paragraph-into-h1-with-style.html: Added. 24 * editing/deleting/merge-paragraph-into-h1.html: Added. 25 * editing/deleting/merge-paragraph-into-pre-expected.txt: Added. 26 * editing/deleting/merge-paragraph-into-pre.html: Added. 27 * platform/mac/editing/deleting/merge-whitespace-pre-expected.png: 28 * platform/mac/editing/deleting/merge-whitespace-pre-expected.txt: 29 1 30 2011-09-16 David Levin <levin@chromium.org> 2 31 -
trunk/LayoutTests/platform/mac/editing/deleting/merge-whitespace-pre-expected.txt
r63291 r95335 13 13 RenderText {#text} at (0,0) size 21x18 14 14 text run at (0,0) width 21: "foo" 15 RenderInline {SPAN} at (0,0) size 24x15 16 RenderText {#text} at (21,2) size 24x15 17 text run at (21,2) width 24: "bar" 15 RenderText {#text} at (21,0) size 20x18 16 text run at (21,0) width 20: "bar" 18 17 RenderBlock {PRE} at (0,31) size 784x15 19 18 RenderText {#text} at (0,0) size 24x15 -
trunk/Source/WebCore/ChangeLog
r95333 r95335 1 2011-09-14 Ryosuke Niwa <rniwa@webkit.org> 2 3 Deleting line break before h1 converts h1 to span 4 https://bugs.webkit.org/show_bug.cgi?id=45784 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Fixed the bug by treating h1 and other elements that retain structure like Mail blockquote. 9 10 We already had a logic to overriding styles of merged paragraphs by Mail blockquote so 11 just extend this logic for h1-h6, pre, etc... 12 13 Tests: editing/deleting/merge-paragraph-from-address.html 14 editing/deleting/merge-paragraph-from-h6-with-style.html 15 editing/deleting/merge-paragraph-from-h6.html 16 editing/deleting/merge-paragraph-from-listing.html 17 editing/deleting/merge-paragraph-into-h1-with-style.html 18 editing/deleting/merge-paragraph-into-h1.html 19 editing/deleting/merge-paragraph-into-pre.html 20 21 * editing/ReplaceSelectionCommand.cpp: 22 (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline): 23 * editing/markup.cpp: 24 (WebCore::isBlockNodeToRetainAppearance): Extracted from ancestorToRetainStructureAndAppearance. 25 (WebCore::StyledMarkupAccumulator::serializeNodes): 26 (WebCore::ancestorToRetainStructureAndAppearance): 27 * editing/markup.h: 28 1 29 2011-09-16 Max Perepelitsyn <pph34r@gmail.com> 2 30 -
trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp
r94793 r95335 497 497 // If Mail wraps the fragment with a Paste as Quotation blockquote, or if you're pasting into a quoted region, 498 498 // styles from blockquoteNode are allowed to override those from the source document, see <rdar://problem/4930986> and <rdar://problem/5089327>. 499 Node* blockquoteNode = isMailPasteAsQuotationNode(context) ? context : enclosingNodeOfType(firstPositionInNode(context), is MailBlockquote, CanCrossEditingBoundary);499 Node* blockquoteNode = isMailPasteAsQuotationNode(context) ? context : enclosingNodeOfType(firstPositionInNode(context), isBlockNodeToRetainAppearance, CanCrossEditingBoundary); 500 500 if (blockquoteNode) 501 501 newInlineStyle->removeStyleFromRulesAndContext(element, document()->documentElement()); -
trunk/Source/WebCore/editing/markup.cpp
r94640 r95335 337 337 } 338 338 339 bool isBlockNodeToRetainAppearance(const Node* node) 340 { 341 DEFINE_STATIC_LOCAL(HashSet<QualifiedName::QualifiedNameImpl*>, names, ()); 342 if (!names.size()) { 343 names.add(addressTag.impl()); 344 names.add(blockquoteTag.impl()); 345 names.add(h1Tag.impl()); 346 names.add(h2Tag.impl()); 347 names.add(h3Tag.impl()); 348 names.add(h4Tag.impl()); 349 names.add(h5Tag.impl()); 350 names.add(h6Tag.impl()); 351 names.add(listingTag.impl()); 352 names.add(preTag.impl()); 353 } 354 return node->isElementNode() && names.contains(toElement(node)->tagQName().impl()); 355 } 356 339 357 Node* StyledMarkupAccumulator::serializeNodes(Node* startNode, Node* pastEnd) 340 358 { … … 351 369 // to help us differentiate those styles from ones that the user has applied. 352 370 // This helps us get the color of content pasted into blockquotes right. 353 m_wrappingStyle->removeStyleAddedByNode(enclosingNodeOfType(firstPositionInOrBeforeNode(parentOfHighestNode), is MailBlockquote, CanCrossEditingBoundary));371 m_wrappingStyle->removeStyleAddedByNode(enclosingNodeOfType(firstPositionInOrBeforeNode(parentOfHighestNode), isBlockNodeToRetainAppearance, CanCrossEditingBoundary)); 354 372 355 373 // Call collapseTextDecorationProperties first or otherwise it'll copy the value over from in-effect to text-decorations. … … 454 472 } 455 473 456 if ( commonAncestorBlock->hasTagName(listingTag)474 if (isBlockNodeToRetainAppearance(commonAncestorBlock) 457 475 || commonAncestorBlock->hasTagName(olTag) 458 || commonAncestorBlock->hasTagName(preTag)459 476 || commonAncestorBlock->hasTagName(tableTag) 460 477 || commonAncestorBlock->hasTagName(ulTag) 461 || commonAncestorBlock->hasTagName(xmpTag) 462 || commonAncestorBlock->hasTagName(h1Tag) 463 || commonAncestorBlock->hasTagName(h2Tag) 464 || commonAncestorBlock->hasTagName(h3Tag) 465 || commonAncestorBlock->hasTagName(h4Tag) 466 || commonAncestorBlock->hasTagName(h5Tag)) 478 || commonAncestorBlock->hasTagName(xmpTag)) 467 479 return commonAncestorBlock; 468 480 -
trunk/Source/WebCore/editing/markup.h
r92769 r95335 50 50 bool isPlainTextMarkup(Node *node); 51 51 52 bool isBlockNodeToRetainAppearance(const Node*); 52 53 String createMarkup(const Range*, 53 54 Vector<Node*>* = 0, EAnnotateForInterchange = DoNotAnnotateForInterchange, bool convertBlocksToInlines = false, EAbsoluteURLs = DoNotResolveURLs); 54 55 String createMarkup(const Node*, EChildrenOnly = IncludeNode, Vector<Node*>* = 0, EAbsoluteURLs = DoNotResolveURLs); 55 56 56 57 String createFullMarkup(const Node*); 57 58 String createFullMarkup(const Range*);
Note: See TracChangeset
for help on using the changeset viewer.