Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: Source/WebCore/editing/ApplyStyleCommand.cpp

Issue 11411295: Merge 135193 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/editing/style/apply-style-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 for (Node* n = startNode; n && n != enclosingNode; n = n->parentNode()) { 531 for (Node* n = startNode; n && n != enclosingNode; n = n->parentNode()) {
532 if (n->isHTMLElement() && getIdentifierValue(CSSComputedStyleDeclaration ::create(n).get(), CSSPropertyUnicodeBidi) == CSSValueEmbed) 532 if (n->isHTMLElement() && getIdentifierValue(CSSComputedStyleDeclaration ::create(n).get(), CSSPropertyUnicodeBidi) == CSSValueEmbed)
533 return n; 533 return n;
534 } 534 }
535 535
536 return 0; 536 return 0;
537 } 537 }
538 538
539 void ApplyStyleCommand::applyInlineStyle(EditingStyle* style) 539 void ApplyStyleCommand::applyInlineStyle(EditingStyle* style)
540 { 540 {
541 Node* startDummySpanAncestor = 0; 541 RefPtr<Node> startDummySpanAncestor = 0;
542 Node* endDummySpanAncestor = 0; 542 RefPtr<Node> endDummySpanAncestor = 0;
543 543
544 // update document layout once before removing styles 544 // update document layout once before removing styles
545 // so that we avoid the expense of updating before each and every call 545 // so that we avoid the expense of updating before each and every call
546 // to check a computed style 546 // to check a computed style
547 document()->updateLayoutIgnorePendingStylesheets(); 547 document()->updateLayoutIgnorePendingStylesheets();
548 548
549 // adjust to the positions we want to use for applying style 549 // adjust to the positions we want to use for applying style
550 Position start = startPosition(); 550 Position start = startPosition();
551 Position end = endPosition(); 551 Position end = endPosition();
552 552
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 657 }
658 fixRangeAndApplyInlineStyle(embeddingStyle.get(), embeddingApplyStar t, embeddingApplyEnd); 658 fixRangeAndApplyInlineStyle(embeddingStyle.get(), embeddingApplyStar t, embeddingApplyEnd);
659 659
660 styleToApply = styleWithoutEmbedding; 660 styleToApply = styleWithoutEmbedding;
661 } 661 }
662 } 662 }
663 663
664 fixRangeAndApplyInlineStyle(styleToApply.get(), start, end); 664 fixRangeAndApplyInlineStyle(styleToApply.get(), start, end);
665 665
666 // Remove dummy style spans created by splitting text elements. 666 // Remove dummy style spans created by splitting text elements.
667 cleanupUnstyledAppleStyleSpans(startDummySpanAncestor); 667 cleanupUnstyledAppleStyleSpans(startDummySpanAncestor.get());
668 if (endDummySpanAncestor != startDummySpanAncestor) 668 if (endDummySpanAncestor != startDummySpanAncestor)
669 cleanupUnstyledAppleStyleSpans(endDummySpanAncestor); 669 cleanupUnstyledAppleStyleSpans(endDummySpanAncestor.get());
670 } 670 }
671 671
672 void ApplyStyleCommand::fixRangeAndApplyInlineStyle(EditingStyle* style, const P osition& start, const Position& end) 672 void ApplyStyleCommand::fixRangeAndApplyInlineStyle(EditingStyle* style, const P osition& start, const Position& end)
673 { 673 {
674 Node* startNode = start.deprecatedNode(); 674 Node* startNode = start.deprecatedNode();
675 675
676 if (start.deprecatedEditingOffset() >= caretMaxOffset(start.deprecatedNode() )) { 676 if (start.deprecatedEditingOffset() >= caretMaxOffset(start.deprecatedNode() )) {
677 startNode = startNode->traverseNextNode(); 677 startNode = startNode->traverseNextNode();
678 if (!startNode || comparePositions(end, firstPositionInOrBeforeNode(star tNode)) < 0) 678 if (!startNode || comparePositions(end, firstPositionInOrBeforeNode(star tNode)) < 0)
679 return; 679 return;
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 String textToMove = nextText->data(); 1477 String textToMove = nextText->data();
1478 insertTextIntoNode(childText, childText->length(), textToMove); 1478 insertTextIntoNode(childText, childText->length(), textToMove);
1479 removeNode(next); 1479 removeNode(next);
1480 // don't move child node pointer. it may want to merge with more text no des. 1480 // don't move child node pointer. it may want to merge with more text no des.
1481 } 1481 }
1482 1482
1483 updateStartEnd(newStart, newEnd); 1483 updateStartEnd(newStart, newEnd);
1484 } 1484 }
1485 1485
1486 } 1486 }
OLDNEW
« no previous file with comments | « LayoutTests/editing/style/apply-style-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698