Index: Source/core/css/resolver/StyleResolver.cpp |
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp |
index 75a480c3d6d890defa7fb5bd4d0483c22440185c..035eb41cb8291122fbb24f55f582bc1e5f081f44 100644 |
--- a/Source/core/css/resolver/StyleResolver.cpp |
+++ b/Source/core/css/resolver/StyleResolver.cpp |
@@ -530,32 +530,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. |
@@ -1415,6 +1393,15 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc |
applyMatchedProperties<LowPropertyPriority>(state, range, true, applyInheritedOnly); |
applyMatchedProperties<LowPropertyPriority>(state, matchResult.uaRules(), true, applyInheritedOnly); |
+ if (state.style()->hasAppearance() && !applyInheritedOnly) { |
+ // Check whether the final border and background differs from the cached UA ones. |
+ // When there is a partial match in the MatchedPropertiesCache, these flags will already be set correctly |
+ // and the value stored in cacheUserAgentBorderAndBackground is incorrect, so doing this check again |
+ // would give the wrong answer. |
+ state.style()->setHasAuthorBackground(hasAuthorBackground(state)); |
+ state.style()->setHasAuthorBorder(hasAuthorBorder(state)); |
+ } |
+ |
loadPendingResources(state); |
if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCacheable(element, *state.style(), *state.parentStyle())) { |
@@ -1425,6 +1412,29 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc |
ASSERT(!state.fontBuilder().fontDirty()); |
} |
+bool StyleResolver::hasAuthorBackground(const StyleResolverState& state) |
+{ |
+ const CachedUAStyle* cachedUAStyle = state.cachedUAStyle(); |
+ if (!cachedUAStyle) |
+ return false; |
+ |
+ FillLayer oldFill = cachedUAStyle->backgroundLayers; |
+ 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 || cachedUAStyle->backgroundColor != state.style()->backgroundColor()); |
+} |
+ |
+bool StyleResolver::hasAuthorBorder(const StyleResolverState& state) |
+{ |
+ const CachedUAStyle* cachedUAStyle = state.cachedUAStyle(); |
+ return cachedUAStyle && (cachedUAStyle->border != state.style()->border()); |
+} |
+ |
void StyleResolver::applyCallbackSelectors(StyleResolverState& state) |
{ |
if (!m_watchedSelectorsRules) |