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

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: 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/layout/LayoutTheme.h ('k') | Source/core/layout/LayoutThemeChromiumMac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutTheme.cpp
diff --git a/Source/core/layout/LayoutTheme.cpp b/Source/core/layout/LayoutTheme.cpp
index 45ca6e2167a324bd7960a41eb5f58cfb8aea8d9f..5933606f8afb638a032610cebf7dd0911fc710e9 100644
--- a/Source/core/layout/LayoutTheme.cpp
+++ b/Source/core/layout/LayoutTheme.cpp
@@ -44,6 +44,7 @@
#include "core/html/shadow/SpinButtonElement.h"
#include "core/html/shadow/TextControlInnerElements.h"
#include "core/layout/PaintInfo.h"
+#include "core/layout/style/AuthorStyleInfo.h"
#include "core/layout/style/LayoutStyle.h"
#include "core/page/FocusController.h"
#include "core/page/Page.h"
@@ -87,8 +88,10 @@ LayoutTheme::LayoutTheme()
{
}
-void LayoutTheme::adjustStyle(LayoutStyle& style, Element* e, const CachedUAStyle* uaStyle)
+void LayoutTheme::adjustStyle(LayoutStyle& style, Element* e, const AuthorStyleInfo& authorStyle)
{
+ ASSERT(style.hasAppearance());
+
// Force inline and table display styles to be inline-block (except for table- which is block)
ControlPart part = style.appearance();
if (style.display() == INLINE || style.display() == INLINE_TABLE || style.display() == TABLE_ROW_GROUP
@@ -99,7 +102,7 @@ void LayoutTheme::adjustStyle(LayoutStyle& style, Element* e, const CachedUAStyl
else if (style.display() == LIST_ITEM || style.display() == TABLE)
style.setDisplay(BLOCK);
- if (uaStyle && isControlStyled(style, uaStyle)) {
+ if (isControlStyled(style, authorStyle)) {
if (part == MenulistPart) {
style.setAppearance(MenulistButtonPart);
part = MenulistButtonPart;
@@ -545,25 +548,8 @@ bool LayoutTheme::isControlContainer(ControlPart appearance) const
return appearance != CheckboxPart && appearance != RadioPart;
}
-static bool isBackgroundOrBorderStyled(const LayoutStyle& style, const CachedUAStyle* uaStyle)
+bool LayoutTheme::isControlStyled(const LayoutStyle& style, const AuthorStyleInfo& authorStyle) 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 LayoutStyle& style, const CachedUAStyle* uaStyle) const
-{
- ASSERT(uaStyle);
-
switch (style.appearance()) {
case PushButtonPart:
case SquareButtonPart:
@@ -574,13 +560,13 @@ bool LayoutTheme::isControlStyled(const LayoutStyle& style, const CachedUAStyle*
case ContinuousCapacityLevelIndicatorPart:
case DiscreteCapacityLevelIndicatorPart:
case RatingLevelIndicatorPart:
- return isBackgroundOrBorderStyled(style, uaStyle);
+ return authorStyle.specifiesBackground() || authorStyle.specifiesBorder();
case MenulistPart:
case SearchFieldPart:
case TextAreaPart:
case TextFieldPart:
- return isBackgroundOrBorderStyled(style, uaStyle) || style.boxShadow();
+ return authorStyle.specifiesBackground() || authorStyle.specifiesBorder() || style.boxShadow();
case SliderHorizontalPart:
case SliderVerticalPart:
« no previous file with comments | « Source/core/layout/LayoutTheme.h ('k') | Source/core/layout/LayoutThemeChromiumMac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698