OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 return true; | 1002 return true; |
1003 } | 1003 } |
1004 if (angle > 135.0f && angle <= 225.0f) { | 1004 if (angle > 135.0f && angle <= 225.0f) { |
1005 orientation = GO_180DEG; | 1005 orientation = GO_180DEG; |
1006 return true; | 1006 return true; |
1007 } | 1007 } |
1008 orientation = GO_270DEG; | 1008 orientation = GO_270DEG; |
1009 return true; | 1009 return true; |
1010 } | 1010 } |
1011 | 1011 |
1012 static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const Color& fgColor) | 1012 static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const StyleColor& fgC
olor) |
1013 { | 1013 { |
1014 Color color; | 1014 Color color; |
1015 if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR) | 1015 if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR) |
1016 color = fgColor; | 1016 color = fgColor.color(); |
1017 else | 1017 else |
1018 color = svgColor->color(); | 1018 color = svgColor->color(); |
1019 return color; | 1019 return color; |
1020 } | 1020 } |
1021 | 1021 |
1022 static bool numberToFloat(const CSSPrimitiveValue* primitiveValue, float& out) | 1022 static bool numberToFloat(const CSSPrimitiveValue* primitiveValue, float& out) |
1023 { | 1023 { |
1024 if (!primitiveValue) | 1024 if (!primitiveValue) |
1025 return false; | 1025 return false; |
1026 if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER) | 1026 if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 } | 1072 } |
1073 | 1073 |
1074 if (!value->isValueList()) | 1074 if (!value->isValueList()) |
1075 return; | 1075 return; |
1076 | 1076 |
1077 bool didSet = false; | 1077 bool didSet = false; |
1078 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { | 1078 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { |
1079 CSSValue* item = i.value(); | 1079 CSSValue* item = i.value(); |
1080 if (item->isImageGeneratorValue()) { | 1080 if (item->isImageGeneratorValue()) { |
1081 if (item->isGradientValue()) | 1081 if (item->isGradientValue()) |
1082 state.style()->setContent(StyleGeneratedImage::create(st
atic_cast<CSSGradientValue*>(item)->gradientWithStylesResolved(state.document()-
>textLinkColors(), state.style()->color()).get()), didSet); | 1082 state.style()->setContent(StyleGeneratedImage::create(st
atic_cast<CSSGradientValue*>(item)->gradientWithStylesResolved(state.document()-
>textLinkColors()).get()), didSet); |
1083 else | 1083 else |
1084 state.style()->setContent(StyleGeneratedImage::create(st
atic_cast<CSSImageGeneratorValue*>(item)), didSet); | 1084 state.style()->setContent(StyleGeneratedImage::create(st
atic_cast<CSSImageGeneratorValue*>(item)), didSet); |
1085 didSet = true; | 1085 didSet = true; |
1086 } else if (item->isImageSetValue()) { | 1086 } else if (item->isImageSetValue()) { |
1087 state.style()->setContent(state.elementStyleResources().setO
rPendingFromValue(CSSPropertyContent, static_cast<CSSImageSetValue*>(item)), did
Set); | 1087 state.style()->setContent(state.elementStyleResources().setO
rPendingFromValue(CSSPropertyContent, static_cast<CSSImageSetValue*>(item)), did
Set); |
1088 didSet = true; | 1088 didSet = true; |
1089 } | 1089 } |
1090 | 1090 |
1091 if (item->isImageValue()) { | 1091 if (item->isImageValue()) { |
1092 state.style()->setContent(state.elementStyleResources().cach
edOrPendingFromValue(CSSPropertyContent, toCSSImageValue(item)), didSet); | 1092 state.style()->setContent(state.elementStyleResources().cach
edOrPendingFromValue(CSSPropertyContent, toCSSImageValue(item)), didSet); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { | 1252 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { |
1253 CSSValue* currValue = i.value(); | 1253 CSSValue* currValue = i.value(); |
1254 if (!currValue->isShadowValue()) | 1254 if (!currValue->isShadowValue()) |
1255 continue; | 1255 continue; |
1256 ShadowValue* item = static_cast<ShadowValue*>(currValue); | 1256 ShadowValue* item = static_cast<ShadowValue*>(currValue); |
1257 int x = item->x->computeLength<int>(state.style(), state.rootElement
Style(), zoomFactor); | 1257 int x = item->x->computeLength<int>(state.style(), state.rootElement
Style(), zoomFactor); |
1258 int y = item->y->computeLength<int>(state.style(), state.rootElement
Style(), zoomFactor); | 1258 int y = item->y->computeLength<int>(state.style(), state.rootElement
Style(), zoomFactor); |
1259 int blur = item->blur ? item->blur->computeLength<int>(state.style()
, state.rootElementStyle(), zoomFactor) : 0; | 1259 int blur = item->blur ? item->blur->computeLength<int>(state.style()
, state.rootElementStyle(), zoomFactor) : 0; |
1260 int spread = item->spread ? item->spread->computeLength<int>(state.s
tyle(), state.rootElementStyle(), zoomFactor) : 0; | 1260 int spread = item->spread ? item->spread->computeLength<int>(state.s
tyle(), state.rootElementStyle(), zoomFactor) : 0; |
1261 ShadowStyle shadowStyle = item->style && item->style->getValueID() =
= CSSValueInset ? Inset : Normal; | 1261 ShadowStyle shadowStyle = item->style && item->style->getValueID() =
= CSSValueInset ? Inset : Normal; |
1262 Color color; | 1262 StyleColor color; |
1263 if (item->color) | 1263 if (item->color) |
1264 color = state.document()->textLinkColors().colorFromPrimitiveVal
ue(item->color.get(), state.style()->visitedDependentColor(CSSPropertyColor)); | 1264 color = state.document()->textLinkColors().colorFromPrimitiveVal
ue(item->color.get()); |
1265 else if (state.style()) | 1265 else if (state.style()) |
1266 color = state.style()->color(); | 1266 color = state.style()->color(); |
1267 | 1267 |
1268 if (!color.isValid()) | 1268 if (!color.isValid()) |
1269 color = Color::transparent; | 1269 color = Color::transparent; |
1270 OwnPtr<ShadowData> shadow = ShadowData::create(IntPoint(x, y), blur,
spread, shadowStyle, color); | 1270 OwnPtr<ShadowData> shadow = ShadowData::create(IntPoint(x, y), blur,
spread, shadowStyle, color); |
1271 if (id == CSSPropertyTextShadow) | 1271 if (id == CSSPropertyTextShadow) |
1272 state.style()->setTextShadow(shadow.release(), i.index()); // ad
d to the list if this is not the first entry | 1272 state.style()->setTextShadow(shadow.release(), i.index()); // ad
d to the list if this is not the first entry |
1273 else | 1273 else |
1274 state.style()->setBoxShadow(shadow.release(), i.index()); // add
to the list if this is not the first entry | 1274 state.style()->setBoxShadow(shadow.release(), i.index()); // add
to the list if this is not the first entry |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 | 1372 |
1373 if (perspectiveValue >= 0.0f) | 1373 if (perspectiveValue >= 0.0f) |
1374 state.style()->setPerspective(perspectiveValue); | 1374 state.style()->setPerspective(perspectiveValue); |
1375 return; | 1375 return; |
1376 } | 1376 } |
1377 case CSSPropertyWebkitTapHighlightColor: { | 1377 case CSSPropertyWebkitTapHighlightColor: { |
1378 HANDLE_INHERIT_AND_INITIAL(tapHighlightColor, TapHighlightColor); | 1378 HANDLE_INHERIT_AND_INITIAL(tapHighlightColor, TapHighlightColor); |
1379 if (!primitiveValue) | 1379 if (!primitiveValue) |
1380 break; | 1380 break; |
1381 | 1381 |
1382 Color col = state.document()->textLinkColors().colorFromPrimitiveValue(p
rimitiveValue, state.style()->visitedDependentColor(CSSPropertyColor)); | 1382 StyleColor col = state.document()->textLinkColors().colorFromPrimitiveVa
lue(primitiveValue); |
1383 state.style()->setTapHighlightColor(col); | 1383 state.style()->setTapHighlightColor(col); |
1384 return; | 1384 return; |
1385 } | 1385 } |
1386 case CSSPropertyInvalid: | 1386 case CSSPropertyInvalid: |
1387 return; | 1387 return; |
1388 // Directional properties are resolved by resolveDirectionAwareProperty() be
fore the switch. | 1388 // Directional properties are resolved by resolveDirectionAwareProperty() be
fore the switch. |
1389 case CSSPropertyWebkitBorderEndColor: | 1389 case CSSPropertyWebkitBorderEndColor: |
1390 case CSSPropertyWebkitBorderEndStyle: | 1390 case CSSPropertyWebkitBorderEndStyle: |
1391 case CSSPropertyWebkitBorderEndWidth: | 1391 case CSSPropertyWebkitBorderEndWidth: |
1392 case CSSPropertyWebkitBorderStartColor: | 1392 case CSSPropertyWebkitBorderStartColor: |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 if (!list->length()) | 2183 if (!list->length()) |
2184 return; | 2184 return; |
2185 | 2185 |
2186 CSSValue* firstValue = list->itemWithoutBoundsCheck(0); | 2186 CSSValue* firstValue = list->itemWithoutBoundsCheck(0); |
2187 if (!firstValue->isShadowValue()) | 2187 if (!firstValue->isShadowValue()) |
2188 return; | 2188 return; |
2189 ShadowValue* item = static_cast<ShadowValue*>(firstValue); | 2189 ShadowValue* item = static_cast<ShadowValue*>(firstValue); |
2190 IntPoint location(item->x->computeLength<int>(state.style(), state.rootE
lementStyle()), | 2190 IntPoint location(item->x->computeLength<int>(state.style(), state.rootE
lementStyle()), |
2191 item->y->computeLength<int>(state.style(), state.rootElementStyle())
); | 2191 item->y->computeLength<int>(state.style(), state.rootElementStyle())
); |
2192 int blur = item->blur ? item->blur->computeLength<int>(state.style(), st
ate.rootElementStyle()) : 0; | 2192 int blur = item->blur ? item->blur->computeLength<int>(state.style(), st
ate.rootElementStyle()) : 0; |
2193 Color color; | 2193 StyleColor color; |
2194 if (item->color) | 2194 if (item->color) |
2195 color = state.document()->textLinkColors().colorFromPrimitiveValue(i
tem->color.get(), state.style()->visitedDependentColor(CSSPropertyColor)); | 2195 color = state.document()->textLinkColors().colorFromPrimitiveValue(i
tem->color.get()); |
2196 | 2196 |
2197 // -webkit-svg-shadow does should not have a spread or style | 2197 // -webkit-svg-shadow does should not have a spread or style |
2198 ASSERT(!item->spread); | 2198 ASSERT(!item->spread); |
2199 ASSERT(!item->style); | 2199 ASSERT(!item->style); |
2200 | 2200 |
2201 if (!color.isValid()) | 2201 if (!color.isValid()) |
2202 color = Color::transparent; | 2202 color = Color::transparent; |
2203 state.style()->accessSVGStyle()->setShadow(ShadowData::create(location,
blur, 0, Normal, color)); | 2203 state.style()->accessSVGStyle()->setShadow(ShadowData::create(location,
blur, 0, Normal, color)); |
2204 return; | 2204 return; |
2205 } | 2205 } |
(...skipping 12 matching lines...) Expand all Loading... |
2218 case CSSPropertyMaskType: { | 2218 case CSSPropertyMaskType: { |
2219 HANDLE_SVG_INHERIT_AND_INITIAL(maskType, MaskType) | 2219 HANDLE_SVG_INHERIT_AND_INITIAL(maskType, MaskType) |
2220 if (primitiveValue) | 2220 if (primitiveValue) |
2221 state.style()->accessSVGStyle()->setMaskType(*primitiveValue); | 2221 state.style()->accessSVGStyle()->setMaskType(*primitiveValue); |
2222 break; | 2222 break; |
2223 } | 2223 } |
2224 } | 2224 } |
2225 } | 2225 } |
2226 | 2226 |
2227 } // namespace WebCore | 2227 } // namespace WebCore |
OLD | NEW |