Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: Source/core/css/resolver/MatchedPropertiesCache.cpp

Issue 82083002: Move viewport unit resolution to style recalc time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rename browser zoom to page zoom Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 cacheItem->clear(); 102 cacheItem->clear();
103 103
104 cacheItem->set(style, parentStyle, matchResult); 104 cacheItem->set(style, parentStyle, matchResult);
105 } 105 }
106 106
107 void MatchedPropertiesCache::clear() 107 void MatchedPropertiesCache::clear()
108 { 108 {
109 m_cache.clear(); 109 m_cache.clear();
110 } 110 }
111 111
112 void MatchedPropertiesCache::clearViewportDependent()
113 {
114 Vector<unsigned, 16> toRemove;
115 for (Cache::iterator it = m_cache.begin(); it != m_cache.end(); ++it) {
116 CachedMatchedProperties* cacheItem = it->value.get();
117 if (cacheItem->renderStyle->hasViewportUnits())
118 toRemove.append(it->key);
119 }
120 for (size_t i = 0; i < toRemove.size(); ++i)
121 m_cache.remove(toRemove[i]);
122 }
123
112 void MatchedPropertiesCache::sweep(Timer<MatchedPropertiesCache>*) 124 void MatchedPropertiesCache::sweep(Timer<MatchedPropertiesCache>*)
113 { 125 {
114 // Look for cache entries containing a style declaration with a single ref a nd remove them. 126 // Look for cache entries containing a style declaration with a single ref a nd remove them.
115 // This may happen when an element attribute mutation causes it to generate a new inlineStyle() 127 // This may happen when an element attribute mutation causes it to generate a new inlineStyle()
116 // or presentationAttributeStyle(), potentially leaving this cache with the last ref on the old one. 128 // or presentationAttributeStyle(), potentially leaving this cache with the last ref on the old one.
117 Vector<unsigned, 16> toRemove; 129 Vector<unsigned, 16> toRemove;
118 Cache::iterator it = m_cache.begin(); 130 Cache::iterator it = m_cache.begin();
119 Cache::iterator end = m_cache.end(); 131 Cache::iterator end = m_cache.end();
120 for (; it != end; ++it) { 132 for (; it != end; ++it) {
121 CachedMatchedProperties* cacheItem = it->value.get(); 133 CachedMatchedProperties* cacheItem = it->value.get();
(...skipping 29 matching lines...) Expand all
151 // CSSPropertyInternalCallback sets the rule's selector name into the Render Style, and that's not recalculated if the RenderStyle is loaded from the cache, so don't cache it. 163 // CSSPropertyInternalCallback sets the rule's selector name into the Render Style, and that's not recalculated if the RenderStyle is loaded from the cache, so don't cache it.
152 if (!style->callbackSelectors().isEmpty()) 164 if (!style->callbackSelectors().isEmpty())
153 return false; 165 return false;
154 // The cache assumes static knowledge about which properties are inherited. 166 // The cache assumes static knowledge about which properties are inherited.
155 if (parentStyle->hasExplicitlyInheritedProperties()) 167 if (parentStyle->hasExplicitlyInheritedProperties())
156 return false; 168 return false;
157 return true; 169 return true;
158 } 170 }
159 171
160 } 172 }
OLDNEW
« no previous file with comments | « Source/core/css/resolver/MatchedPropertiesCache.h ('k') | Source/core/css/resolver/StyleBuilderConverter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698