| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 26 * Boston, MA 02110-1301, USA. | 26 * Boston, MA 02110-1301, USA. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 #include "core/css/resolver/FilterOperationResolver.h" | 30 #include "core/css/resolver/FilterOperationResolver.h" |
| 31 | 31 |
| 32 #include "core/css/CSSFunctionValue.h" | 32 #include "core/css/CSSFunctionValue.h" |
| 33 #include "core/css/CSSPrimitiveValueMappings.h" | 33 #include "core/css/CSSPrimitiveValueMappings.h" |
| 34 #include "core/css/CSSShadowValue.h" | 34 #include "core/css/CSSShadowValue.h" |
| 35 #include "core/css/resolver/TransformBuilder.h" | 35 #include "core/css/resolver/StyleResolverState.h" |
| 36 #include "core/layout/svg/ReferenceFilterBuilder.h" | 36 #include "core/layout/svg/ReferenceFilterBuilder.h" |
| 37 #include "core/svg/SVGElement.h" | 37 #include "core/svg/SVGElement.h" |
| 38 #include "core/svg/SVGURIReference.h" | 38 #include "core/svg/SVGURIReference.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 static FilterOperation::OperationType filterOperationForType(CSSValueID type) | 42 static FilterOperation::OperationType filterOperationForType(CSSValueID type) |
| 43 { | 43 { |
| 44 switch (type) { | 44 switch (type) { |
| 45 case CSSValueUrl: | 45 case CSSValueUrl: |
| (...skipping 18 matching lines...) Expand all Loading... |
| 64 return FilterOperation::BLUR; | 64 return FilterOperation::BLUR; |
| 65 case CSSValueDropShadow: | 65 case CSSValueDropShadow: |
| 66 return FilterOperation::DROP_SHADOW; | 66 return FilterOperation::DROP_SHADOW; |
| 67 default: | 67 default: |
| 68 ASSERT_NOT_REACHED(); | 68 ASSERT_NOT_REACHED(); |
| 69 // FIXME: We shouldn't have a type None since we never create them | 69 // FIXME: We shouldn't have a type None since we never create them |
| 70 return FilterOperation::NONE; | 70 return FilterOperation::NONE; |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 void FilterOperationResolver::createFilterOperations(const CSSValue& inValue, co
nst CSSToLengthConversionData& conversionData, FilterOperations& outOperations,
StyleResolverState& state) | 74 FilterOperations FilterOperationResolver::createFilterOperations(StyleResolverSt
ate& state, const CSSValue& inValue) |
| 75 { | 75 { |
| 76 ASSERT(outOperations.isEmpty()); | 76 FilterOperations operations; |
| 77 | 77 |
| 78 if (inValue.isPrimitiveValue()) { | 78 if (inValue.isPrimitiveValue()) { |
| 79 ASSERT(toCSSPrimitiveValue(inValue).getValueID() == CSSValueNone); | 79 ASSERT(toCSSPrimitiveValue(inValue).getValueID() == CSSValueNone); |
| 80 return; | 80 return operations; |
| 81 } | 81 } |
| 82 | 82 |
| 83 FilterOperations operations; | 83 const CSSToLengthConversionData& conversionData = state.cssToLengthConversio
nData(); |
| 84 for (auto& currValue : toCSSValueList(inValue)) { | 84 for (auto& currValue : toCSSValueList(inValue)) { |
| 85 CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get()); | 85 CSSFunctionValue* filterValue = toCSSFunctionValue(currValue.get()); |
| 86 FilterOperation::OperationType operationType = filterOperationForType(fi
lterValue->functionType()); | 86 FilterOperation::OperationType operationType = filterOperationForType(fi
lterValue->functionType()); |
| 87 ASSERT(filterValue->length() <= 1); | 87 ASSERT(filterValue->length() <= 1); |
| 88 | 88 |
| 89 if (operationType == FilterOperation::REFERENCE) { | 89 if (operationType == FilterOperation::REFERENCE) { |
| 90 CSSSVGDocumentValue* svgDocumentValue = toCSSSVGDocumentValue(filter
Value->item(0)); | 90 CSSSVGDocumentValue* svgDocumentValue = toCSSSVGDocumentValue(filter
Value->item(0)); |
| 91 KURL url = state.document().completeURL(svgDocumentValue->url()); | 91 KURL url = state.document().completeURL(svgDocumentValue->url()); |
| 92 | 92 |
| 93 RefPtrWillBeRawPtr<ReferenceFilterOperation> operation = ReferenceFi
lterOperation::create(svgDocumentValue->url(), AtomicString(url.fragmentIdentifi
er())); | 93 RefPtrWillBeRawPtr<ReferenceFilterOperation> operation = ReferenceFi
lterOperation::create(svgDocumentValue->url(), AtomicString(url.fragmentIdentifi
er())); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 operations.operations().append(DropShadowFilterOperation::create(loc
ation, blur, shadowColor)); | 156 operations.operations().append(DropShadowFilterOperation::create(loc
ation, blur, shadowColor)); |
| 157 break; | 157 break; |
| 158 } | 158 } |
| 159 default: | 159 default: |
| 160 ASSERT_NOT_REACHED(); | 160 ASSERT_NOT_REACHED(); |
| 161 break; | 161 break; |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 outOperations = operations; | 165 return operations; |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace blink | 168 } // namespace blink |
| OLD | NEW |