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

Unified Diff: Source/core/rendering/RenderTheme.cpp

Issue 361173002: [wip] simplify -webkit-appearance adjust step (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update Created 6 years, 5 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/rendering/RenderTheme.h ('k') | Source/core/rendering/style/CachedUAStyle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderTheme.cpp
diff --git a/Source/core/rendering/RenderTheme.cpp b/Source/core/rendering/RenderTheme.cpp
index 86408f068552457e2c777ab373da5205930d927d..d5948367d811650333d50ad6594be4c027a83c1c 100644
--- a/Source/core/rendering/RenderTheme.cpp
+++ b/Source/core/rendering/RenderTheme.cpp
@@ -86,7 +86,7 @@ RenderTheme::RenderTheme()
{
}
-void RenderTheme::adjustStyle(RenderStyle* style, Element* e, const CachedUAStyle* uaStyle)
+void RenderTheme::adjustStyle(RenderStyle* style, Element* e, bool uaStyleHasWebkitAppearance, bool valuesUnchangedForWebkitAppearance)
{
// Force inline and table display styles to be inline-block (except for table- which is block)
ControlPart part = style->appearance();
@@ -98,7 +98,7 @@ void RenderTheme::adjustStyle(RenderStyle* style, Element* e, const CachedUAStyl
else if (style->display() == LIST_ITEM || style->display() == TABLE)
style->setDisplay(BLOCK);
- if (uaStyle && uaStyle->hasAppearance && isControlStyled(style, uaStyle)) {
+ if (uaStyleHasWebkitAppearance && isControlStyled(style, valuesUnchangedForWebkitAppearance)) {
if (part == MenulistPart) {
style->setAppearance(MenulistButtonPart);
part = MenulistButtonPart;
@@ -551,25 +551,8 @@ bool RenderTheme::isControlContainer(ControlPart appearance) const
return appearance != CheckboxPart && appearance != RadioPart;
}
-static bool isBackgroundOrBorderStyled(const RenderStyle& style, const CachedUAStyle& uaStyle)
+bool RenderTheme::isControlStyled(const RenderStyle* style, bool valuesUnchangedForWebkitAppearance) 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 RenderTheme::isControlStyled(const RenderStyle* style, const CachedUAStyle* uaStyle) const
-{
- ASSERT(uaStyle);
-
switch (style->appearance()) {
case PushButtonPart:
case SquareButtonPart:
@@ -580,13 +563,13 @@ bool RenderTheme::isControlStyled(const RenderStyle* style, const CachedUAStyle*
case ContinuousCapacityLevelIndicatorPart:
case DiscreteCapacityLevelIndicatorPart:
case RatingLevelIndicatorPart:
- return isBackgroundOrBorderStyled(*style, *uaStyle);
+ return !valuesUnchangedForWebkitAppearance;
case MenulistPart:
case SearchFieldPart:
case TextAreaPart:
case TextFieldPart:
- return isBackgroundOrBorderStyled(*style, *uaStyle) || style->boxShadow();
+ return !valuesUnchangedForWebkitAppearance || style->boxShadow();
case SliderHorizontalPart:
case SliderVerticalPart:
« no previous file with comments | « Source/core/rendering/RenderTheme.h ('k') | Source/core/rendering/style/CachedUAStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698