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

Side by Side Diff: Source/core/editing/serializers/StyledMarkupSerializer.cpp

Issue 1319753004: Introduce composed tree version of VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-07T14:06:02 Rebase for VisibleSelectionChangeObserver and PendingSelection::commit Created 5 years, 3 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
« no previous file with comments | « Source/core/editing/VisibleSelection.h ('k') | Source/core/layout/PendingSelection.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) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved.
4 * Copyright (C) 2011 Igalia S.L. 4 * Copyright (C) 2011 Igalia S.L.
5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 168 }
169 169
170 template<typename Strategy> 170 template<typename Strategy>
171 String StyledMarkupSerializer<Strategy>::createMarkup() 171 String StyledMarkupSerializer<Strategy>::createMarkup()
172 { 172 {
173 StyledMarkupAccumulator markupAccumulator(m_shouldResolveURLs, toTextOffset( m_start.parentAnchoredEquivalent()), toTextOffset(m_end.parentAnchoredEquivalent ()), m_start.document(), m_shouldAnnotate, m_convertBlocksToInlines); 173 StyledMarkupAccumulator markupAccumulator(m_shouldResolveURLs, toTextOffset( m_start.parentAnchoredEquivalent()), toTextOffset(m_end.parentAnchoredEquivalent ()), m_start.document(), m_shouldAnnotate, m_convertBlocksToInlines);
174 174
175 Node* pastEnd = m_end.nodeAsRangePastLastNode(); 175 Node* pastEnd = m_end.nodeAsRangePastLastNode();
176 176
177 Node* firstNode = m_start.nodeAsRangeFirstNode(); 177 Node* firstNode = m_start.nodeAsRangeFirstNode();
178 VisiblePosition visibleStart = createVisiblePosition(m_start); 178 VisiblePosition visibleStart = createVisiblePositionInDOMTree(m_start);
179 VisiblePosition visibleEnd = createVisiblePosition(m_end); 179 VisiblePosition visibleEnd = createVisiblePositionInDOMTree(m_end);
180 if (shouldAnnotate() && needInterchangeNewlineAfter(visibleStart)) { 180 if (shouldAnnotate() && needInterchangeNewlineAfter(visibleStart)) {
181 markupAccumulator.appendInterchangeNewline(); 181 markupAccumulator.appendInterchangeNewline();
182 if (visibleStart.deepEquivalent() == previousPositionOf(visibleEnd).deep Equivalent()) 182 if (visibleStart.deepEquivalent() == previousPositionOf(visibleEnd).deep Equivalent())
183 return markupAccumulator.takeResults(); 183 return markupAccumulator.takeResults();
184 184
185 firstNode = nextPositionOf(visibleStart).deepEquivalent().anchorNode(); 185 firstNode = nextPositionOf(visibleStart).deepEquivalent().anchorNode();
186 186
187 if (pastEnd && PositionAlgorithm<Strategy>::beforeNode(firstNode).compar eTo(PositionAlgorithm<Strategy>::beforeNode(pastEnd)) >= 0) { 187 if (pastEnd && PositionAlgorithm<Strategy>::beforeNode(firstNode).compar eTo(PositionAlgorithm<Strategy>::beforeNode(pastEnd)) >= 0) {
188 // This condition hits in editing/pasteboard/copy-display-none.html. 188 // This condition hits in editing/pasteboard/copy-display-none.html.
189 return markupAccumulator.takeResults(); 189 return markupAccumulator.takeResults();
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 if (element.isHTMLElement() && shouldAnnotate()) 475 if (element.isHTMLElement() && shouldAnnotate())
476 inlineStyle->mergeStyleFromRulesForSerialization(&toHTMLElement(element) ); 476 inlineStyle->mergeStyleFromRulesForSerialization(&toHTMLElement(element) );
477 477
478 return inlineStyle; 478 return inlineStyle;
479 } 479 }
480 480
481 template class StyledMarkupSerializer<EditingStrategy>; 481 template class StyledMarkupSerializer<EditingStrategy>;
482 template class StyledMarkupSerializer<EditingInComposedTreeStrategy>; 482 template class StyledMarkupSerializer<EditingInComposedTreeStrategy>;
483 483
484 } // namespace blink 484 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleSelection.h ('k') | Source/core/layout/PendingSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698