Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * * Redistributions of source code must retain the above copyright | 4 * * Redistributions of source code must retain the above copyright |
| 5 * notice, this list of conditions and the following disclaimer. | 5 * notice, this list of conditions and the following disclaimer. |
| 6 * * Redistributions in binary form must reproduce the above | 6 * * Redistributions in binary form must reproduce the above |
| 7 * copyright notice, this list of conditions and the following disclaimer | 7 * copyright notice, this list of conditions and the following disclaimer |
| 8 * in the documentation and/or other materials provided with the | 8 * in the documentation and/or other materials provided with the |
| 9 * distribution. | 9 * distribution. |
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| 11 * contributors may be used to endorse or promote products derived from | 11 * contributors may be used to endorse or promote products derived from |
| 12 * this software without specific prior written permission. | 12 * this software without specific prior written permission. |
| 13 * | 13 * |
| 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/css/resolver/StyleBuilderConverter.h" | 28 #include "core/css/resolver/StyleBuilderConverter.h" |
| 29 | 29 |
| 30 #include "core/css/BasicShapeFunctions.h" | |
| 30 #include "core/css/CSSFontFeatureValue.h" | 31 #include "core/css/CSSFontFeatureValue.h" |
| 31 #include "core/css/CSSFunctionValue.h" | 32 #include "core/css/CSSFunctionValue.h" |
| 32 #include "core/css/CSSGridLineNamesValue.h" | 33 #include "core/css/CSSGridLineNamesValue.h" |
| 33 #include "core/css/CSSPrimitiveValueMappings.h" | 34 #include "core/css/CSSPrimitiveValueMappings.h" |
| 34 #include "core/css/CSSReflectValue.h" | 35 #include "core/css/CSSReflectValue.h" |
| 35 #include "core/css/CSSShadowValue.h" | 36 #include "core/css/CSSShadowValue.h" |
| 36 #include "core/css/Pair.h" | 37 #include "core/css/Pair.h" |
| 37 #include "core/css/Rect.h" | 38 #include "core/css/Rect.h" |
| 38 #include "core/svg/SVGURIReference.h" | 39 #include "core/svg/SVGURIReference.h" |
| 39 | 40 |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 711 Color color; | 712 Color color; |
| 712 if (item->color) | 713 if (item->color) |
| 713 color = convertColor(state, item->color.get()); | 714 color = convertColor(state, item->color.get()); |
| 714 else | 715 else |
| 715 color = state.style()->color(); | 716 color = state.style()->color(); |
| 716 shadows.append(ShadowData(FloatPoint(x, y), blur, spread, shadowStyle, c olor)); | 717 shadows.append(ShadowData(FloatPoint(x, y), blur, spread, shadowStyle, c olor)); |
| 717 } | 718 } |
| 718 return ShadowList::adopt(shadows); | 719 return ShadowList::adopt(shadows); |
| 719 } | 720 } |
| 720 | 721 |
| 722 PassRefPtr<ShapeValue> StyleBuilderConverter::convertShapeValue(StyleResolverSta te& state, CSSValue* value) | |
| 723 { | |
| 724 if (value->isPrimitiveValue()) { | |
| 725 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone); | |
| 726 return nullptr; | |
| 727 } | |
| 728 | |
| 729 if (value->isImageValue() || value->isImageGeneratorValue() || value->isImag eSetValue()) | |
| 730 return ShapeValue::createImageValue(state.styleImage(CSSPropertyShapeOut side, value)); | |
| 731 | |
| 732 ASSERT(value->isValueList()); | |
|
Timothy Loh
2014/10/20 12:29:57
I wouldn't bother with this since toCSSValueList c
| |
| 733 | |
| 734 RefPtr<BasicShape> shape; | |
| 735 CSSBoxType cssBox = BoxMissing; | |
| 736 CSSValueList* valueList = toCSSValueList(value); | |
| 737 for (unsigned i = 0; i < valueList->length(); ++i) { | |
| 738 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->item( i)); | |
| 739 if (primitiveValue->isShape()) | |
| 740 shape = basicShapeForValue(state, primitiveValue->getShapeValue()); | |
| 741 else | |
| 742 cssBox = CSSBoxType(*primitiveValue); | |
| 743 } | |
| 744 | |
| 745 if (shape) | |
| 746 return ShapeValue::createShapeValue(shape.release(), cssBox); | |
| 747 if (cssBox != BoxMissing) | |
| 748 return ShapeValue::createBoxShapeValue(cssBox); | |
| 749 return nullptr; | |
|
Timothy Loh
2014/10/20 12:29:57
I think we never reach this?
andersr
2014/10/20 12:36:03
Can the parser deliver an empty CSSValueList?
| |
| 750 } | |
| 751 | |
| 721 float StyleBuilderConverter::convertSpacing(StyleResolverState& state, CSSValue* value) | 752 float StyleBuilderConverter::convertSpacing(StyleResolverState& state, CSSValue* value) |
| 722 { | 753 { |
| 723 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 754 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 724 if (primitiveValue->getValueID() == CSSValueNormal) | 755 if (primitiveValue->getValueID() == CSSValueNormal) |
| 725 return 0; | 756 return 0; |
| 726 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( )); | 757 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( )); |
| 727 } | 758 } |
| 728 | 759 |
| 729 PassRefPtr<SVGLengthList> StyleBuilderConverter::convertStrokeDasharray(StyleRes olverState&, CSSValue* value) | 760 PassRefPtr<SVGLengthList> StyleBuilderConverter::convertStrokeDasharray(StyleRes olverState&, CSSValue* value) |
| 730 { | 761 { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 790 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2)); | 821 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2)); |
| 791 | 822 |
| 792 return TransformOrigin( | 823 return TransformOrigin( |
| 793 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX) , | 824 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX) , |
| 794 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY) , | 825 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY) , |
| 795 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu eZ) | 826 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu eZ) |
| 796 ); | 827 ); |
| 797 } | 828 } |
| 798 | 829 |
| 799 } // namespace blink | 830 } // namespace blink |
| OLD | NEW |