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

Side by Side Diff: Source/core/dom/Element.cpp

Issue 229213002: Make HTMLCollection / NodeList backward traversal consistent with forward one (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 1846
1847 // We also have to handle node removal. 1847 // We also have to handle node removal.
1848 if (childCountDelta < 0 && newFirstChild == firstElementAfterInsertion & & newFirstChild && (!newFirstChildStyle || !newFirstChildStyle->firstChildState( ))) 1848 if (childCountDelta < 0 && newFirstChild == firstElementAfterInsertion & & newFirstChild && (!newFirstChildStyle || !newFirstChildStyle->firstChildState( )))
1849 newFirstChild->setNeedsStyleRecalc(SubtreeStyleChange); 1849 newFirstChild->setNeedsStyleRecalc(SubtreeStyleChange);
1850 } 1850 }
1851 1851
1852 // :last-child. In the parser callback case, we don't have to check anythin g, since we were right the first time. 1852 // :last-child. In the parser callback case, we don't have to check anythin g, since we were right the first time.
1853 // In the DOM case, we only need to do something if |afterChange| is not 0. 1853 // In the DOM case, we only need to do something if |afterChange| is not 0.
1854 if (childrenAffectedByLastChildRules() && beforeChange) { 1854 if (childrenAffectedByLastChildRules() && beforeChange) {
1855 // Find our new last child. 1855 // Find our new last child.
1856 Node* newLastChild = ElementTraversal::lastWithin(*this); 1856 Node* newLastChild = ElementTraversal::lastChild(*this);
1857 RenderStyle* newLastChildStyle = newLastChild ? newLastChild->renderStyl e() : 0; 1857 RenderStyle* newLastChildStyle = newLastChild ? newLastChild->renderStyl e() : 0;
1858 1858
1859 // Find the last element node going backwards from |beforeChange| 1859 // Find the last element node going backwards from |beforeChange|
1860 Node* lastElementBeforeInsertion = beforeChange->isElementNode() ? befor eChange : ElementTraversal::previousSibling(*beforeChange); 1860 Node* lastElementBeforeInsertion = beforeChange->isElementNode() ? befor eChange : ElementTraversal::previousSibling(*beforeChange);
1861 RenderStyle* lastElementBeforeInsertionStyle = lastElementBeforeInsertio n ? lastElementBeforeInsertion->renderStyle() : 0; 1861 RenderStyle* lastElementBeforeInsertionStyle = lastElementBeforeInsertio n ? lastElementBeforeInsertion->renderStyle() : 0;
1862 1862
1863 if (newLastChild != lastElementBeforeInsertion && lastElementBeforeInser tionStyle && lastElementBeforeInsertionStyle->lastChildState()) 1863 if (newLastChild != lastElementBeforeInsertion && lastElementBeforeInser tionStyle && lastElementBeforeInsertionStyle->lastChildState())
1864 lastElementBeforeInsertion->setNeedsStyleRecalc(SubtreeStyleChange); 1864 lastElementBeforeInsertion->setNeedsStyleRecalc(SubtreeStyleChange);
1865 1865
1866 // We also have to handle node removal. The parser callback case is sim ilar to node removal as well in that we need to change the last child 1866 // We also have to handle node removal. The parser callback case is sim ilar to node removal as well in that we need to change the last child
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
3353 || isHTMLObjectElement(*this) 3353 || isHTMLObjectElement(*this)
3354 || isHTMLAppletElement(*this) 3354 || isHTMLAppletElement(*this)
3355 || isHTMLCanvasElement(*this)) 3355 || isHTMLCanvasElement(*this))
3356 return false; 3356 return false;
3357 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3357 if (FullscreenElementStack::isActiveFullScreenElement(this))
3358 return false; 3358 return false;
3359 return true; 3359 return true;
3360 } 3360 }
3361 3361
3362 } // namespace WebCore 3362 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698