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

Side by Side Diff: Source/core/dom/shadow/InsertionPoint.cpp

Issue 476273004: Use Traversal<>::firstAncestor() API more in the code base (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/accessibility/AXNodeObject.cpp ('k') | Source/core/html/HTMLAreaElement.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 bool InsertionPoint::shouldUseFallbackElements() const 129 bool InsertionPoint::shouldUseFallbackElements() const
130 { 130 {
131 return isActive() && !hasDistribution(); 131 return isActive() && !hasDistribution();
132 } 132 }
133 133
134 bool InsertionPoint::canBeActive() const 134 bool InsertionPoint::canBeActive() const
135 { 135 {
136 if (!isInShadowTree()) 136 if (!isInShadowTree())
137 return false; 137 return false;
138 for (Node* node = parentNode(); node; node = node->parentNode()) { 138 return !Traversal<InsertionPoint>::firstAncestor(*this);
139 if (node->isInsertionPoint())
140 return false;
141 }
142 return true;
143 } 139 }
144 140
145 bool InsertionPoint::isActive() const 141 bool InsertionPoint::isActive() const
146 { 142 {
147 if (!canBeActive()) 143 if (!canBeActive())
148 return false; 144 return false;
149 ShadowRoot* shadowRoot = containingShadowRoot(); 145 ShadowRoot* shadowRoot = containingShadowRoot();
150 if (!shadowRoot) 146 if (!shadowRoot)
151 return false; 147 return false;
152 if (!isHTMLShadowElement(*this) || shadowRoot->descendantShadowElementCount( ) <= 1) 148 if (!isHTMLShadowElement(*this) || shadowRoot->descendantShadowElementCount( ) <= 1)
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 if (!insertionPoints) 282 if (!insertionPoints)
287 return; 283 return;
288 for (size_t i = 0; i < insertionPoints->size(); ++i) 284 for (size_t i = 0; i < insertionPoints->size(); ++i)
289 results.append(insertionPoints->at(i).get()); 285 results.append(insertionPoints->at(i).get());
290 ASSERT(current != insertionPoints->last().get()); 286 ASSERT(current != insertionPoints->last().get());
291 current = insertionPoints->last().get(); 287 current = insertionPoints->last().get();
292 } 288 }
293 } 289 }
294 290
295 } // namespace blink 291 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/accessibility/AXNodeObject.cpp ('k') | Source/core/html/HTMLAreaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698