| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> | 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
| 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 #include "StyleResolver.h" | 63 #include "StyleResolver.h" |
| 64 #include "WebCoreMemoryInstrumentation.h" | 64 #include "WebCoreMemoryInstrumentation.h" |
| 65 #include "WebKitCSSTransformValue.h" | 65 #include "WebKitCSSTransformValue.h" |
| 66 #include "WebKitFontFamilyNames.h" | 66 #include "WebKitFontFamilyNames.h" |
| 67 #include <wtf/text/StringBuilder.h> | 67 #include <wtf/text/StringBuilder.h> |
| 68 | 68 |
| 69 #if ENABLE(CSS_EXCLUSIONS) | 69 #if ENABLE(CSS_EXCLUSIONS) |
| 70 #include "ExclusionShapeValue.h" | 70 #include "ExclusionShapeValue.h" |
| 71 #endif | 71 #endif |
| 72 | 72 |
| 73 #if ENABLE(CSS_SHADERS) | |
| 74 #include "CustomFilterArrayParameter.h" | 73 #include "CustomFilterArrayParameter.h" |
| 75 #include "CustomFilterNumberParameter.h" | 74 #include "CustomFilterNumberParameter.h" |
| 76 #include "CustomFilterOperation.h" | 75 #include "CustomFilterOperation.h" |
| 77 #include "CustomFilterParameter.h" | 76 #include "CustomFilterParameter.h" |
| 78 #include "CustomFilterTransformParameter.h" | 77 #include "CustomFilterTransformParameter.h" |
| 79 #include "WebKitCSSArrayFunctionValue.h" | 78 #include "WebKitCSSArrayFunctionValue.h" |
| 80 #include "WebKitCSSMixFunctionValue.h" | 79 #include "WebKitCSSMixFunctionValue.h" |
| 81 #endif | |
| 82 | 80 |
| 83 #if ENABLE(CSS_FILTERS) | 81 #if ENABLE(CSS_FILTERS) |
| 84 #include "StyleCustomFilterProgram.h" | 82 #include "StyleCustomFilterProgram.h" |
| 85 #include "WebKitCSSFilterValue.h" | 83 #include "WebKitCSSFilterValue.h" |
| 86 #endif | 84 #endif |
| 87 | 85 |
| 88 namespace WebCore { | 86 namespace WebCore { |
| 89 | 87 |
| 90 // List of all properties we know how to compute, omitting shorthands. | 88 // List of all properties we know how to compute, omitting shorthands. |
| 91 static const CSSPropertyID computedProperties[] = { | 89 static const CSSPropertyID computedProperties[] = { |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOr
igin); | 810 style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOr
igin); |
| 813 // Note that this does not flatten to an affine transform if ENABLE(3D_RENDE
RING) is off, by design. | 811 // Note that this does not flatten to an affine transform if ENABLE(3D_RENDE
RING) is off, by design. |
| 814 | 812 |
| 815 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh
ow_bug.cgi?id=23924) | 813 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh
ow_bug.cgi?id=23924) |
| 816 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 814 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 817 list->append(matrixTransformValue(transform, style)); | 815 list->append(matrixTransformValue(transform, style)); |
| 818 | 816 |
| 819 return list.release(); | 817 return list.release(); |
| 820 } | 818 } |
| 821 | 819 |
| 822 #if ENABLE(CSS_SHADERS) | |
| 823 static PassRefPtr<CSSValue> valueForCustomFilterArrayParameter(const CustomFilte
rArrayParameter* arrayParameter) | 820 static PassRefPtr<CSSValue> valueForCustomFilterArrayParameter(const CustomFilte
rArrayParameter* arrayParameter) |
| 824 { | 821 { |
| 825 RefPtr<WebKitCSSArrayFunctionValue> arrayParameterValue = WebKitCSSArrayFunc
tionValue::create(); | 822 RefPtr<WebKitCSSArrayFunctionValue> arrayParameterValue = WebKitCSSArrayFunc
tionValue::create(); |
| 826 for (unsigned i = 0, size = arrayParameter->size(); i < size; ++i) | 823 for (unsigned i = 0, size = arrayParameter->size(); i < size; ++i) |
| 827 arrayParameterValue->append(cssValuePool().createValue(arrayParameter->v
alueAt(i), CSSPrimitiveValue::CSS_NUMBER)); | 824 arrayParameterValue->append(cssValuePool().createValue(arrayParameter->v
alueAt(i), CSSPrimitiveValue::CSS_NUMBER)); |
| 828 return arrayParameterValue.release(); | 825 return arrayParameterValue.release(); |
| 829 } | 826 } |
| 830 | 827 |
| 831 static PassRefPtr<CSSValue> valueForCustomFilterNumberParameter(const CustomFilt
erNumberParameter* numberParameter) | 828 static PassRefPtr<CSSValue> valueForCustomFilterNumberParameter(const CustomFilt
erNumberParameter* numberParameter) |
| 832 { | 829 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 854 return valueForCustomFilterArrayParameter(static_cast<const CustomFilter
ArrayParameter*>(parameter)); | 851 return valueForCustomFilterArrayParameter(static_cast<const CustomFilter
ArrayParameter*>(parameter)); |
| 855 case CustomFilterParameter::NUMBER: | 852 case CustomFilterParameter::NUMBER: |
| 856 return valueForCustomFilterNumberParameter(static_cast<const CustomFilte
rNumberParameter*>(parameter)); | 853 return valueForCustomFilterNumberParameter(static_cast<const CustomFilte
rNumberParameter*>(parameter)); |
| 857 case CustomFilterParameter::TRANSFORM: | 854 case CustomFilterParameter::TRANSFORM: |
| 858 return valueForCustomFilterTransformParameter(renderer, style, static_ca
st<const CustomFilterTransformParameter*>(parameter)); | 855 return valueForCustomFilterTransformParameter(renderer, style, static_ca
st<const CustomFilterTransformParameter*>(parameter)); |
| 859 } | 856 } |
| 860 | 857 |
| 861 ASSERT_NOT_REACHED(); | 858 ASSERT_NOT_REACHED(); |
| 862 return 0; | 859 return 0; |
| 863 } | 860 } |
| 864 #endif // ENABLE(CSS_SHADERS) | |
| 865 | 861 |
| 866 #if ENABLE(CSS_FILTERS) | 862 #if ENABLE(CSS_FILTERS) |
| 867 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(const RenderObj
ect* renderer, const RenderStyle* style) const | 863 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(const RenderObj
ect* renderer, const RenderStyle* style) const |
| 868 { | 864 { |
| 869 #if !ENABLE(CSS_SHADERS) | |
| 870 UNUSED_PARAM(renderer); | |
| 871 #endif | |
| 872 if (style->filter().operations().isEmpty()) | 865 if (style->filter().operations().isEmpty()) |
| 873 return cssValuePool().createIdentifierValue(CSSValueNone); | 866 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 874 | 867 |
| 875 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 868 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| 876 | 869 |
| 877 RefPtr<WebKitCSSFilterValue> filterValue; | 870 RefPtr<WebKitCSSFilterValue> filterValue; |
| 878 | 871 |
| 879 Vector<RefPtr<FilterOperation> >::const_iterator end = style->filter().opera
tions().end(); | 872 Vector<RefPtr<FilterOperation> >::const_iterator end = style->filter().opera
tions().end(); |
| 880 for (Vector<RefPtr<FilterOperation> >::const_iterator it = style->filter().o
perations().begin(); it != end; ++it) { | 873 for (Vector<RefPtr<FilterOperation> >::const_iterator it = style->filter().o
perations().begin(); it != end; ++it) { |
| 881 FilterOperation* filterOperation = (*it).get(); | 874 FilterOperation* filterOperation = (*it).get(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 break; | 934 break; |
| 942 } | 935 } |
| 943 case FilterOperation::DROP_SHADOW: { | 936 case FilterOperation::DROP_SHADOW: { |
| 944 DropShadowFilterOperation* dropShadowOperation = static_cast<DropSha
dowFilterOperation*>(filterOperation); | 937 DropShadowFilterOperation* dropShadowOperation = static_cast<DropSha
dowFilterOperation*>(filterOperation); |
| 945 filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::Dro
pShadowFilterOperation); | 938 filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::Dro
pShadowFilterOperation); |
| 946 // We want our computed style to look like that of a text shadow (ha
s neither spread nor inset style). | 939 // We want our computed style to look like that of a text shadow (ha
s neither spread nor inset style). |
| 947 ShadowData shadowData = ShadowData(dropShadowOperation->location(),
dropShadowOperation->stdDeviation(), 0, Normal, false, dropShadowOperation->colo
r()); | 940 ShadowData shadowData = ShadowData(dropShadowOperation->location(),
dropShadowOperation->stdDeviation(), 0, Normal, false, dropShadowOperation->colo
r()); |
| 948 filterValue->append(valueForShadow(&shadowData, CSSPropertyTextShado
w, style)); | 941 filterValue->append(valueForShadow(&shadowData, CSSPropertyTextShado
w, style)); |
| 949 break; | 942 break; |
| 950 } | 943 } |
| 951 #if ENABLE(CSS_SHADERS) | |
| 952 case FilterOperation::VALIDATED_CUSTOM: | 944 case FilterOperation::VALIDATED_CUSTOM: |
| 953 // ValidatedCustomFilterOperation is not supposed to end up in the R
enderStyle. | 945 // ValidatedCustomFilterOperation is not supposed to end up in the R
enderStyle. |
| 954 ASSERT_NOT_REACHED(); | 946 ASSERT_NOT_REACHED(); |
| 955 break; | 947 break; |
| 956 case FilterOperation::CUSTOM: { | 948 case FilterOperation::CUSTOM: { |
| 957 CustomFilterOperation* customOperation = static_cast<CustomFilterOpe
ration*>(filterOperation); | 949 CustomFilterOperation* customOperation = static_cast<CustomFilterOpe
ration*>(filterOperation); |
| 958 filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::Cus
tomFilterOperation); | 950 filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::Cus
tomFilterOperation); |
| 959 | 951 |
| 960 // The output should be verbose, even if the values are the default
ones. | 952 // The output should be verbose, even if the values are the default
ones. |
| 961 | 953 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 const CustomFilterParameter* parameter = parameters.at(i).get(); | 996 const CustomFilterParameter* parameter = parameters.at(i).get(); |
| 1005 RefPtr<CSSValueList> parameterCSSNameAndValue = CSSValueList::cr
eateSpaceSeparated(); | 997 RefPtr<CSSValueList> parameterCSSNameAndValue = CSSValueList::cr
eateSpaceSeparated(); |
| 1006 parameterCSSNameAndValue->append(cssValuePool().createValue(para
meter->name(), CSSPrimitiveValue::CSS_STRING)); | 998 parameterCSSNameAndValue->append(cssValuePool().createValue(para
meter->name(), CSSPrimitiveValue::CSS_STRING)); |
| 1007 parameterCSSNameAndValue->append(valueForCustomFilterParameter(r
enderer, style, parameter)); | 999 parameterCSSNameAndValue->append(valueForCustomFilterParameter(r
enderer, style, parameter)); |
| 1008 parametersCSSValue->append(parameterCSSNameAndValue.release()); | 1000 parametersCSSValue->append(parameterCSSNameAndValue.release()); |
| 1009 } | 1001 } |
| 1010 | 1002 |
| 1011 filterValue->append(parametersCSSValue.release()); | 1003 filterValue->append(parametersCSSValue.release()); |
| 1012 break; | 1004 break; |
| 1013 } | 1005 } |
| 1014 #endif | |
| 1015 default: | 1006 default: |
| 1016 filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::Unk
nownFilterOperation); | 1007 filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::Unk
nownFilterOperation); |
| 1017 break; | 1008 break; |
| 1018 } | 1009 } |
| 1019 list->append(filterValue); | 1010 list->append(filterValue); |
| 1020 } | 1011 } |
| 1021 | 1012 |
| 1022 return list.release(); | 1013 return list.release(); |
| 1023 } | 1014 } |
| 1024 #endif | 1015 #endif |
| (...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3018 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB
ackgroundSize, CSSPropertyBackgroundOrigin, | 3009 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB
ackgroundSize, CSSPropertyBackgroundOrigin, |
| 3019 CSSPropertyB
ackgroundClip }; | 3010 CSSPropertyB
ackgroundClip }; |
| 3020 | 3011 |
| 3021 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); | 3012 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); |
| 3022 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha
nd(propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperat
or)))); | 3013 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha
nd(propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperat
or)))); |
| 3023 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha
nd(propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator
)))); | 3014 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha
nd(propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator
)))); |
| 3024 return list.release(); | 3015 return list.release(); |
| 3025 } | 3016 } |
| 3026 | 3017 |
| 3027 } // namespace WebCore | 3018 } // namespace WebCore |
| OLD | NEW |