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

Unified Diff: Source/core/dom/NodeRenderingTraversal.h

Issue 14731014: Added another guard to the NodeRenderingContext::nextSibling() fast path and its twin. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/dom/shadow/content-element-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/NodeRenderingTraversal.h
diff --git a/Source/core/dom/NodeRenderingTraversal.h b/Source/core/dom/NodeRenderingTraversal.h
index 3d7fa11a46cdfabd57b022b785a1fed0f658753c..6fb020d33fac98f566ce12ace2ae9dfd75e086bd 100644
--- a/Source/core/dom/NodeRenderingTraversal.h
+++ b/Source/core/dom/NodeRenderingTraversal.h
@@ -93,8 +93,11 @@ inline ContainerNode* parent(const Node* node, ParentDetails* details)
inline Node* nextSibling(const Node* node)
{
if (!node->needsShadowTreeWalker()) {
- ASSERT(nextSiblingSlow(node) == node->nextSibling());
- return node->nextSibling();
+ Node* next = node->nextSibling();
+ if (!next || !next->isInsertionPoint()) {
+ ASSERT(nextSiblingSlow(node) == next);
+ return next;
+ }
}
return nextSiblingSlow(node);
@@ -103,8 +106,11 @@ inline Node* nextSibling(const Node* node)
inline Node* previousSibling(const Node* node)
{
if (!node->needsShadowTreeWalker()) {
- ASSERT(previousSiblingSlow(node) == node->previousSibling());
- return node->previousSibling();
+ Node* prev = node->previousSibling();
+ if (!prev || !prev->isInsertionPoint()) {
+ ASSERT(previousSiblingSlow(node) == prev);
+ return prev;
+ }
}
return previousSiblingSlow(node);
« no previous file with comments | « LayoutTests/fast/dom/shadow/content-element-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698