| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
| 9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
| 10 * disclaimer. | 10 * disclaimer. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "core/css/CSSValuePair.h" | 34 #include "core/css/CSSValuePair.h" |
| 35 #include "core/css/resolver/StyleResolverState.h" | 35 #include "core/css/resolver/StyleResolverState.h" |
| 36 #include "core/style/BasicShapes.h" | 36 #include "core/style/BasicShapes.h" |
| 37 #include "core/style/ComputedStyle.h" | 37 #include "core/style/ComputedStyle.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 static CSSValue* valueForCenterCoordinate(const ComputedStyle& style, const Basi
cShapeCenterCoordinate& center, EBoxOrient orientation) | 41 static CSSValue* valueForCenterCoordinate(const ComputedStyle& style, const Basi
cShapeCenterCoordinate& center, EBoxOrient orientation) |
| 42 { | 42 { |
| 43 if (center.getDirection() == BasicShapeCenterCoordinate::TopLeft) | 43 if (center.getDirection() == BasicShapeCenterCoordinate::TopLeft) |
| 44 return CSSPrimitiveValue::create(center.length(), style.effectiveZoom())
; | 44 return CSSPrimitiveValue::create(center.length(), style); |
| 45 | 45 |
| 46 CSSValueID keyword = orientation == HORIZONTAL ? CSSValueRight : CSSValueBot
tom; | 46 CSSValueID keyword = orientation == HORIZONTAL ? CSSValueRight : CSSValueBot
tom; |
| 47 | 47 |
| 48 return CSSValuePair::create( | 48 return CSSValuePair::create(CSSPrimitiveValue::createIdentifier(keyword), CS
SPrimitiveValue::create(center.length(), style), CSSValuePair::DropIdenticalValu
es); |
| 49 CSSPrimitiveValue::createIdentifier(keyword), | |
| 50 CSSPrimitiveValue::create(center.length(), style.effectiveZoom()), | |
| 51 CSSValuePair::DropIdenticalValues); | |
| 52 } | |
| 53 | |
| 54 static CSSValuePair* valueForLengthSize(const LengthSize& lengthSize, const Comp
utedStyle& style) | |
| 55 { | |
| 56 return CSSValuePair::create( | |
| 57 CSSPrimitiveValue::create(lengthSize.width(), style.effectiveZoom()), | |
| 58 CSSPrimitiveValue::create(lengthSize.height(), style.effectiveZoom()), | |
| 59 CSSValuePair::KeepIdenticalValues); | |
| 60 } | 49 } |
| 61 | 50 |
| 62 static CSSPrimitiveValue* basicShapeRadiusToCSSValue(const ComputedStyle& style,
const BasicShapeRadius& radius) | 51 static CSSPrimitiveValue* basicShapeRadiusToCSSValue(const ComputedStyle& style,
const BasicShapeRadius& radius) |
| 63 { | 52 { |
| 64 switch (radius.type()) { | 53 switch (radius.type()) { |
| 65 case BasicShapeRadius::Value: | 54 case BasicShapeRadius::Value: |
| 66 return CSSPrimitiveValue::create(radius.value(), style.effectiveZoom()); | 55 return CSSPrimitiveValue::create(radius.value(), style); |
| 67 case BasicShapeRadius::ClosestSide: | 56 case BasicShapeRadius::ClosestSide: |
| 68 return CSSPrimitiveValue::createIdentifier(CSSValueClosestSide); | 57 return CSSPrimitiveValue::createIdentifier(CSSValueClosestSide); |
| 69 case BasicShapeRadius::FarthestSide: | 58 case BasicShapeRadius::FarthestSide: |
| 70 return CSSPrimitiveValue::createIdentifier(CSSValueFarthestSide); | 59 return CSSPrimitiveValue::createIdentifier(CSSValueFarthestSide); |
| 71 } | 60 } |
| 72 | 61 |
| 73 ASSERT_NOT_REACHED(); | 62 ASSERT_NOT_REACHED(); |
| 74 return nullptr; | 63 return nullptr; |
| 75 } | 64 } |
| 76 | 65 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 95 ellipseValue->setRadiusX(basicShapeRadiusToCSSValue(style, ellipse->radi
usX())); | 84 ellipseValue->setRadiusX(basicShapeRadiusToCSSValue(style, ellipse->radi
usX())); |
| 96 ellipseValue->setRadiusY(basicShapeRadiusToCSSValue(style, ellipse->radi
usY())); | 85 ellipseValue->setRadiusY(basicShapeRadiusToCSSValue(style, ellipse->radi
usY())); |
| 97 return ellipseValue; | 86 return ellipseValue; |
| 98 } | 87 } |
| 99 case BasicShape::BasicShapePolygonType: { | 88 case BasicShape::BasicShapePolygonType: { |
| 100 const BasicShapePolygon* polygon = toBasicShapePolygon(basicShape); | 89 const BasicShapePolygon* polygon = toBasicShapePolygon(basicShape); |
| 101 CSSBasicShapePolygonValue* polygonValue = CSSBasicShapePolygonValue::cre
ate(); | 90 CSSBasicShapePolygonValue* polygonValue = CSSBasicShapePolygonValue::cre
ate(); |
| 102 | 91 |
| 103 polygonValue->setWindRule(polygon->getWindRule()); | 92 polygonValue->setWindRule(polygon->getWindRule()); |
| 104 const Vector<Length>& values = polygon->values(); | 93 const Vector<Length>& values = polygon->values(); |
| 105 for (unsigned i = 0; i < values.size(); i += 2) { | 94 for (unsigned i = 0; i < values.size(); i += 2) |
| 106 polygonValue->appendPoint( | 95 polygonValue->appendPoint(CSSPrimitiveValue::create(values.at(i), st
yle), CSSPrimitiveValue::create(values.at(i + 1), style)); |
| 107 CSSPrimitiveValue::create(values.at(i), style.effectiveZoom()), | 96 |
| 108 CSSPrimitiveValue::create(values.at(i + 1), style.effectiveZoom(
))); | |
| 109 } | |
| 110 return polygonValue; | 97 return polygonValue; |
| 111 } | 98 } |
| 112 case BasicShape::BasicShapeInsetType: { | 99 case BasicShape::BasicShapeInsetType: { |
| 113 const BasicShapeInset* inset = toBasicShapeInset(basicShape); | 100 const BasicShapeInset* inset = toBasicShapeInset(basicShape); |
| 114 CSSBasicShapeInsetValue* insetValue = CSSBasicShapeInsetValue::create(); | 101 CSSBasicShapeInsetValue* insetValue = CSSBasicShapeInsetValue::create(); |
| 115 | 102 |
| 116 insetValue->setTop(CSSPrimitiveValue::create(inset->top(), style.effecti
veZoom())); | 103 insetValue->setTop(CSSPrimitiveValue::create(inset->top(), style)); |
| 117 insetValue->setRight(CSSPrimitiveValue::create(inset->right(), style.eff
ectiveZoom())); | 104 insetValue->setRight(CSSPrimitiveValue::create(inset->right(), style)); |
| 118 insetValue->setBottom(CSSPrimitiveValue::create(inset->bottom(), style.e
ffectiveZoom())); | 105 insetValue->setBottom(CSSPrimitiveValue::create(inset->bottom(), style))
; |
| 119 insetValue->setLeft(CSSPrimitiveValue::create(inset->left(), style.effec
tiveZoom())); | 106 insetValue->setLeft(CSSPrimitiveValue::create(inset->left(), style)); |
| 120 | 107 |
| 121 insetValue->setTopLeftRadius(valueForLengthSize(inset->topLeftRadius(),
style)); | 108 insetValue->setTopLeftRadius(CSSValuePair::create(inset->topLeftRadius()
, style)); |
| 122 insetValue->setTopRightRadius(valueForLengthSize(inset->topRightRadius()
, style)); | 109 insetValue->setTopRightRadius(CSSValuePair::create(inset->topRightRadius
(), style)); |
| 123 insetValue->setBottomRightRadius(valueForLengthSize(inset->bottomRightRa
dius(), style)); | 110 insetValue->setBottomRightRadius(CSSValuePair::create(inset->bottomRight
Radius(), style)); |
| 124 insetValue->setBottomLeftRadius(valueForLengthSize(inset->bottomLeftRadi
us(), style)); | 111 insetValue->setBottomLeftRadius(CSSValuePair::create(inset->bottomLeftRa
dius(), style)); |
| 125 | 112 |
| 126 return insetValue; | 113 return insetValue; |
| 127 } | 114 } |
| 128 default: | 115 default: |
| 129 return nullptr; | 116 return nullptr; |
| 130 } | 117 } |
| 131 } | 118 } |
| 132 | 119 |
| 133 static Length convertToLength(const StyleResolverState& state, const CSSPrimitiv
eValue* value) | 120 static Length convertToLength(const StyleResolverState& state, const CSSPrimitiv
eValue* value) |
| 134 { | 121 { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 } | 247 } |
| 261 | 248 |
| 262 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente
rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) | 249 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente
rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) |
| 263 { | 250 { |
| 264 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); | 251 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); |
| 265 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); | 252 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); |
| 266 return FloatPoint(x, y); | 253 return FloatPoint(x, y); |
| 267 } | 254 } |
| 268 | 255 |
| 269 } // namespace blink | 256 } // namespace blink |
| OLD | NEW |