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

Side by Side Diff: Source/core/editing/ReplaceSelectionCommand.cpp

Issue 110723005: Make calls to AtomicString(const String&) explicit in editing/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 newInlineStyle->removeStyleFromRulesAndContext(element, context); 506 newInlineStyle->removeStyleFromRulesAndContext(element, context);
507 } 507 }
508 508
509 if (!inlineStyle || newInlineStyle->isEmpty()) { 509 if (!inlineStyle || newInlineStyle->isEmpty()) {
510 if (isStyleSpanOrSpanWithOnlyStyleAttribute(element) || isEmptyFontT ag(element, AllowNonEmptyStyleAttribute)) { 510 if (isStyleSpanOrSpanWithOnlyStyleAttribute(element) || isEmptyFontT ag(element, AllowNonEmptyStyleAttribute)) {
511 insertedNodes.willRemoveNodePreservingChildren(*element); 511 insertedNodes.willRemoveNodePreservingChildren(*element);
512 removeNodePreservingChildren(element); 512 removeNodePreservingChildren(element);
513 continue; 513 continue;
514 } 514 }
515 removeNodeAttribute(element, styleAttr); 515 removeNodeAttribute(element, styleAttr);
516 } else if (newInlineStyle->style()->propertyCount() != inlineStyle->prop ertyCount()) 516 } else if (newInlineStyle->style()->propertyCount() != inlineStyle->prop ertyCount()) {
517 setNodeAttribute(element, styleAttr, newInlineStyle->style()->asText ()); 517 setNodeAttribute(element, styleAttr, AtomicString(newInlineStyle->st yle()->asText()));
518 }
518 519
519 // FIXME: Tolerate differences in id, class, and style attributes. 520 // FIXME: Tolerate differences in id, class, and style attributes.
520 if (isNonTableCellHTMLBlockElement(element) && areIdenticalElements(elem ent, element->parentNode()) 521 if (isNonTableCellHTMLBlockElement(element) && areIdenticalElements(elem ent, element->parentNode())
521 && VisiblePosition(firstPositionInNode(element->parentNode())) == Vi siblePosition(firstPositionInNode(element)) 522 && VisiblePosition(firstPositionInNode(element->parentNode())) == Vi siblePosition(firstPositionInNode(element))
522 && VisiblePosition(lastPositionInNode(element->parentNode())) == Vis iblePosition(lastPositionInNode(element))) { 523 && VisiblePosition(lastPositionInNode(element->parentNode())) == Vis iblePosition(lastPositionInNode(element))) {
523 insertedNodes.willRemoveNodePreservingChildren(*element); 524 insertedNodes.willRemoveNodePreservingChildren(*element);
524 removeNodePreservingChildren(element); 525 removeNodePreservingChildren(element);
525 continue; 526 continue;
526 } 527 }
527 528
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 // Remove block properties in the span's style. This prevents properties tha t probably have no effect 782 // Remove block properties in the span's style. This prevents properties tha t probably have no effect
782 // currently from affecting blocks later if the style is cloned for a new bl ock element during a future 783 // currently from affecting blocks later if the style is cloned for a new bl ock element during a future
783 // editing operation. 784 // editing operation.
784 // FIXME: They *can* have an effect currently if blocks beneath the style sp an aren't individually marked 785 // FIXME: They *can* have an effect currently if blocks beneath the style sp an aren't individually marked
785 // with block styles by the editing engine used to style them. WebKit doesn 't do this, but others might. 786 // with block styles by the editing engine used to style them. WebKit doesn 't do this, but others might.
786 style->removeBlockProperties(); 787 style->removeBlockProperties();
787 788
788 if (style->isEmpty() || !wrappingStyleSpan->firstChild()) { 789 if (style->isEmpty() || !wrappingStyleSpan->firstChild()) {
789 insertedNodes.willRemoveNodePreservingChildren(*wrappingStyleSpan); 790 insertedNodes.willRemoveNodePreservingChildren(*wrappingStyleSpan);
790 removeNodePreservingChildren(wrappingStyleSpan); 791 removeNodePreservingChildren(wrappingStyleSpan);
791 } else 792 } else {
792 setNodeAttribute(wrappingStyleSpan, styleAttr, style->style()->asText()) ; 793 setNodeAttribute(wrappingStyleSpan, styleAttr, AtomicString(style->style ()->asText()));
794 }
793 } 795 }
794 796
795 void ReplaceSelectionCommand::mergeEndIfNeeded() 797 void ReplaceSelectionCommand::mergeEndIfNeeded()
796 { 798 {
797 if (!m_shouldMergeEnd) 799 if (!m_shouldMergeEnd)
798 return; 800 return;
799 801
800 VisiblePosition startOfInsertedContent(positionAtStartOfInsertedContent()); 802 VisiblePosition startOfInsertedContent(positionAtStartOfInsertedContent());
801 VisiblePosition endOfInsertedContent(positionAtEndOfInsertedContent()); 803 VisiblePosition endOfInsertedContent(positionAtEndOfInsertedContent());
802 804
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); 1494 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get());
1493 1495
1494 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d); 1496 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d);
1495 1497
1496 setEndingSelection(selectionAfterReplace); 1498 setEndingSelection(selectionAfterReplace);
1497 1499
1498 return true; 1500 return true;
1499 } 1501 }
1500 1502
1501 } // namespace WebCore 1503 } // namespace WebCore
OLDNEW
« Source/core/editing/ApplyStyleCommand.cpp ('K') | « Source/core/editing/EditorCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698