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

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

Issue 2766163002: Pass nextTextSibling to ::before layout rebuild. (Closed)
Patch Set: Documentation fix. Created 3 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
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. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * (C) 2007 Eric Seidel (eric@webkit.org) 9 * (C) 2007 Eric Seidel (eric@webkit.org)
10 * 10 *
(...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 AttachContext reattachContext; 2030 AttachContext reattachContext;
2031 reattachContext.resolvedStyle = document().getNonAttachedStyle(*this); 2031 reattachContext.resolvedStyle = document().getNonAttachedStyle(*this);
2032 bool layoutObjectWillChange = needsAttach() || layoutObject(); 2032 bool layoutObjectWillChange = needsAttach() || layoutObject();
2033 reattachLayoutTree(reattachContext); 2033 reattachLayoutTree(reattachContext);
2034 if (layoutObjectWillChange || layoutObject()) 2034 if (layoutObjectWillChange || layoutObject())
2035 reattachWhitespaceSiblingsIfNeeded(nextTextSibling); 2035 reattachWhitespaceSiblingsIfNeeded(nextTextSibling);
2036 } else if (childNeedsReattachLayoutTree()) { 2036 } else if (childNeedsReattachLayoutTree()) {
2037 DCHECK(!needsReattachLayoutTree()); 2037 DCHECK(!needsReattachLayoutTree());
2038 SelectorFilterParentScope filterScope(*this); 2038 SelectorFilterParentScope filterScope(*this);
2039 StyleSharingDepthScope sharingScope(*this); 2039 StyleSharingDepthScope sharingScope(*this);
2040 reattachPseudoElementLayoutTree(PseudoIdBefore); 2040 Text* nextTextSibling = nullptr;
2041 rebuildShadowRootLayoutTree(); 2041 rebuildPseudoElementLayoutTree(PseudoIdAfter);
2042 rebuildChildrenLayoutTrees(); 2042 rebuildShadowRootLayoutTree(nextTextSibling);
2043 reattachPseudoElementLayoutTree(PseudoIdAfter); 2043 rebuildChildrenLayoutTrees(nextTextSibling);
2044 reattachPseudoElementLayoutTree(PseudoIdBackdrop); 2044 rebuildPseudoElementLayoutTree(PseudoIdBefore, nextTextSibling);
2045 reattachPseudoElementLayoutTree(PseudoIdFirstLetter); 2045 rebuildPseudoElementLayoutTree(PseudoIdBackdrop);
2046 rebuildPseudoElementLayoutTree(PseudoIdFirstLetter);
2046 } 2047 }
2047 DCHECK(!needsStyleRecalc()); 2048 DCHECK(!needsStyleRecalc());
2048 DCHECK(!childNeedsStyleRecalc()); 2049 DCHECK(!childNeedsStyleRecalc());
2049 DCHECK(!needsReattachLayoutTree()); 2050 DCHECK(!needsReattachLayoutTree());
2050 DCHECK(!childNeedsReattachLayoutTree()); 2051 DCHECK(!childNeedsReattachLayoutTree());
2051 } 2052 }
2052 2053
2053 void Element::rebuildShadowRootLayoutTree() { 2054 void Element::rebuildShadowRootLayoutTree(Text*& nextTextSibling) {
2054 for (ShadowRoot* root = youngestShadowRoot(); root; 2055 for (ShadowRoot* root = youngestShadowRoot(); root;
2055 root = root->olderShadowRoot()) { 2056 root = root->olderShadowRoot()) {
2056 if (root->needsReattachLayoutTree() || root->childNeedsReattachLayoutTree()) 2057 // TODO(rune@opera.com): nextTextSibling is not set correctly when we have
2057 root->rebuildLayoutTree(); 2058 // slotted nodes (crbug.com/648931). Also, it may be incorrect when we have
2059 // multiple shadow roots (for V0 shadow hosts).
2060 root->rebuildLayoutTree(nextTextSibling);
2058 } 2061 }
2059 } 2062 }
2060 2063
2061 void Element::reattachPseudoElementLayoutTree(PseudoId pseudoId) { 2064 void Element::rebuildPseudoElementLayoutTree(PseudoId pseudoId,
2065 Text* nextTextSibling) {
2062 if (PseudoElement* element = pseudoElement(pseudoId)) { 2066 if (PseudoElement* element = pseudoElement(pseudoId)) {
2063 if (element->needsReattachLayoutTree() || 2067 if (element->needsReattachLayoutTree() ||
2064 element->childNeedsReattachLayoutTree()) 2068 element->childNeedsReattachLayoutTree())
2065 element->rebuildLayoutTree(); 2069 element->rebuildLayoutTree(nextTextSibling);
2066 } else { 2070 } else {
2067 createPseudoElementIfNeeded(pseudoId); 2071 createPseudoElementIfNeeded(pseudoId);
2068 } 2072 }
2069 } 2073 }
2070 2074
2071 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, 2075 void Element::updateCallbackSelectors(const ComputedStyle* oldStyle,
2072 const ComputedStyle* newStyle) { 2076 const ComputedStyle* newStyle) {
2073 Vector<String> emptyVector; 2077 Vector<String> emptyVector;
2074 const Vector<String>& oldCallbackSelectors = 2078 const Vector<String>& oldCallbackSelectors =
2075 oldStyle ? oldStyle->callbackSelectors() : emptyVector; 2079 oldStyle ? oldStyle->callbackSelectors() : emptyVector;
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after
4170 } 4174 }
4171 4175
4172 DEFINE_TRACE_WRAPPERS(Element) { 4176 DEFINE_TRACE_WRAPPERS(Element) {
4173 if (hasRareData()) { 4177 if (hasRareData()) {
4174 visitor->traceWrappers(elementRareData()); 4178 visitor->traceWrappers(elementRareData());
4175 } 4179 }
4176 ContainerNode::traceWrappers(visitor); 4180 ContainerNode::traceWrappers(visitor);
4177 } 4181 }
4178 4182
4179 } // namespace blink 4183 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698