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

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: 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
Index: Source/core/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index fd039ac38b58e3e29613f0e80ec0f852397b575c..8e249cc224d27d0b99962ea3cc107395b0f8b36d 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -80,7 +80,9 @@
#include "core/html/HTMLIFrameElement.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/rendering/RenderView.h"
+#include "core/rendering/style/CachedUAStyle.h"
#include "core/rendering/style/KeyframeList.h"
+#include "core/rendering/style/UAStyleChange.h"
#include "core/svg/SVGDocumentExtensions.h"
#include "core/svg/SVGElement.h"
#include "platform/RuntimeEnabledFeatures.h"
@@ -526,10 +528,34 @@ PassRefPtr<RenderStyle> StyleResolver::styleForDocument(Document& document)
return documentStyle.release();
}
+static UAStyleChange uaStyleChange(StyleResolverState& state)
+{
+ const CachedUAStyle* cachedUAStyle = state.cachedUAStyle();
+
+ if (!cachedUAStyle)
+ return UAStyleChange(false);
+
+ UAStyleChange uaStyle(true);
+
+ // 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);
+
+ uaStyle.backgroundChanged = backgroundLayersCopy != backgroundCopy
+ || state.style()->visitedDependentColor(CSSPropertyBackgroundColor) != cachedUAStyle->backgroundColor;
+ uaStyle.borderChanged = state.style()->border() != cachedUAStyle->border;
+
+ return uaStyle;
+}
+
void StyleResolver::adjustRenderStyle(StyleResolverState& state, Element* element)
{
StyleAdjuster adjuster(document().inQuirksMode());
- adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element, state.cachedUAStyle());
+ adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element, uaStyleChange(state));
}
// Start loading resources referenced by this style.

Powered by Google App Engine
This is Rietveld 408576698