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

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

Issue 239703007: Rename Node::lastDescendant() / Node::highestAncestor() for clarity (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename highestAncestor() as well Created 6 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/Node.cpp ('k') | Source/core/editing/DeleteSelectionCommand.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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 VisiblePosition visibleStart(start); 248 VisiblePosition visibleStart(start);
249 VisiblePosition visibleEnd(end); 249 VisiblePosition visibleEnd(end);
250 250
251 if (visibleStart.isNull() || visibleStart.isOrphan() || visibleEnd.isNull() || visibleEnd.isOrphan()) 251 if (visibleStart.isNull() || visibleStart.isOrphan() || visibleEnd.isNull() || visibleEnd.isOrphan())
252 return; 252 return;
253 253
254 // Save and restore the selection endpoints using their indices in the docum ent, since 254 // Save and restore the selection endpoints using their indices in the docum ent, since
255 // addBlockStyleIfNeeded may moveParagraphs, which can remove these endpoint s. 255 // addBlockStyleIfNeeded may moveParagraphs, which can remove these endpoint s.
256 // Calculate start and end indices from the start of the tree that they're i n. 256 // Calculate start and end indices from the start of the tree that they're i n.
257 Node& scope = visibleStart.deepEquivalent().deprecatedNode()->highestAncesto r(); 257 Node& scope = visibleStart.deepEquivalent().deprecatedNode()->highestAncesto rOrSelf();
258 RefPtrWillBeRawPtr<Range> startRange = Range::create(document(), firstPositi onInNode(&scope), visibleStart.deepEquivalent().parentAnchoredEquivalent()); 258 RefPtrWillBeRawPtr<Range> startRange = Range::create(document(), firstPositi onInNode(&scope), visibleStart.deepEquivalent().parentAnchoredEquivalent());
259 RefPtrWillBeRawPtr<Range> endRange = Range::create(document(), firstPosition InNode(&scope), visibleEnd.deepEquivalent().parentAnchoredEquivalent()); 259 RefPtrWillBeRawPtr<Range> endRange = Range::create(document(), firstPosition InNode(&scope), visibleEnd.deepEquivalent().parentAnchoredEquivalent());
260 int startIndex = TextIterator::rangeLength(startRange.get(), true); 260 int startIndex = TextIterator::rangeLength(startRange.get(), true);
261 int endIndex = TextIterator::rangeLength(endRange.get(), true); 261 int endIndex = TextIterator::rangeLength(endRange.get(), true);
262 262
263 VisiblePosition paragraphStart(startOfParagraph(visibleStart)); 263 VisiblePosition paragraphStart(startOfParagraph(visibleStart));
264 VisiblePosition nextParagraphStart(endOfParagraph(paragraphStart).next()); 264 VisiblePosition nextParagraphStart(endOfParagraph(paragraphStart).next());
265 VisiblePosition beyondEnd(endOfParagraph(visibleEnd).next()); 265 VisiblePosition beyondEnd(endOfParagraph(visibleEnd).next());
266 while (paragraphStart.isNotNull() && paragraphStart != beyondEnd) { 266 while (paragraphStart.isNotNull() && paragraphStart != beyondEnd) {
267 StyleChange styleChange(style, paragraphStart.deepEquivalent()); 267 StyleChange styleChange(style, paragraphStart.deepEquivalent());
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 String textToMove = nextText->data(); 1543 String textToMove = nextText->data();
1544 insertTextIntoNode(childText, childText->length(), textToMove); 1544 insertTextIntoNode(childText, childText->length(), textToMove);
1545 removeNode(next); 1545 removeNode(next);
1546 // don't move child node pointer. it may want to merge with more text no des. 1546 // don't move child node pointer. it may want to merge with more text no des.
1547 } 1547 }
1548 1548
1549 updateStartEnd(newStart, newEnd); 1549 updateStartEnd(newStart, newEnd);
1550 } 1550 }
1551 1551
1552 } 1552 }
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/editing/DeleteSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698