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.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 { | 106 { |
107 Vector<unsigned, 16> toRemove; | 107 Vector<unsigned, 16> toRemove; |
108 for (const auto& cacheEntry : m_cache) { | 108 for (const auto& cacheEntry : m_cache) { |
109 CachedMatchedProperties* cacheItem = cacheEntry.value.get(); | 109 CachedMatchedProperties* cacheItem = cacheEntry.value.get(); |
110 if (cacheItem->computedStyle->hasViewportUnits()) | 110 if (cacheItem->computedStyle->hasViewportUnits()) |
111 toRemove.append(cacheEntry.key); | 111 toRemove.append(cacheEntry.key); |
112 } | 112 } |
113 m_cache.removeAll(toRemove); | 113 m_cache.removeAll(toRemove); |
114 } | 114 } |
115 | 115 |
116 bool MatchedPropertiesCache::isCacheable(const ComputedStyle& style, const Compu
tedStyle& parentStyle) | 116 bool MatchedPropertiesCache::isCacheable(const ComputedStyle& style, const Compu
tedStyle& parentStyle, const ContainerNode* flatTreeParent) |
117 { | 117 { |
118 if (style.unique() || (style.styleType() != PseudoIdNone && parentStyle.uniq
ue())) | 118 if (style.unique() || (style.styleType() != PseudoIdNone && parentStyle.uniq
ue())) |
119 return false; | 119 return false; |
120 if (style.zoom() != ComputedStyle::initialZoom()) | 120 if (style.zoom() != ComputedStyle::initialZoom()) |
121 return false; | 121 return false; |
122 if (style.getWritingMode() != ComputedStyle::initialWritingMode() || style.d
irection() != ComputedStyle::initialDirection()) | 122 if (style.getWritingMode() != ComputedStyle::initialWritingMode() || style.d
irection() != ComputedStyle::initialDirection()) |
123 return false; | 123 return false; |
124 // The cache assumes static knowledge about which properties are inherited. | 124 // The cache assumes static knowledge about which properties are inherited. |
125 if (parentStyle.hasExplicitlyInheritedProperties()) | 125 // Without a flat tree parent, StyleBuilder::applyProperty will not |
| 126 // setHasExplicitlyInheritedProperties on the parent style. |
| 127 if (!flatTreeParent || parentStyle.hasExplicitlyInheritedProperties()) |
126 return false; | 128 return false; |
127 if (style.hasVariableReferenceFromNonInheritedProperty()) | 129 if (style.hasVariableReferenceFromNonInheritedProperty()) |
128 return false; | 130 return false; |
129 return true; | 131 return true; |
130 } | 132 } |
131 | 133 |
132 DEFINE_TRACE(MatchedPropertiesCache) | 134 DEFINE_TRACE(MatchedPropertiesCache) |
133 { | 135 { |
134 visitor->trace(m_cache); | 136 visitor->trace(m_cache); |
135 } | 137 } |
136 | 138 |
137 } // namespace blink | 139 } // namespace blink |
OLD | NEW |