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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 #include "core/css/StylePropertySet.h" | 32 #include "core/css/StylePropertySet.h" |
33 #include "core/css/resolver/StyleResolverState.h" | 33 #include "core/css/resolver/StyleResolverState.h" |
34 #include "core/style/ComputedStyle.h" | 34 #include "core/style/ComputedStyle.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 void CachedMatchedProperties::set(const ComputedStyle& style, const ComputedStyl
e& parentStyle, const MatchResult& matchResult) | 38 void CachedMatchedProperties::set(const ComputedStyle& style, const ComputedStyl
e& parentStyle, const MatchResult& matchResult) |
39 { | 39 { |
40 matchedProperties.appendVector(matchResult.matchedProperties); | 40 matchedProperties.appendVector(matchResult.matchedProperties); |
41 ranges = matchResult.ranges; | |
42 | 41 |
43 // Note that we don't cache the original ComputedStyle instance. It may be f
urther modified. | 42 // Note that we don't cache the original ComputedStyle instance. It may be f
urther modified. |
44 // The ComputedStyle in the cache is really just a holder for the substructu
res and never used as-is. | 43 // The ComputedStyle in the cache is really just a holder for the substructu
res and never used as-is. |
45 this->computedStyle = ComputedStyle::clone(style); | 44 this->computedStyle = ComputedStyle::clone(style); |
46 this->parentComputedStyle = ComputedStyle::clone(parentStyle); | 45 this->parentComputedStyle = ComputedStyle::clone(parentStyle); |
47 } | 46 } |
48 | 47 |
49 void CachedMatchedProperties::clear() | 48 void CachedMatchedProperties::clear() |
50 { | 49 { |
51 matchedProperties.clear(); | 50 matchedProperties.clear(); |
(...skipping 21 matching lines...) Expand all Loading... |
73 | 72 |
74 size_t size = matchResult.matchedProperties.size(); | 73 size_t size = matchResult.matchedProperties.size(); |
75 if (size != cacheItem->matchedProperties.size()) | 74 if (size != cacheItem->matchedProperties.size()) |
76 return 0; | 75 return 0; |
77 if (cacheItem->computedStyle->insideLink() != styleResolverState.style()->in
sideLink()) | 76 if (cacheItem->computedStyle->insideLink() != styleResolverState.style()->in
sideLink()) |
78 return 0; | 77 return 0; |
79 for (size_t i = 0; i < size; ++i) { | 78 for (size_t i = 0; i < size; ++i) { |
80 if (matchResult.matchedProperties[i] != cacheItem->matchedProperties[i]) | 79 if (matchResult.matchedProperties[i] != cacheItem->matchedProperties[i]) |
81 return 0; | 80 return 0; |
82 } | 81 } |
83 if (cacheItem->ranges != matchResult.ranges) | |
84 return 0; | |
85 return cacheItem; | 82 return cacheItem; |
86 } | 83 } |
87 | 84 |
88 void MatchedPropertiesCache::add(const ComputedStyle& style, const ComputedStyle
& parentStyle, unsigned hash, const MatchResult& matchResult) | 85 void MatchedPropertiesCache::add(const ComputedStyle& style, const ComputedStyle
& parentStyle, unsigned hash, const MatchResult& matchResult) |
89 { | 86 { |
90 #if !ENABLE(OILPAN) | 87 #if !ENABLE(OILPAN) |
91 static const unsigned maxAdditionsBetweenSweeps = 100; | 88 static const unsigned maxAdditionsBetweenSweeps = 100; |
92 if (++m_additionsSinceLastSweep >= maxAdditionsBetweenSweeps | 89 if (++m_additionsSinceLastSweep >= maxAdditionsBetweenSweeps |
93 && !m_sweepTimer.isActive()) { | 90 && !m_sweepTimer.isActive()) { |
94 static const unsigned sweepTimeInSeconds = 60; | 91 static const unsigned sweepTimeInSeconds = 60; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 160 } |
164 | 161 |
165 DEFINE_TRACE(MatchedPropertiesCache) | 162 DEFINE_TRACE(MatchedPropertiesCache) |
166 { | 163 { |
167 #if ENABLE(OILPAN) | 164 #if ENABLE(OILPAN) |
168 visitor->trace(m_cache); | 165 visitor->trace(m_cache); |
169 #endif | 166 #endif |
170 } | 167 } |
171 | 168 |
172 } | 169 } |
OLD | NEW |