| 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 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1890 clearChildNeedsStyleRecalc(); | 1890 clearChildNeedsStyleRecalc(); |
| 1891 clearChildNeedsReattachLayoutTree(); | 1891 clearChildNeedsReattachLayoutTree(); |
| 1892 } | 1892 } |
| 1893 | 1893 |
| 1894 if (hasCustomStyleCallbacks()) | 1894 if (hasCustomStyleCallbacks()) |
| 1895 didRecalcStyle(change); | 1895 didRecalcStyle(change); |
| 1896 } | 1896 } |
| 1897 | 1897 |
| 1898 PassRefPtr<ComputedStyle> Element::propagateInheritedProperties( | 1898 PassRefPtr<ComputedStyle> Element::propagateInheritedProperties( |
| 1899 StyleRecalcChange change) { | 1899 StyleRecalcChange change) { |
| 1900 if (change != IndependentInherit) | 1900 if (change != IndependentInherit && change != IndependentInheritWithVariables) |
| 1901 return nullptr; | 1901 return nullptr; |
| 1902 if (isPseudoElement()) | 1902 if (isPseudoElement()) |
| 1903 return nullptr; | 1903 return nullptr; |
| 1904 if (needsStyleRecalc()) | 1904 if (needsStyleRecalc()) |
| 1905 return nullptr; | 1905 return nullptr; |
| 1906 if (hasAnimations()) | 1906 if (hasAnimations()) |
| 1907 return nullptr; | 1907 return nullptr; |
| 1908 const ComputedStyle* parentStyle = parentComputedStyle(); | 1908 const ComputedStyle* parentStyle = parentComputedStyle(); |
| 1909 DCHECK(parentStyle); | 1909 DCHECK(parentStyle); |
| 1910 const ComputedStyle* style = computedStyle(); | 1910 const ComputedStyle* style = computedStyle(); |
| 1911 if (!style || style->animations() || style->transitions()) | 1911 if (!style || style->animations() || style->transitions()) |
| 1912 return nullptr; | 1912 return nullptr; |
| 1913 if (change == IndependentInheritWithVariables && |
| 1914 (style->hasVariableReferenceFromInheritedProperty() || |
| 1915 style->hasVariableReferenceFromNonInheritedProperty() |
| 1916 // If this element sets any variables, they may refer to other variables. |
| 1917 // To be safe, recalc the element's style. |
| 1918 // TODO(sashab): Set the hasVariableReferenceFromInheritedProperty flag |
| 1919 // on ComputedStyle when a variable references another variable and |
| 1920 // remove this additional check. |
| 1921 || style->hasAnyNonInheritedVariableDefinitions())) |
| 1922 return nullptr; |
| 1913 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*style); | 1923 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*style); |
| 1914 newStyle->propagateIndependentInheritedProperties(*parentStyle); | 1924 newStyle->propagateIndependentInheritedProperties(*parentStyle); |
| 1915 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), | 1925 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), |
| 1916 independentInheritedStylesPropagated, 1); | 1926 independentInheritedStylesPropagated, 1); |
| 1917 return newStyle; | 1927 return newStyle; |
| 1918 } | 1928 } |
| 1919 | 1929 |
| 1920 StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change, | 1930 StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change, |
| 1921 Text* nextTextSibling) { | 1931 Text* nextTextSibling) { |
| 1922 DCHECK(document().inStyleRecalc()); | 1932 DCHECK(document().inStyleRecalc()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1935 DCHECK(newStyle); | 1945 DCHECK(newStyle); |
| 1936 | 1946 |
| 1937 StyleRecalcChange localChange = | 1947 StyleRecalcChange localChange = |
| 1938 ComputedStyle::stylePropagationDiff(oldStyle.get(), newStyle.get()); | 1948 ComputedStyle::stylePropagationDiff(oldStyle.get(), newStyle.get()); |
| 1939 if (localChange == NoChange) { | 1949 if (localChange == NoChange) { |
| 1940 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1); | 1950 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesUnchanged, 1); |
| 1941 } else { | 1951 } else { |
| 1942 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1); | 1952 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1); |
| 1943 } | 1953 } |
| 1944 | 1954 |
| 1955 if (change == IndependentInheritWithVariables && localChange == NoChange) { |
| 1956 // If we are in a propagation fast-path, but we have changed variables, |
| 1957 // there |
| 1958 // might still be properties that need to be updated below. Force continue. |
| 1959 localChange = IndependentInheritWithVariables; |
| 1960 } |
| 1961 |
| 1945 if (localChange == Reattach) { | 1962 if (localChange == Reattach) { |
| 1946 StyleReattachData styleReattachData; | 1963 StyleReattachData styleReattachData; |
| 1947 styleReattachData.computedStyle = std::move(newStyle); | 1964 styleReattachData.computedStyle = std::move(newStyle); |
| 1948 styleReattachData.nextTextSibling = nextTextSibling; | 1965 styleReattachData.nextTextSibling = nextTextSibling; |
| 1949 document().addStyleReattachData(*this, styleReattachData); | 1966 document().addStyleReattachData(*this, styleReattachData); |
| 1950 setNeedsReattachLayoutTree(); | 1967 setNeedsReattachLayoutTree(); |
| 1951 return rebuildLayoutTree(); | 1968 return rebuildLayoutTree(); |
| 1952 } | 1969 } |
| 1953 | 1970 |
| 1954 DCHECK(oldStyle); | 1971 DCHECK(oldStyle); |
| (...skipping 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4089 } | 4106 } |
| 4090 | 4107 |
| 4091 DEFINE_TRACE_WRAPPERS(Element) { | 4108 DEFINE_TRACE_WRAPPERS(Element) { |
| 4092 if (hasRareData()) { | 4109 if (hasRareData()) { |
| 4093 visitor->traceWrappers(elementRareData()); | 4110 visitor->traceWrappers(elementRareData()); |
| 4094 } | 4111 } |
| 4095 ContainerNode::traceWrappers(visitor); | 4112 ContainerNode::traceWrappers(visitor); |
| 4096 } | 4113 } |
| 4097 | 4114 |
| 4098 } // namespace blink | 4115 } // namespace blink |
| OLD | NEW |