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

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

Issue 425383002: Move highestAncestorOrSelf() from Node to NodeTraversal (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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/NodeTraversal.h ('k') | Source/core/html/FormAssociatedElement.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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 VisiblePosition visibleStart(start); 252 VisiblePosition visibleStart(start);
253 VisiblePosition visibleEnd(end); 253 VisiblePosition visibleEnd(end);
254 254
255 if (visibleStart.isNull() || visibleStart.isOrphan() || visibleEnd.isNull() || visibleEnd.isOrphan()) 255 if (visibleStart.isNull() || visibleStart.isOrphan() || visibleEnd.isNull() || visibleEnd.isOrphan())
256 return; 256 return;
257 257
258 // Save and restore the selection endpoints using their indices in the docum ent, since 258 // Save and restore the selection endpoints using their indices in the docum ent, since
259 // addBlockStyleIfNeeded may moveParagraphs, which can remove these endpoint s. 259 // addBlockStyleIfNeeded may moveParagraphs, which can remove these endpoint s.
260 // Calculate start and end indices from the start of the tree that they're i n. 260 // Calculate start and end indices from the start of the tree that they're i n.
261 Node& scope = visibleStart.deepEquivalent().deprecatedNode()->highestAncesto rOrSelf(); 261 Node& scope = NodeTraversal::highestAncestorOrSelf(*visibleStart.deepEquival ent().deprecatedNode());
262 RefPtrWillBeRawPtr<Range> startRange = Range::create(document(), firstPositi onInNode(&scope), visibleStart.deepEquivalent().parentAnchoredEquivalent()); 262 RefPtrWillBeRawPtr<Range> startRange = Range::create(document(), firstPositi onInNode(&scope), visibleStart.deepEquivalent().parentAnchoredEquivalent());
263 RefPtrWillBeRawPtr<Range> endRange = Range::create(document(), firstPosition InNode(&scope), visibleEnd.deepEquivalent().parentAnchoredEquivalent()); 263 RefPtrWillBeRawPtr<Range> endRange = Range::create(document(), firstPosition InNode(&scope), visibleEnd.deepEquivalent().parentAnchoredEquivalent());
264 int startIndex = TextIterator::rangeLength(startRange.get(), true); 264 int startIndex = TextIterator::rangeLength(startRange.get(), true);
265 int endIndex = TextIterator::rangeLength(endRange.get(), true); 265 int endIndex = TextIterator::rangeLength(endRange.get(), true);
266 266
267 VisiblePosition paragraphStart(startOfParagraph(visibleStart)); 267 VisiblePosition paragraphStart(startOfParagraph(visibleStart));
268 VisiblePosition nextParagraphStart(endOfParagraph(paragraphStart).next()); 268 VisiblePosition nextParagraphStart(endOfParagraph(paragraphStart).next());
269 VisiblePosition beyondEnd(endOfParagraph(visibleEnd).next()); 269 VisiblePosition beyondEnd(endOfParagraph(visibleEnd).next());
270 while (paragraphStart.isNotNull() && paragraphStart != beyondEnd) { 270 while (paragraphStart.isNotNull() && paragraphStart != beyondEnd) {
271 StyleChange styleChange(style, paragraphStart.deepEquivalent()); 271 StyleChange styleChange(style, paragraphStart.deepEquivalent());
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 void ApplyStyleCommand::trace(Visitor* visitor) 1571 void ApplyStyleCommand::trace(Visitor* visitor)
1572 { 1572 {
1573 visitor->trace(m_style); 1573 visitor->trace(m_style);
1574 visitor->trace(m_start); 1574 visitor->trace(m_start);
1575 visitor->trace(m_end); 1575 visitor->trace(m_end);
1576 visitor->trace(m_styledInlineElement); 1576 visitor->trace(m_styledInlineElement);
1577 CompositeEditCommand::trace(visitor); 1577 CompositeEditCommand::trace(visitor);
1578 } 1578 }
1579 1579
1580 } 1580 }
OLDNEW
« no previous file with comments | « Source/core/dom/NodeTraversal.h ('k') | Source/core/html/FormAssociatedElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698