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

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

Issue 1328493002: Move static member function normalizeRange() out from VisibleSelection (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-01T16:34:49 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.cpp ('k') | no next file » | 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // positions rather than first node and last node in selection. 188 // positions rather than first node and last node in selection.
189 Node* commonAncestor = Strategy::commonAncestor(*startPosition.computeContai nerNode(), *endPosition.computeContainerNode()); 189 Node* commonAncestor = Strategy::commonAncestor(*startPosition.computeContai nerNode(), *endPosition.computeContainerNode());
190 ASSERT(commonAncestor); 190 ASSERT(commonAncestor);
191 HTMLElement* specialCommonAncestor = nullptr; 191 HTMLElement* specialCommonAncestor = nullptr;
192 if (shouldAnnotate == AnnotateForInterchange) { 192 if (shouldAnnotate == AnnotateForInterchange) {
193 // Include ancestors that aren't completely inside the range but are req uired to retain 193 // Include ancestors that aren't completely inside the range but are req uired to retain
194 // the structure and appearance of the copied markup. 194 // the structure and appearance of the copied markup.
195 specialCommonAncestor = ancestorToRetainStructureAndAppearance(commonAnc estor); 195 specialCommonAncestor = ancestorToRetainStructureAndAppearance(commonAnc estor);
196 if (Node* parentListNode = enclosingNodeOfType(firstPositionInOrBeforeNo de(firstNode), isListItem)) { 196 if (Node* parentListNode = enclosingNodeOfType(firstPositionInOrBeforeNo de(firstNode), isListItem)) {
197 EphemeralRangeTemplate<Strategy> markupRange = EphemeralRangeTemplat e<Strategy>(startPosition, endPosition); 197 EphemeralRangeTemplate<Strategy> markupRange = EphemeralRangeTemplat e<Strategy>(startPosition, endPosition);
198 EphemeralRangeTemplate<Strategy> nodeRange = VisibleSelection::norma lizeRange(EphemeralRangeTemplate<Strategy>::rangeOfContents(*parentListNode)); 198 EphemeralRangeTemplate<Strategy> nodeRange = normalizeRange(Ephemera lRangeTemplate<Strategy>::rangeOfContents(*parentListNode));
199 if (nodeRange == markupRange) { 199 if (nodeRange == markupRange) {
200 ContainerNode* ancestor = parentListNode->parentNode(); 200 ContainerNode* ancestor = parentListNode->parentNode();
201 while (ancestor && !isHTMLListElement(ancestor)) 201 while (ancestor && !isHTMLListElement(ancestor))
202 ancestor = ancestor->parentNode(); 202 ancestor = ancestor->parentNode();
203 specialCommonAncestor = toHTMLElement(ancestor); 203 specialCommonAncestor = toHTMLElement(ancestor);
204 } 204 }
205 } 205 }
206 206
207 // Retain the Mail quote level by including all ancestor mail block quot es. 207 // Retain the Mail quote level by including all ancestor mail block quot es.
208 if (HTMLQuoteElement* highestMailBlockquote = toHTMLQuoteElement(highest EnclosingNodeOfType(firstPositionInOrBeforeNode(firstNode), isMailHTMLBlockquote Element, CanCrossEditingBoundary))) 208 if (HTMLQuoteElement* highestMailBlockquote = toHTMLQuoteElement(highest EnclosingNodeOfType(firstPositionInOrBeforeNode(firstNode), isMailHTMLBlockquote Element, CanCrossEditingBoundary)))
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 RefPtrWillBeRawPtr<Text> textNext = toText(next); 705 RefPtrWillBeRawPtr<Text> textNext = toText(next);
706 textNode->appendData(textNext->data()); 706 textNode->appendData(textNext->data());
707 if (textNext->parentNode()) // Might have been removed by mutation event. 707 if (textNext->parentNode()) // Might have been removed by mutation event.
708 textNext->remove(exceptionState); 708 textNext->remove(exceptionState);
709 } 709 }
710 710
711 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>; 711 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>;
712 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingInComposedTreeS trategy>; 712 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingInComposedTreeS trategy>;
713 713
714 } 714 }
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleSelection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698