| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. |
| 6 * All rights reserved. | 6 * All rights reserved. |
| 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 void StyleResolver::addToStyleSharingList(Element& element) { | 193 void StyleResolver::addToStyleSharingList(Element& element) { |
| 194 DCHECK(RuntimeEnabledFeatures::styleSharingEnabled()); | 194 DCHECK(RuntimeEnabledFeatures::styleSharingEnabled()); |
| 195 // Never add elements to the style sharing list if we're not in a recalcStyle, | 195 // Never add elements to the style sharing list if we're not in a recalcStyle, |
| 196 // otherwise we could leave stale pointers in there. | 196 // otherwise we could leave stale pointers in there. |
| 197 if (!document().inStyleRecalc()) | 197 if (!document().inStyleRecalc()) |
| 198 return; | 198 return; |
| 199 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), sharedStyleCandidates, | 199 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), sharedStyleCandidates, |
| 200 1); | 200 1); |
| 201 StyleSharingList& list = styleSharingList(); | 201 StyleSharingList& list = styleSharingList(); |
| 202 if (list.size() >= styleSharingListSize) | 202 if (list.size() >= styleSharingListSize) |
| 203 list.removeLast(); | 203 list.pop_back(); |
| 204 list.prepend(&element); | 204 list.prepend(&element); |
| 205 } | 205 } |
| 206 | 206 |
| 207 StyleSharingList& StyleResolver::styleSharingList() { | 207 StyleSharingList& StyleResolver::styleSharingList() { |
| 208 m_styleSharingLists.resize(styleSharingMaxDepth); | 208 m_styleSharingLists.resize(styleSharingMaxDepth); |
| 209 | 209 |
| 210 // We never put things at depth 0 into the list since that's only the <html> | 210 // We never put things at depth 0 into the list since that's only the <html> |
| 211 // element and it has no siblings or cousins to share with. | 211 // element and it has no siblings or cousins to share with. |
| 212 unsigned depth = | 212 unsigned depth = |
| 213 std::max(std::min(m_styleSharingDepth, styleSharingMaxDepth), 1u) - 1u; | 213 std::max(std::min(m_styleSharingDepth, styleSharingMaxDepth), 1u) - 1u; |
| (...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1945 | 1945 |
| 1946 DEFINE_TRACE(StyleResolver) { | 1946 DEFINE_TRACE(StyleResolver) { |
| 1947 visitor->trace(m_matchedPropertiesCache); | 1947 visitor->trace(m_matchedPropertiesCache); |
| 1948 visitor->trace(m_selectorFilter); | 1948 visitor->trace(m_selectorFilter); |
| 1949 visitor->trace(m_styleSharingLists); | 1949 visitor->trace(m_styleSharingLists); |
| 1950 visitor->trace(m_document); | 1950 visitor->trace(m_document); |
| 1951 visitor->trace(m_tracker); | 1951 visitor->trace(m_tracker); |
| 1952 } | 1952 } |
| 1953 | 1953 |
| 1954 } // namespace blink | 1954 } // namespace blink |
| OLD | NEW |