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

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

Issue 1675163002: Rename ComposedTree to FlatTree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip Created 4 years, 10 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
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 template<typename EditingStrategy> 62 template<typename EditingStrategy>
63 static bool handleSelectionBoundary(const Node&); 63 static bool handleSelectionBoundary(const Node&);
64 64
65 template<> 65 template<>
66 bool handleSelectionBoundary<EditingStrategy>(const Node&) 66 bool handleSelectionBoundary<EditingStrategy>(const Node&)
67 { 67 {
68 return false; 68 return false;
69 } 69 }
70 70
71 template<> 71 template<>
72 bool handleSelectionBoundary<EditingInComposedTreeStrategy>(const Node& node) 72 bool handleSelectionBoundary<EditingInFlatTreeStrategy>(const Node& node)
73 { 73 {
74 if (!node.isElementNode()) 74 if (!node.isElementNode())
75 return false; 75 return false;
76 ElementShadow* shadow = toElement(node).shadow(); 76 ElementShadow* shadow = toElement(node).shadow();
77 if (!shadow) 77 if (!shadow)
78 return false; 78 return false;
79 return shadow->youngestShadowRoot().type() == ShadowRootType::UserAgent; 79 return shadow->youngestShadowRoot().type() == ShadowRootType::UserAgent;
80 } 80 }
81 81
82 } // namespace 82 } // namespace
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 278 }
279 279
280 template<typename Strategy> 280 template<typename Strategy>
281 Node* StyledMarkupTraverser<Strategy>::traverse(Node* startNode, Node* pastEnd) 281 Node* StyledMarkupTraverser<Strategy>::traverse(Node* startNode, Node* pastEnd)
282 { 282 {
283 WillBeHeapVector<RawPtrWillBeMember<ContainerNode>> ancestorsToClose; 283 WillBeHeapVector<RawPtrWillBeMember<ContainerNode>> ancestorsToClose;
284 Node* next; 284 Node* next;
285 Node* lastClosed = nullptr; 285 Node* lastClosed = nullptr;
286 for (Node* n = startNode; n && n != pastEnd; n = next) { 286 for (Node* n = startNode; n && n != pastEnd; n = next) {
287 // If |n| is a selection boundary such as <input>, traverse the child 287 // If |n| is a selection boundary such as <input>, traverse the child
288 // nodes in the DOM tree instead of the composed tree. 288 // nodes in the DOM tree instead of the flat tree.
289 if (handleSelectionBoundary<Strategy>(*n)) { 289 if (handleSelectionBoundary<Strategy>(*n)) {
290 lastClosed = StyledMarkupTraverser<EditingStrategy>(m_accumulator, m _lastClosed.get()).traverse(n, EditingStrategy::nextSkippingChildren(*n)); 290 lastClosed = StyledMarkupTraverser<EditingStrategy>(m_accumulator, m _lastClosed.get()).traverse(n, EditingStrategy::nextSkippingChildren(*n));
291 next = EditingInComposedTreeStrategy::nextSkippingChildren(*n); 291 next = EditingInFlatTreeStrategy::nextSkippingChildren(*n);
292 } else { 292 } else {
293 next = Strategy::next(*n); 293 next = Strategy::next(*n);
294 if (isEnclosingBlock(n) && canHaveChildrenForEditing(n) && next == p astEnd) { 294 if (isEnclosingBlock(n) && canHaveChildrenForEditing(n) && next == p astEnd) {
295 // Don't write out empty block containers that aren't fully sele cted. 295 // Don't write out empty block containers that aren't fully sele cted.
296 continue; 296 continue;
297 } 297 }
298 298
299 if (!n->layoutObject() && !enclosingElementWithTag(firstPositionInOr BeforeNode(n), selectTag)) { 299 if (!n->layoutObject() && !enclosingElementWithTag(firstPositionInOr BeforeNode(n), selectTag)) {
300 next = Strategy::nextSkippingChildren(*n); 300 next = Strategy::nextSkippingChildren(*n);
301 // Don't skip over pastEnd. 301 // Don't skip over pastEnd.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 if (element.isStyledElement() && element.inlineStyle()) 471 if (element.isStyledElement() && element.inlineStyle())
472 inlineStyle->overrideWithStyle(element.inlineStyle()); 472 inlineStyle->overrideWithStyle(element.inlineStyle());
473 473
474 if (element.isHTMLElement() && shouldAnnotate()) 474 if (element.isHTMLElement() && shouldAnnotate())
475 inlineStyle->mergeStyleFromRulesForSerialization(&toHTMLElement(element) ); 475 inlineStyle->mergeStyleFromRulesForSerialization(&toHTMLElement(element) );
476 476
477 return inlineStyle; 477 return inlineStyle;
478 } 478 }
479 479
480 template class StyledMarkupSerializer<EditingStrategy>; 480 template class StyledMarkupSerializer<EditingStrategy>;
481 template class StyledMarkupSerializer<EditingInComposedTreeStrategy>; 481 template class StyledMarkupSerializer<EditingInFlatTreeStrategy>;
482 482
483 } // namespace blink 483 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698