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

Unified Diff: Source/core/layout/LayoutTheme.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/layout/LayoutTheme.cpp
diff --git a/Source/core/layout/LayoutTheme.cpp b/Source/core/layout/LayoutTheme.cpp
index 5705d4167a046c771ed54632c8fb85e8bd0c811e..5d1fcddac720cc0c0820a9ce9890f3e7ff4fde3c 100644
--- a/Source/core/layout/LayoutTheme.cpp
+++ b/Source/core/layout/LayoutTheme.cpp
@@ -49,6 +49,7 @@
#include "core/rendering/RenderMeter.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/style/RenderStyle.h"
+#include "core/rendering/style/UAStyleChange.h"
#include "platform/FileMetadata.h"
#include "platform/FloatConversion.h"
#include "platform/RuntimeEnabledFeatures.h"
@@ -87,7 +88,7 @@ LayoutTheme::LayoutTheme()
{
}
-void LayoutTheme::adjustStyle(RenderStyle* style, Element* e, const CachedUAStyle* uaStyle)
+void LayoutTheme::adjustStyle(RenderStyle* style, Element* e, const UAStyleChange& uaStyle)
{
// Force inline and table display styles to be inline-block (except for table- which is block)
ControlPart part = style->appearance();
@@ -99,7 +100,7 @@ void LayoutTheme::adjustStyle(RenderStyle* style, Element* e, const CachedUAStyl
else if (style->display() == LIST_ITEM || style->display() == TABLE)
style->setDisplay(BLOCK);
- if (uaStyle && isControlStyled(style, uaStyle)) {
+ if (uaStyle.hasAppearance && isControlStyled(style, uaStyle)) {
if (part == MenulistPart) {
style->setAppearance(MenulistButtonPart);
part = MenulistButtonPart;
@@ -545,25 +546,8 @@ bool LayoutTheme::isControlContainer(ControlPart appearance) const
return appearance != CheckboxPart && appearance != RadioPart;
}
-static bool isBackgroundOrBorderStyled(const RenderStyle& style, const CachedUAStyle& uaStyle)
+bool LayoutTheme::isControlStyled(const RenderStyle* style, const UAStyleChange& uaStyle) const
{
- // Code below excludes the background-repeat from comparison by resetting it
- FillLayer backgroundCopy = uaStyle.backgroundLayers;
- FillLayer backgroundLayersCopy = style.backgroundLayers();
- backgroundCopy.setRepeatX(NoRepeatFill);
- backgroundCopy.setRepeatY(NoRepeatFill);
- backgroundLayersCopy.setRepeatX(NoRepeatFill);
- backgroundLayersCopy.setRepeatY(NoRepeatFill);
- // Test the style to see if the UA border and background match.
- return style.border() != uaStyle.border
- || backgroundLayersCopy != backgroundCopy
- || style.visitedDependentColor(CSSPropertyBackgroundColor) != uaStyle.backgroundColor;
-}
-
-bool LayoutTheme::isControlStyled(const RenderStyle* style, const CachedUAStyle* uaStyle) const
-{
- ASSERT(uaStyle);
-
switch (style->appearance()) {
case PushButtonPart:
case SquareButtonPart:
@@ -574,13 +558,13 @@ bool LayoutTheme::isControlStyled(const RenderStyle* style, const CachedUAStyle*
case ContinuousCapacityLevelIndicatorPart:
case DiscreteCapacityLevelIndicatorPart:
case RatingLevelIndicatorPart:
- return isBackgroundOrBorderStyled(*style, *uaStyle);
+ return uaStyle.backgroundChanged || uaStyle.borderChanged;
case MenulistPart:
case SearchFieldPart:
case TextAreaPart:
case TextFieldPart:
- return isBackgroundOrBorderStyled(*style, *uaStyle) || style->boxShadow();
+ return uaStyle.backgroundChanged || uaStyle.borderChanged || style->boxShadow();
case SliderHorizontalPart:
case SliderVerticalPart:

Powered by Google App Engine
This is Rietveld 408576698