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

Unified Diff: Source/core/css/resolver/CascadedValues.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/css/resolver/CascadedValues.h ('k') | Source/core/css/resolver/StyleAdjuster.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/CascadedValues.cpp
diff --git a/Source/core/css/resolver/CascadedValues.cpp b/Source/core/css/resolver/CascadedValues.cpp
index 4520141312d2bd5df34fde80105617c69bb9abcc..c3cecc069f1174805ba18e65bd5cac3e217255cd 100644
--- a/Source/core/css/resolver/CascadedValues.cpp
+++ b/Source/core/css/resolver/CascadedValues.cpp
@@ -244,7 +244,7 @@ static CSSPropertyID resolveProperty(CSSPropertyID property, TextDirection direc
}
}
-CascadedValues::CascadedValues(StyleResolverState& state, const MatchResult& matchResult, bool onlyAddUARules)
+CascadedValues::CascadedValues(StyleResolverState& state, const MatchResult& matchResult)
: m_state(state)
{
memset(m_values, 0, sizeof(m_values));
@@ -258,11 +258,17 @@ CascadedValues::CascadedValues(StyleResolverState& state, const MatchResult& mat
m_writingMode = state.style()->writingMode();
COMPILE_ASSERT(CSSPropertyColor == CSSPropertyWebkitWritingMode + 1, CSS_color_is_after_super_high_priority);
- if (onlyAddUARules) {
- addMatchResultRange(matchResult, false, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, CSSPropertyColor, convertToCSSPropertyID(lastCSSProperty));
- } else {
- addMatchResult(matchResult, CSSPropertyColor, convertToCSSPropertyID(lastCSSProperty));
- }
+ addMatchResult(matchResult, CSSPropertyColor, convertToCSSPropertyID(lastCSSProperty));
+}
+
+CascadedValues::CascadedValues(StyleResolverState& state, const MatchResult& matchResult, WebkitAppearanceConstructorType)
+ : m_state(state)
+{
+ memset(m_values, 0, sizeof(m_values));
+ memset(m_visitedLinkValues, 0, sizeof(m_visitedLinkValues));
+ m_direction = state.style()->direction();
+ m_writingMode = state.style()->writingMode();
+ addMatchResultRange(matchResult, false, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, CSSPropertyColor, convertToCSSPropertyID(lastCSSProperty));
}
void CascadedValues::addMatchResult(const MatchResult& matchResult, CSSPropertyID firstId, CSSPropertyID lastId)
@@ -388,4 +394,28 @@ void CascadedValues::applyValues(CSSPropertyID first, CSSPropertyID last, bool i
}
}
+bool CascadedValues::valuesUnchangedForWebkitAppearance(const MatchResult& matchResult)
+{
+ static const CSSPropertyID propertiesToCompare[] = {
+ CSSPropertyBorderBottomColor, CSSPropertyBorderBottomStyle, CSSPropertyBorderBottomWidth,
+ CSSPropertyBorderLeftColor, CSSPropertyBorderLeftStyle, CSSPropertyBorderLeftWidth,
+ CSSPropertyBorderRightColor, CSSPropertyBorderRightStyle, CSSPropertyBorderRightWidth,
+ CSSPropertyBorderTopColor, CSSPropertyBorderTopStyle, CSSPropertyBorderTopWidth,
+ CSSPropertyBorderBottomLeftRadius, CSSPropertyBorderBottomRightRadius,
+ CSSPropertyBorderTopLeftRadius, CSSPropertyBorderTopRightRadius,
+ CSSPropertyBorderImageOutset, CSSPropertyBorderImageRepeat, CSSPropertyBorderImageSlice,
+ CSSPropertyBorderImageSource, CSSPropertyBorderImageWidth,
+ CSSPropertyBackgroundAttachment, CSSPropertyBackgroundBlendMode, CSSPropertyBackgroundClip,
+ CSSPropertyBackgroundColor, CSSPropertyBackgroundImage, CSSPropertyBackgroundOrigin,
+ CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPositionY, CSSPropertyBackgroundSize,
+ };
+ CascadedValues uaValues(m_state, matchResult, WebkitAppearanceConstructor);
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(propertiesToCompare); ++i) {
+ CSSPropertyID property = propertiesToCompare[i];
+ if (cascadedValue(property) != uaValues.cascadedValue(property))
+ return false;
+ }
+ return true;
+}
+
} // namespace blink
« no previous file with comments | « Source/core/css/resolver/CascadedValues.h ('k') | Source/core/css/resolver/StyleAdjuster.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698