| 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/CSSValuePool.h" | 35 #include "core/css/CSSValuePool.h" |
| 36 #include "core/css/resolver/StyleResolverState.h" | 36 #include "core/css/resolver/StyleResolverState.h" |
| 37 #include "core/style/BasicShapes.h" | 37 #include "core/style/BasicShapes.h" |
| 38 #include "core/style/ComputedStyle.h" | 38 #include "core/style/ComputedStyle.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 static PassRefPtrWillBeRawPtr<CSSValue> valueForCenterCoordinate(CSSValuePool& p
ool, const ComputedStyle& style, const BasicShapeCenterCoordinate& center, EBoxO
rient orientation) | 42 static PassRefPtrWillBeRawPtr<CSSValue> valueForCenterCoordinate(CSSValuePool& p
ool, const ComputedStyle& style, const BasicShapeCenterCoordinate& center, EBoxO
rient orientation) |
| 43 { | 43 { |
| 44 if (center.direction() == BasicShapeCenterCoordinate::TopLeft) | 44 if (center.getDirection() == BasicShapeCenterCoordinate::TopLeft) |
| 45 return pool.createValue(center.length(), style); | 45 return pool.createValue(center.length(), style); |
| 46 | 46 |
| 47 CSSValueID keyword = orientation == HORIZONTAL ? CSSValueRight : CSSValueBot
tom; | 47 CSSValueID keyword = orientation == HORIZONTAL ? CSSValueRight : CSSValueBot
tom; |
| 48 | 48 |
| 49 return CSSValuePair::create(pool.createIdentifierValue(keyword), pool.create
Value(center.length(), style), CSSValuePair::DropIdenticalValues); | 49 return CSSValuePair::create(pool.createIdentifierValue(keyword), pool.create
Value(center.length(), style), CSSValuePair::DropIdenticalValues); |
| 50 } | 50 } |
| 51 | 51 |
| 52 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> basicShapeRadiusToCSSValue(CSSV
aluePool& pool, const ComputedStyle& style, const BasicShapeRadius& radius) | 52 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> basicShapeRadiusToCSSValue(CSSV
aluePool& pool, const ComputedStyle& style, const BasicShapeRadius& radius) |
| 53 { | 53 { |
| 54 switch (radius.type()) { | 54 switch (radius.type()) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 84 ellipseValue->setCenterX(valueForCenterCoordinate(pool, style, ellipse->
centerX(), HORIZONTAL)); | 84 ellipseValue->setCenterX(valueForCenterCoordinate(pool, style, ellipse->
centerX(), HORIZONTAL)); |
| 85 ellipseValue->setCenterY(valueForCenterCoordinate(pool, style, ellipse->
centerY(), VERTICAL)); | 85 ellipseValue->setCenterY(valueForCenterCoordinate(pool, style, ellipse->
centerY(), VERTICAL)); |
| 86 ellipseValue->setRadiusX(basicShapeRadiusToCSSValue(pool, style, ellipse
->radiusX())); | 86 ellipseValue->setRadiusX(basicShapeRadiusToCSSValue(pool, style, ellipse
->radiusX())); |
| 87 ellipseValue->setRadiusY(basicShapeRadiusToCSSValue(pool, style, ellipse
->radiusY())); | 87 ellipseValue->setRadiusY(basicShapeRadiusToCSSValue(pool, style, ellipse
->radiusY())); |
| 88 return ellipseValue.release(); | 88 return ellipseValue.release(); |
| 89 } | 89 } |
| 90 case BasicShape::BasicShapePolygonType: { | 90 case BasicShape::BasicShapePolygonType: { |
| 91 const BasicShapePolygon* polygon = toBasicShapePolygon(basicShape); | 91 const BasicShapePolygon* polygon = toBasicShapePolygon(basicShape); |
| 92 RefPtrWillBeRawPtr<CSSBasicShapePolygonValue> polygonValue = CSSBasicSha
pePolygonValue::create(); | 92 RefPtrWillBeRawPtr<CSSBasicShapePolygonValue> polygonValue = CSSBasicSha
pePolygonValue::create(); |
| 93 | 93 |
| 94 polygonValue->setWindRule(polygon->windRule()); | 94 polygonValue->setWindRule(polygon->getWindRule()); |
| 95 const Vector<Length>& values = polygon->values(); | 95 const Vector<Length>& values = polygon->values(); |
| 96 for (unsigned i = 0; i < values.size(); i += 2) | 96 for (unsigned i = 0; i < values.size(); i += 2) |
| 97 polygonValue->appendPoint(pool.createValue(values.at(i), style), poo
l.createValue(values.at(i + 1), style)); | 97 polygonValue->appendPoint(pool.createValue(values.at(i), style), poo
l.createValue(values.at(i + 1), style)); |
| 98 | 98 |
| 99 return polygonValue.release(); | 99 return polygonValue.release(); |
| 100 } | 100 } |
| 101 case BasicShape::BasicShapeInsetType: { | 101 case BasicShape::BasicShapeInsetType: { |
| 102 const BasicShapeInset* inset = toBasicShapeInset(basicShape); | 102 const BasicShapeInset* inset = toBasicShapeInset(basicShape); |
| 103 RefPtrWillBeRawPtr<CSSBasicShapeInsetValue> insetValue = CSSBasicShapeIn
setValue::create(); | 103 RefPtrWillBeRawPtr<CSSBasicShapeInsetValue> insetValue = CSSBasicShapeIn
setValue::create(); |
| 104 | 104 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 249 } |
| 250 | 250 |
| 251 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente
rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) | 251 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente
rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) |
| 252 { | 252 { |
| 253 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); | 253 float x = floatValueForLength(centerX.computedLength(), boxSize.width()); |
| 254 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); | 254 float y = floatValueForLength(centerY.computedLength(), boxSize.height()); |
| 255 return FloatPoint(x, y); | 255 return FloatPoint(x, y); |
| 256 } | 256 } |
| 257 | 257 |
| 258 } // namespace blink | 258 } // namespace blink |
| OLD | NEW |