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

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

Issue 198783003: Recalc sibling styles for forward positional rules on mutations only. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed review issue. Created 6 years, 9 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/dom/Element.h ('k') | Source/core/dom/ElementRareData.h » ('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) 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 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 return; 1841 return;
1842 1842
1843 RenderStyle* style = renderStyle(); 1843 RenderStyle* style = renderStyle();
1844 1844
1845 // :empty selector. 1845 // :empty selector.
1846 checkForEmptyStyleChange(style); 1846 checkForEmptyStyleChange(style);
1847 1847
1848 if (!style || (needsStyleRecalc() && childrenAffectedByPositionalRules())) 1848 if (!style || (needsStyleRecalc() && childrenAffectedByPositionalRules()))
1849 return; 1849 return;
1850 1850
1851 // Forward positional selectors include the ~ selector, nth-child, nth-of-ty pe, first-of-type and only-of-type. 1851 // Forward positional selectors include nth-child, nth-of-type, first-of-typ e and only-of-type.
1852 // The indirect adjacent selector is the ~ selector.
1852 // Backward positional selectors include nth-last-child, nth-last-of-type, l ast-of-type and only-of-type. 1853 // Backward positional selectors include nth-last-child, nth-last-of-type, l ast-of-type and only-of-type.
1853 // We have to invalidate everything following the insertion point in the for ward case, and everything before the insertion point in the 1854 // We have to invalidate everything following the insertion point in the for ward and indirect adjacent case,
1854 // backward case. 1855 // and everything before the insertion point in the backward case.
1855 // |afterChange| is 0 in the parser callback case, so we won't do any work f or the forward case if we don't have to. 1856 // |afterChange| is 0 in the parser callback case, so we won't do any work f or the forward case if we don't have to.
1856 // For performance reasons we just mark the parent node as changed, since we don't want to make childrenChanged O(n^2) by crawling all our kids 1857 // For performance reasons we just mark the parent node as changed, since we don't want to make childrenChanged O(n^2) by crawling all our kids
1857 // here. recalcStyle will then force a walk of the children when it sees tha t this has happened. 1858 // here. recalcStyle will then force a walk of the children when it sees tha t this has happened.
1858 if ((childrenAffectedByForwardPositionalRules() && afterChange) || (children AffectedByBackwardPositionalRules() && beforeChange)) { 1859 if (((childrenAffectedByForwardPositionalRules() || childrenAffectedByIndire ctAdjacentRules()) && afterChange)
1860 || (childrenAffectedByBackwardPositionalRules() && beforeChange)) {
1859 setNeedsStyleRecalc(SubtreeStyleChange); 1861 setNeedsStyleRecalc(SubtreeStyleChange);
1860 return; 1862 return;
1861 } 1863 }
1862 1864
1863 // :first-child. In the parser callback case, we don't have to check anythi ng, since we were right the first time. 1865 // :first-child. In the parser callback case, we don't have to check anythi ng, since we were right the first time.
1864 // In the DOM case, we only need to do something if |afterChange| is not 0. 1866 // In the DOM case, we only need to do something if |afterChange| is not 0.
1865 // |afterChange| is 0 in the parser case, so it works out that we'll skip th is block. 1867 // |afterChange| is 0 in the parser case, so it works out that we'll skip th is block.
1866 if (childrenAffectedByFirstChildRules() && afterChange) { 1868 if (childrenAffectedByFirstChildRules() && afterChange) {
1867 // Find our new first child. 1869 // Find our new first child.
1868 Element* newFirstChild = ElementTraversal::firstWithin(*this); 1870 Element* newFirstChild = ElementTraversal::firstWithin(*this);
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
3399 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems 3401 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems
3400 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 3402 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405
3401 if (isHTMLOptionElement(*this) || isHTMLOptGroupElement(*this)) 3403 if (isHTMLOptionElement(*this) || isHTMLOptGroupElement(*this))
3402 return false; 3404 return false;
3403 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3405 if (FullscreenElementStack::isActiveFullScreenElement(this))
3404 return false; 3406 return false;
3405 return true; 3407 return true;
3406 } 3408 }
3407 3409
3408 } // namespace WebCore 3410 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/ElementRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698