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

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

Issue 1041463003: Remove methods of TextIterator that take Range objects (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add assertions Created 5 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/DocumentMarkerController.cpp ('k') | Source/core/editing/PlainTextRange.cpp » ('j') | 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 if (visibleStart.isNull() || visibleStart.isOrphan() || visibleEnd.isNull() || visibleEnd.isOrphan()) 256 if (visibleStart.isNull() || visibleStart.isOrphan() || visibleEnd.isNull() || visibleEnd.isOrphan())
257 return; 257 return;
258 258
259 // Save and restore the selection endpoints using their indices in the docum ent, since 259 // Save and restore the selection endpoints using their indices in the docum ent, since
260 // addBlockStyleIfNeeded may moveParagraphs, which can remove these endpoint s. 260 // addBlockStyleIfNeeded may moveParagraphs, which can remove these endpoint s.
261 // Calculate start and end indices from the start of the tree that they're i n. 261 // Calculate start and end indices from the start of the tree that they're i n.
262 Node& scope = NodeTraversal::highestAncestorOrSelf(*visibleStart.deepEquival ent().deprecatedNode()); 262 Node& scope = NodeTraversal::highestAncestorOrSelf(*visibleStart.deepEquival ent().deprecatedNode());
263 RefPtrWillBeRawPtr<Range> startRange = Range::create(document(), firstPositi onInNode(&scope), visibleStart.deepEquivalent().parentAnchoredEquivalent()); 263 RefPtrWillBeRawPtr<Range> startRange = Range::create(document(), firstPositi onInNode(&scope), visibleStart.deepEquivalent().parentAnchoredEquivalent());
264 RefPtrWillBeRawPtr<Range> endRange = Range::create(document(), firstPosition InNode(&scope), visibleEnd.deepEquivalent().parentAnchoredEquivalent()); 264 RefPtrWillBeRawPtr<Range> endRange = Range::create(document(), firstPosition InNode(&scope), visibleEnd.deepEquivalent().parentAnchoredEquivalent());
265 int startIndex = TextIterator::rangeLength(startRange.get(), true); 265 int startIndex = TextIterator::rangeLength(startRange->startPosition(), star tRange->endPosition(), true);
266 int endIndex = TextIterator::rangeLength(endRange.get(), true); 266 int endIndex = TextIterator::rangeLength(endRange->startPosition(), endRange ->endPosition(), true);
267 267
268 VisiblePosition paragraphStart(startOfParagraph(visibleStart)); 268 VisiblePosition paragraphStart(startOfParagraph(visibleStart));
269 VisiblePosition nextParagraphStart(endOfParagraph(paragraphStart).next()); 269 VisiblePosition nextParagraphStart(endOfParagraph(paragraphStart).next());
270 VisiblePosition beyondEnd(endOfParagraph(visibleEnd).next()); 270 VisiblePosition beyondEnd(endOfParagraph(visibleEnd).next());
271 while (paragraphStart.isNotNull() && paragraphStart != beyondEnd) { 271 while (paragraphStart.isNotNull() && paragraphStart != beyondEnd) {
272 StyleChange styleChange(style, paragraphStart.deepEquivalent()); 272 StyleChange styleChange(style, paragraphStart.deepEquivalent());
273 if (styleChange.cssStyle().length() || m_removeOnly) { 273 if (styleChange.cssStyle().length() || m_removeOnly) {
274 RefPtrWillBeRawPtr<Element> block = enclosingBlock(paragraphStart.de epEquivalent().deprecatedNode()); 274 RefPtrWillBeRawPtr<Element> block = enclosingBlock(paragraphStart.de epEquivalent().deprecatedNode());
275 const Position& paragraphStartToMove = paragraphStart.deepEquivalent (); 275 const Position& paragraphStartToMove = paragraphStart.deepEquivalent ();
276 if (!m_removeOnly && isEditablePosition(paragraphStartToMove)) { 276 if (!m_removeOnly && isEditablePosition(paragraphStartToMove)) {
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 DEFINE_TRACE(ApplyStyleCommand) 1586 DEFINE_TRACE(ApplyStyleCommand)
1587 { 1587 {
1588 visitor->trace(m_style); 1588 visitor->trace(m_style);
1589 visitor->trace(m_start); 1589 visitor->trace(m_start);
1590 visitor->trace(m_end); 1590 visitor->trace(m_end);
1591 visitor->trace(m_styledInlineElement); 1591 visitor->trace(m_styledInlineElement);
1592 CompositeEditCommand::trace(visitor); 1592 CompositeEditCommand::trace(visitor);
1593 } 1593 }
1594 1594
1595 } 1595 }
OLDNEW
« no previous file with comments | « Source/core/dom/DocumentMarkerController.cpp ('k') | Source/core/editing/PlainTextRange.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698