Index: Source/core/css/resolver/StyleResolver.cpp |
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp |
index 788a2a176a6e85ee1c6f82977ceb34e78cc756ce..85c518274513b007ada1668356bd001650c6004e 100644 |
--- a/Source/core/css/resolver/StyleResolver.cpp |
+++ b/Source/core/css/resolver/StyleResolver.cpp |
@@ -478,32 +478,10 @@ PassRefPtr<ComputedStyle> StyleResolver::styleForDocument(Document& document) |
return documentStyle.release(); |
} |
-AuthorStyleInfo StyleResolver::authorStyleInfo(StyleResolverState& state) |
-{ |
- const CachedUAStyle* cachedUAStyle = state.cachedUAStyle(); |
- |
- if (!cachedUAStyle) |
- return AuthorStyleInfo(); |
- |
- // Exclude background-repeat from comparison by resetting it. |
- FillLayer backgroundCopy = cachedUAStyle->backgroundLayers; |
- FillLayer backgroundLayersCopy = state.style()->backgroundLayers(); |
- backgroundCopy.setRepeatX(NoRepeatFill); |
- backgroundCopy.setRepeatY(NoRepeatFill); |
- backgroundLayersCopy.setRepeatX(NoRepeatFill); |
- backgroundLayersCopy.setRepeatY(NoRepeatFill); |
- |
- bool backgroundChanged = backgroundLayersCopy != backgroundCopy |
- || state.style()->backgroundColor() != cachedUAStyle->backgroundColor; |
- bool borderChanged = state.style()->border() != cachedUAStyle->border; |
- |
- return AuthorStyleInfo(backgroundChanged, borderChanged); |
-} |
- |
void StyleResolver::adjustComputedStyle(StyleResolverState& state, Element* element) |
{ |
StyleAdjuster adjuster(document().inQuirksMode()); |
- adjuster.adjustComputedStyle(state.mutableStyleRef(), *state.parentStyle(), element, authorStyleInfo(state)); |
+ adjuster.adjustComputedStyle(state.mutableStyleRef(), *state.parentStyle(), element); |
} |
// Start loading resources referenced by this style. |
@@ -1335,14 +1313,20 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc |
// Now do the normal priority UA properties. |
applyMatchedProperties<LowPropertyPriority>(state, matchResult, false, matchResult.beginUA(), matchResult.endUA(), applyInheritedOnly); |
- // Cache the UA properties to pass them to LayoutTheme in adjustComputedStyle. |
- state.cacheUserAgentBorderAndBackground(); |
+ // Make a copy of the current UA border and background so we can compare after matching other properties. |
Timothy Loh
2015/07/29 03:37:07
Can we just keep using CachedUAStyle and only crea
meade_UTC10
2015/07/30 05:38:17
Done.
|
+ FillLayer uaBgFill = state.style()->backgroundLayers(); |
+ StyleColor uaBgColor = state.style()->backgroundColor(); |
+ BorderData uaBorder = state.style()->border(); |
// Now do the author and user normal priority properties and all the !important properties. |
applyMatchedProperties<LowPropertyPriority>(state, matchResult, false, matchResult.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly); |
applyMatchedProperties<LowPropertyPriority>(state, matchResult, true, matchResult.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly); |
applyMatchedProperties<LowPropertyPriority>(state, matchResult, true, matchResult.beginUA(), matchResult.endUA(), applyInheritedOnly); |
+ // Compare the saved UA bg and border. |
+ state.style()->setHasAuthorBackground(backgroundChanged(uaBgFill, uaBgColor, state)); |
+ state.style()->setHasAuthorBorder(uaBorder != state.style()->border()); |
+ |
loadPendingResources(state); |
if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCacheable(element, *state.style(), *state.parentStyle())) { |
@@ -1353,6 +1337,19 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc |
ASSERT(!state.fontBuilder().fontDirty()); |
} |
+bool StyleResolver::backgroundChanged(const FillLayer& oldLayer, const StyleColor& oldColor, const StyleResolverState& state) |
+{ |
+ FillLayer oldFill = oldLayer; |
+ FillLayer newFill = state.style()->backgroundLayers(); |
+ // Exclude background-repeat from comparison by resetting it. |
+ oldFill.setRepeatX(NoRepeatFill); |
+ oldFill.setRepeatY(NoRepeatFill); |
+ newFill.setRepeatX(NoRepeatFill); |
+ newFill.setRepeatY(NoRepeatFill); |
+ |
+ return (oldFill != newFill || oldColor != state.style()->backgroundColor()); |
+} |
+ |
void StyleResolver::applyCallbackSelectors(StyleResolverState& state) |
{ |
if (!m_watchedSelectorsRules) |