Chromium Code Reviews| Index: Source/core/css/CSSToStyleMap.cpp |
| diff --git a/Source/core/css/CSSToStyleMap.cpp b/Source/core/css/CSSToStyleMap.cpp |
| index 10530f487d080f296c199bb96fe74af669677dbe..f37fced4419538325786eff223f88171dbf469b5 100644 |
| --- a/Source/core/css/CSSToStyleMap.cpp |
| +++ b/Source/core/css/CSSToStyleMap.cpp |
| @@ -610,49 +610,31 @@ void CSSToStyleMap::mapNinePieceImageSlice(CSSValue* value, NinePieceImage& imag |
| image.setFill(borderImageSlice->m_fill); |
| } |
| +static BorderImageLength toBorderImageLength(CSSPrimitiveValue& value, const RenderStyle* currStyle, const RenderStyle* rootStyle, float multiplier) |
|
Julien - ping for review
2013/11/24 22:53:01
s/currStyle/currentStyle/ (3 characters isn't much
davve
2013/11/25 22:15:16
Done.
|
| +{ |
| + if (value.isNumber()) |
| + return value.getDoubleValue(); |
| + if (value.isPercentage()) |
| + return Length(value.getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent); |
| + if (value.getValueID() != CSSValueAuto) |
| + return value.computeLength<Length>(currStyle, rootStyle, multiplier); |
| + return Length(Auto); |
| +} |
| + |
| BorderImageLengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value) const |
| { |
| if (!value || !value->isPrimitiveValue()) |
| - return BorderImageLengthBox(); |
| + return BorderImageLengthBox(Length(Auto)); |
| - // Get our zoom value. |
| float zoom = useSVGZoomRules() ? 1.0f : style()->effectiveZoom(); |
| - |
| - // Retrieve the primitive value. |
| - CSSPrimitiveValue* borderWidths = toCSSPrimitiveValue(value); |
| - |
| - // Set up a length box to represent our image slices. |
| - BorderImageLengthBox box; // Defaults to 'auto' so we don't have to handle that explicitly below. |
| - Quad* slices = borderWidths->getQuadValue(); |
| - if (slices->top()->isNumber()) |
| - box.setTop(slices->top()->getDoubleValue()); |
| - else if (slices->top()->isPercentage()) |
| - box.setTop(Length(slices->top()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent)); |
| - else if (slices->top()->getValueID() != CSSValueAuto) |
| - box.setTop(slices->top()->computeLength<Length>(style(), rootElementStyle(), zoom)); |
| - |
| - if (slices->right()->isNumber()) |
| - box.setRight(slices->right()->getDoubleValue()); |
| - else if (slices->right()->isPercentage()) |
| - box.setRight(Length(slices->right()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent)); |
| - else if (slices->right()->getValueID() != CSSValueAuto) |
| - box.setRight(slices->right()->computeLength<Length>(style(), rootElementStyle(), zoom)); |
| - |
| - if (slices->bottom()->isNumber()) |
| - box.setBottom(slices->bottom()->getDoubleValue()); |
| - else if (slices->bottom()->isPercentage()) |
| - box.setBottom(Length(slices->bottom()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent)); |
| - else if (slices->bottom()->getValueID() != CSSValueAuto) |
| - box.setBottom(slices->bottom()->computeLength<Length>(style(), rootElementStyle(), zoom)); |
| - |
| - if (slices->left()->isNumber()) |
| - box.setLeft(slices->left()->getDoubleValue()); |
| - else if (slices->left()->isPercentage()) |
| - box.setLeft(Length(slices->left()->getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent)); |
| - else if (slices->left()->getValueID() != CSSValueAuto) |
| - box.setLeft(slices->left()->computeLength<Length>(style(), rootElementStyle(), zoom)); |
| - |
| - return box; |
| + Quad* slices = toCSSPrimitiveValue(value)->getQuadValue(); |
| + |
| + // Set up a border image length box to represent our image slices. |
| + return BorderImageLengthBox( |
| + toBorderImageLength(*slices->top(), style(), rootElementStyle(), zoom), |
| + toBorderImageLength(*slices->right(), style(), rootElementStyle(), zoom), |
| + toBorderImageLength(*slices->bottom(), style(), rootElementStyle(), zoom), |
| + toBorderImageLength(*slices->left(), style(), rootElementStyle(), zoom)); |
| } |
| void CSSToStyleMap::mapNinePieceImageRepeat(CSSValue* value, NinePieceImage& image) const |