OLD | NEW |
---|---|
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 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2013 | 2013 |
2014 StyleRecalcChange localChange = | 2014 StyleRecalcChange localChange = |
2015 ComputedStyle::stylePropagationDiff(oldStyle.get(), newStyle.get()); | 2015 ComputedStyle::stylePropagationDiff(oldStyle.get(), newStyle.get()); |
2016 if (localChange == NoChange) { | 2016 if (localChange == NoChange) { |
2017 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1); | 2017 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1); |
2018 } else { | 2018 } else { |
2019 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1); | 2019 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1); |
2020 } | 2020 } |
2021 | 2021 |
2022 if (localChange == Reattach) { | 2022 if (localChange == Reattach) { |
2023 // This mimicks Element::recalcStyleForLayout except it also stores the | |
2024 // nextTextSibling information and sets the NeedsReattachLayoutTree flag. | |
2023 StyleReattachData styleReattachData; | 2025 StyleReattachData styleReattachData; |
2024 styleReattachData.computedStyle = std::move(newStyle); | 2026 styleReattachData.computedStyle = std::move(newStyle); |
2025 styleReattachData.nextTextSibling = nextTextSibling; | 2027 styleReattachData.nextTextSibling = nextTextSibling; |
2026 document().addStyleReattachData(*this, styleReattachData); | 2028 document().addStyleReattachData(*this, styleReattachData); |
2027 setNeedsReattachLayoutTree(); | 2029 setNeedsReattachLayoutTree(); |
2030 recalcShadowRootStylesForLayout(); | |
nainar
2017/03/03 06:08:52
This only goes over the descendants (ContainerNode
| |
2031 recalcDescendantStylesForLayout(); | |
2028 return Reattach; | 2032 return Reattach; |
2029 } | 2033 } |
2030 | 2034 |
2031 DCHECK(oldStyle); | 2035 DCHECK(oldStyle); |
2032 | 2036 |
2033 if (localChange != NoChange) | 2037 if (localChange != NoChange) |
2034 updateCallbackSelectors(oldStyle.get(), newStyle.get()); | 2038 updateCallbackSelectors(oldStyle.get(), newStyle.get()); |
2035 | 2039 |
2036 if (LayoutObject* layoutObject = this->layoutObject()) { | 2040 if (LayoutObject* layoutObject = this->layoutObject()) { |
2037 if (localChange != NoChange || | 2041 if (localChange != NoChange || |
(...skipping 24 matching lines...) Expand all Loading... | |
2062 return Inherit; | 2066 return Inherit; |
2063 newStyle->copyChildDependentFlagsFrom(*oldStyle); | 2067 newStyle->copyChildDependentFlagsFrom(*oldStyle); |
2064 } | 2068 } |
2065 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle()) | 2069 if (oldStyle->hasPseudoElementStyle() || newStyle->hasPseudoElementStyle()) |
2066 return UpdatePseudoElements; | 2070 return UpdatePseudoElements; |
2067 } | 2071 } |
2068 | 2072 |
2069 return localChange; | 2073 return localChange; |
2070 } | 2074 } |
2071 | 2075 |
2076 void Element::recalcStyleForLayout() { | |
2077 if (!hasCustomStyleCallbacks()) { | |
2078 StyleReattachData styleReattachData; | |
2079 styleReattachData.computedStyle = styleForLayoutObject(); | |
2080 document().addStyleReattachData(*this, styleReattachData); | |
2081 } | |
2082 recalcShadowRootStylesForLayout(); | |
nainar
2017/03/03 06:08:52
Need to add a function here to deal with the relev
| |
2083 recalcDescendantStylesForLayout(); | |
2084 } | |
2085 | |
2086 void Element::recalcShadowRootStylesForLayout() { | |
2087 for (ShadowRoot* root = youngestShadowRoot(); root; | |
2088 root = root->olderShadowRoot()) { | |
2089 root->recalcDescendantStylesForLayout(); | |
2090 } | |
2091 } | |
2092 | |
2072 void Element::rebuildLayoutTree() { | 2093 void Element::rebuildLayoutTree() { |
2073 DCHECK(inActiveDocument()); | 2094 DCHECK(inActiveDocument()); |
2074 DCHECK(parentNode()); | 2095 DCHECK(parentNode()); |
2075 | 2096 |
2076 if (needsReattachLayoutTree()) { | 2097 if (needsReattachLayoutTree()) { |
2077 StyleReattachData styleReattachData = | 2098 StyleReattachData styleReattachData = |
2078 document().getStyleReattachData(*this); | 2099 document().getStyleReattachData(*this); |
2079 AttachContext reattachContext; | 2100 AttachContext reattachContext; |
2080 reattachContext.resolvedStyle = styleReattachData.computedStyle.get(); | 2101 reattachContext.resolvedStyle = styleReattachData.computedStyle.get(); |
2081 bool layoutObjectWillChange = needsAttach() || layoutObject(); | 2102 bool layoutObjectWillChange = needsAttach() || layoutObject(); |
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4226 } | 4247 } |
4227 | 4248 |
4228 DEFINE_TRACE_WRAPPERS(Element) { | 4249 DEFINE_TRACE_WRAPPERS(Element) { |
4229 if (hasRareData()) { | 4250 if (hasRareData()) { |
4230 visitor->traceWrappers(elementRareData()); | 4251 visitor->traceWrappers(elementRareData()); |
4231 } | 4252 } |
4232 ContainerNode::traceWrappers(visitor); | 4253 ContainerNode::traceWrappers(visitor); |
4233 } | 4254 } |
4234 | 4255 |
4235 } // namespace blink | 4256 } // namespace blink |
OLD | NEW |