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); | 44 return CSSPrimitiveValue::create(center.length(), style.effectiveZoom())
; |
45 | 45 |
46 CSSValueID keyword = orientation == HORIZONTAL ? CSSValueRight : CSSValueBot
tom; | 46 CSSValueID keyword = orientation == HORIZONTAL ? CSSValueRight : CSSValueBot
tom; |
47 | 47 |
48 return CSSValuePair::create(CSSPrimitiveValue::createIdentifier(keyword), CS
SPrimitiveValue::create(center.length(), style), CSSValuePair::DropIdenticalValu
es); | 48 return CSSValuePair::create( |
| 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); |
49 } | 60 } |
50 | 61 |
51 static CSSPrimitiveValue* basicShapeRadiusToCSSValue(const ComputedStyle& style,
const BasicShapeRadius& radius) | 62 static CSSPrimitiveValue* basicShapeRadiusToCSSValue(const ComputedStyle& style,
const BasicShapeRadius& radius) |
52 { | 63 { |
53 switch (radius.type()) { | 64 switch (radius.type()) { |
54 case BasicShapeRadius::Value: | 65 case BasicShapeRadius::Value: |
55 return CSSPrimitiveValue::create(radius.value(), style); | 66 return CSSPrimitiveValue::create(radius.value(), style.effectiveZoom()); |
56 case BasicShapeRadius::ClosestSide: | 67 case BasicShapeRadius::ClosestSide: |
57 return CSSPrimitiveValue::createIdentifier(CSSValueClosestSide); | 68 return CSSPrimitiveValue::createIdentifier(CSSValueClosestSide); |
58 case BasicShapeRadius::FarthestSide: | 69 case BasicShapeRadius::FarthestSide: |
59 return CSSPrimitiveValue::createIdentifier(CSSValueFarthestSide); | 70 return CSSPrimitiveValue::createIdentifier(CSSValueFarthestSide); |
60 } | 71 } |
61 | 72 |
62 ASSERT_NOT_REACHED(); | 73 ASSERT_NOT_REACHED(); |
63 return nullptr; | 74 return nullptr; |
64 } | 75 } |
65 | 76 |
(...skipping 18 matching lines...) Expand all Loading... |
84 ellipseValue->setRadiusX(basicShapeRadiusToCSSValue(style, ellipse->radi
usX())); | 95 ellipseValue->setRadiusX(basicShapeRadiusToCSSValue(style, ellipse->radi
usX())); |
85 ellipseValue->setRadiusY(basicShapeRadiusToCSSValue(style, ellipse->radi
usY())); | 96 ellipseValue->setRadiusY(basicShapeRadiusToCSSValue(style, ellipse->radi
usY())); |
86 return ellipseValue; | 97 return ellipseValue; |
87 } | 98 } |
88 case BasicShape::BasicShapePolygonType: { | 99 case BasicShape::BasicShapePolygonType: { |
89 const BasicShapePolygon* polygon = toBasicShapePolygon(basicShape); | 100 const BasicShapePolygon* polygon = toBasicShapePolygon(basicShape); |
90 CSSBasicShapePolygonValue* polygonValue = CSSBasicShapePolygonValue::cre
ate(); | 101 CSSBasicShapePolygonValue* polygonValue = CSSBasicShapePolygonValue::cre
ate(); |
91 | 102 |
92 polygonValue->setWindRule(polygon->getWindRule()); | 103 polygonValue->setWindRule(polygon->getWindRule()); |
93 const Vector<Length>& values = polygon->values(); | 104 const Vector<Length>& values = polygon->values(); |
94 for (unsigned i = 0; i < values.size(); i += 2) | 105 for (unsigned i = 0; i < values.size(); i += 2) { |
95 polygonValue->appendPoint(CSSPrimitiveValue::create(values.at(i), st
yle), CSSPrimitiveValue::create(values.at(i + 1), style)); | 106 polygonValue->appendPoint( |
96 | 107 CSSPrimitiveValue::create(values.at(i), style.effectiveZoom()), |
| 108 CSSPrimitiveValue::create(values.at(i + 1), style.effectiveZoom(
))); |
| 109 } |
97 return polygonValue; | 110 return polygonValue; |
98 } | 111 } |
99 case BasicShape::BasicShapeInsetType: { | 112 case BasicShape::BasicShapeInsetType: { |
100 const BasicShapeInset* inset = toBasicShapeInset(basicShape); | 113 const BasicShapeInset* inset = toBasicShapeInset(basicShape); |
101 CSSBasicShapeInsetValue* insetValue = CSSBasicShapeInsetValue::create(); | 114 CSSBasicShapeInsetValue* insetValue = CSSBasicShapeInsetValue::create(); |
102 | 115 |
103 insetValue->setTop(CSSPrimitiveValue::create(inset->top(), style)); | 116 insetValue->setTop(CSSPrimitiveValue::create(inset->top(), style.effecti
veZoom())); |
104 insetValue->setRight(CSSPrimitiveValue::create(inset->right(), style)); | 117 insetValue->setRight(CSSPrimitiveValue::create(inset->right(), style.eff
ectiveZoom())); |
105 insetValue->setBottom(CSSPrimitiveValue::create(inset->bottom(), style))
; | 118 insetValue->setBottom(CSSPrimitiveValue::create(inset->bottom(), style.e
ffectiveZoom())); |
106 insetValue->setLeft(CSSPrimitiveValue::create(inset->left(), style)); | 119 insetValue->setLeft(CSSPrimitiveValue::create(inset->left(), style.effec
tiveZoom())); |
107 | 120 |
108 insetValue->setTopLeftRadius(CSSValuePair::create(inset->topLeftRadius()
, style)); | 121 insetValue->setTopLeftRadius(valueForLengthSize(inset->topLeftRadius(),
style)); |
109 insetValue->setTopRightRadius(CSSValuePair::create(inset->topRightRadius
(), style)); | 122 insetValue->setTopRightRadius(valueForLengthSize(inset->topRightRadius()
, style)); |
110 insetValue->setBottomRightRadius(CSSValuePair::create(inset->bottomRight
Radius(), style)); | 123 insetValue->setBottomRightRadius(valueForLengthSize(inset->bottomRightRa
dius(), style)); |
111 insetValue->setBottomLeftRadius(CSSValuePair::create(inset->bottomLeftRa
dius(), style)); | 124 insetValue->setBottomLeftRadius(valueForLengthSize(inset->bottomLeftRadi
us(), style)); |
112 | 125 |
113 return insetValue; | 126 return insetValue; |
114 } | 127 } |
115 default: | 128 default: |
116 return nullptr; | 129 return nullptr; |
117 } | 130 } |
118 } | 131 } |
119 | 132 |
120 static Length convertToLength(const StyleResolverState& state, const CSSPrimitiv
eValue* value) | 133 static Length convertToLength(const StyleResolverState& state, const CSSPrimitiv
eValue* value) |
121 { | 134 { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 } | 260 } |
248 | 261 |
249 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente
rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) | 262 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente
rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) |
250 { | 263 { |
251 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); | 264 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); |
252 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); | 265 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); |
253 return FloatPoint(x, y); | 266 return FloatPoint(x, y); |
254 } | 267 } |
255 | 268 |
256 } // namespace blink | 269 } // namespace blink |
OLD | NEW |