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

Unified Diff: third_party/WebKit/Source/core/css/resolver/CSSToStyleMap.cpp

Issue 1835403003: Allow number-percentage calc() in border-image-slice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another approach Created 4 years, 8 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 | « third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/resolver/CSSToStyleMap.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/CSSToStyleMap.cpp b/third_party/WebKit/Source/core/css/resolver/CSSToStyleMap.cpp
index a08e364af056ec5c36c4491fe21040611011e146..e761754a869145111728a33f8e79f20990c95bd4 100644
--- a/third_party/WebKit/Source/core/css/resolver/CSSToStyleMap.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/CSSToStyleMap.cpp
@@ -483,14 +483,14 @@ void CSSToStyleMap::mapNinePieceImage(StyleResolverState& state, CSSPropertyID p
}
}
-static Length convertBorderImageSliceSide(const CSSPrimitiveValue& value)
+static Length convertBorderImageSliceSide(const CSSPrimitiveValue& value, const CSSToLengthConversionData& conversionData)
{
- if (value.isPercentage())
- return Length(value.getDoubleValue(), Percent);
+ if (value.isPercentage() || value.isCalculated())
+ return value.convertToLength(conversionData);
return Length(round(value.getDoubleValue()), Fixed);
}
-void CSSToStyleMap::mapNinePieceImageSlice(StyleResolverState&, const CSSValue& value, NinePieceImage& image)
+void CSSToStyleMap::mapNinePieceImageSlice(StyleResolverState& state, const CSSValue& value, NinePieceImage& image)
{
if (!value.isBorderImageSliceValue())
return;
@@ -501,10 +501,10 @@ void CSSToStyleMap::mapNinePieceImageSlice(StyleResolverState&, const CSSValue&
// Set up a length box to represent our image slices.
LengthBox box;
const CSSQuadValue& slices = borderImageSlice.slices();
- box.m_top = convertBorderImageSliceSide(*slices.top());
- box.m_bottom = convertBorderImageSliceSide(*slices.bottom());
- box.m_left = convertBorderImageSliceSide(*slices.left());
- box.m_right = convertBorderImageSliceSide(*slices.right());
+ box.m_top = convertBorderImageSliceSide(*slices.top(), state.cssToLengthConversionData());
+ box.m_bottom = convertBorderImageSliceSide(*slices.bottom(), state.cssToLengthConversionData());
+ box.m_left = convertBorderImageSliceSide(*slices.left(), state.cssToLengthConversionData());
+ box.m_right = convertBorderImageSliceSide(*slices.right(), state.cssToLengthConversionData());
image.setImageSlices(box);
// Set our fill mode.
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698