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

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

Issue 361173002: [wip] simplify -webkit-appearance adjust step (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update Created 6 years, 5 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 586
587 static void addContentAttrValuesToFeatures(const Vector<AtomicString>& contentAt trValues, RuleFeatureSet& features) 587 static void addContentAttrValuesToFeatures(const Vector<AtomicString>& contentAt trValues, RuleFeatureSet& features)
588 { 588 {
589 for (size_t i = 0; i < contentAttrValues.size(); ++i) 589 for (size_t i = 0; i < contentAttrValues.size(); ++i)
590 features.addContentAttr(contentAttrValues[i]); 590 features.addContentAttr(contentAttrValues[i]);
591 } 591 }
592 592
593 void StyleResolver::adjustRenderStyle(StyleResolverState& state, Element* elemen t) 593 void StyleResolver::adjustRenderStyle(StyleResolverState& state, Element* elemen t)
594 { 594 {
595 StyleAdjuster adjuster(m_document.inQuirksMode()); 595 StyleAdjuster adjuster(m_document.inQuirksMode());
596 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element, stat e.cachedUAStyle()); 596 bool uaStyleHasWebkitAppearance = element && elementTypeHasAppearanceFromUAS tyle(*element);
597 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element, uaSt yleHasWebkitAppearance, state.valuesUnchangedForWebkitAppearance());
597 } 598 }
598 599
599 // Start loading resources referenced by this style. 600 // Start loading resources referenced by this style.
600 void StyleResolver::loadPendingResources(StyleResolverState& state) 601 void StyleResolver::loadPendingResources(StyleResolverState& state)
601 { 602 {
602 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources()); 603 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources());
603 document().styleEngine()->fontSelector()->fontLoader()->loadPendingFonts(); 604 document().styleEngine()->fontSelector()->fontLoader()->loadPendingFonts();
604 } 605 }
605 606
606 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS tyle* defaultParent, StyleSharingBehavior sharingBehavior, 607 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS tyle* defaultParent, StyleSharingBehavior sharingBehavior,
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 1159
1159 // If our font got dirtied, go ahead and update it now. 1160 // If our font got dirtied, go ahead and update it now.
1160 updateFont(state); 1161 updateFont(state);
1161 1162
1162 // Many properties depend on the font. If it changes we just apply all prope rties. 1163 // Many properties depend on the font. If it changes we just apply all prope rties.
1163 if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDes cription() != state.style()->fontDescription()) 1164 if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDes cription() != state.style()->fontDescription())
1164 applyInheritedOnly = false; 1165 applyInheritedOnly = false;
1165 1166
1166 // This code supports -webkit-appearance, for which we are interested 1167 // This code supports -webkit-appearance, for which we are interested
1167 // in whether the user has specified border or background properties. 1168 // in whether the user has specified border or background properties.
1168 // FIXME: This is a bit of a mess, we should just compare CSSValues and
1169 // store a single bit for this.
1170 if (elementTypeHasAppearanceFromUAStyle(*element)) { 1169 if (elementTypeHasAppearanceFromUAStyle(*element)) {
1171 CascadedValues userAgentValues(state, matchResult, true); 1170 if (cascadedValues.valuesUnchangedForWebkitAppearance(matchResult))
1172 // We only actually care about border and background properties here 1171 state.setValuesUnchangedForWebkitAppearance();
1173 userAgentValues.applyValues(firstCSSPropertyId<LowPriorityProperties>(), lastCSSPropertyId<LowPriorityProperties>(), applyInheritedOnly);
1174 state.cacheUserAgentBorderAndBackground();
1175 } 1172 }
1176 1173
1177 cascadedValues.applyValues(firstCSSPropertyId<LowPriorityProperties>(), last CSSPropertyId<LowPriorityProperties>(), applyInheritedOnly); 1174 cascadedValues.applyValues(firstCSSPropertyId<LowPriorityProperties>(), last CSSPropertyId<LowPriorityProperties>(), applyInheritedOnly);
1178 1175
1179 loadPendingResources(state); 1176 loadPendingResources(state);
1180 1177
1181 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache able(element, state.style(), state.parentStyle())) { 1178 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache able(element, state.style(), state.parentStyle())) {
1182 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded); 1179 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded);
1183 m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHa sh, matchResult); 1180 m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHa sh, matchResult);
1184 } 1181 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 visitor->trace(m_features); 1266 visitor->trace(m_features);
1270 visitor->trace(m_siblingRuleSet); 1267 visitor->trace(m_siblingRuleSet);
1271 visitor->trace(m_uncommonAttributeRuleSet); 1268 visitor->trace(m_uncommonAttributeRuleSet);
1272 visitor->trace(m_watchedSelectorsRules); 1269 visitor->trace(m_watchedSelectorsRules);
1273 visitor->trace(m_treeBoundaryCrossingRules); 1270 visitor->trace(m_treeBoundaryCrossingRules);
1274 visitor->trace(m_pendingStyleSheets); 1271 visitor->trace(m_pendingStyleSheets);
1275 #endif 1272 #endif
1276 } 1273 }
1277 1274
1278 } // namespace blink 1275 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleAdjuster.cpp ('k') | Source/core/css/resolver/StyleResolverState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698