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

Unified Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 895383002: Let StyleResolver figure out differences between UA style and resolved style. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: I mean *remove* assert. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | Source/core/layout/LayoutTheme.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index 3f68cc5db6746fca5457d6e809fa5b0e07bae98d..7162b646b4332806dab618119c11da6c35a94dc3 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -526,10 +526,32 @@ PassRefPtr<LayoutStyle> StyleResolver::styleForDocument(Document& document)
return documentStyle.release();
}
+static AuthorStyleInfo 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()->visitedDependentColor(CSSPropertyBackgroundColor) != cachedUAStyle->backgroundColor;
+ bool borderChanged = state.style()->border() != cachedUAStyle->border;
+
+ return AuthorStyleInfo(backgroundChanged, borderChanged);
+}
+
void StyleResolver::adjustLayoutStyle(StyleResolverState& state, Element* element)
{
StyleAdjuster adjuster(document().inQuirksMode());
- adjuster.adjustLayoutStyle(state.mutableStyleRef(), *state.parentStyle(), element, state.cachedUAStyle());
+ adjuster.adjustLayoutStyle(state.mutableStyleRef(), *state.parentStyle(), element, authorStyleInfo(state));
}
// Start loading resources referenced by this style.
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | Source/core/layout/LayoutTheme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698