| 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 if (primitiveValue->isValueID() && primitiveValue->getValueID() != CSSValueW
ebkitMatchParent) | 658 if (primitiveValue->isValueID() && primitiveValue->getValueID() != CSSValueW
ebkitMatchParent) |
| 659 state.style()->setTextAlign(*primitiveValue); | 659 state.style()->setTextAlign(*primitiveValue); |
| 660 else if (state.parentStyle()->textAlign() == TASTART) | 660 else if (state.parentStyle()->textAlign() == TASTART) |
| 661 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? LEFT : RIGHT); | 661 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? LEFT : RIGHT); |
| 662 else if (state.parentStyle()->textAlign() == TAEND) | 662 else if (state.parentStyle()->textAlign() == TAEND) |
| 663 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? RIGHT : LEFT); | 663 state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection(
) ? RIGHT : LEFT); |
| 664 else | 664 else |
| 665 state.style()->setTextAlign(state.parentStyle()->textAlign()); | 665 state.style()->setTextAlign(state.parentStyle()->textAlign()); |
| 666 } | 666 } |
| 667 | 667 |
| 668 void StyleBuilderFunctions::applyValueCSSPropertyTextDecoration(StyleResolverSta
te& state, CSSValue* value) | 668 void StyleBuilderFunctions::applyValueCSSPropertyTextDecorationLine(StyleResolve
rState& state, CSSValue* value) |
| 669 { | 669 { |
| 670 TextDecoration t = RenderStyle::initialTextDecoration(); | 670 TextDecoration t = RenderStyle::initialTextDecoration(); |
| 671 for (CSSValueListIterator i(value); i.hasMore(); i.advance()) { | 671 for (CSSValueListIterator i(value); i.hasMore(); i.advance()) { |
| 672 CSSValue* item = i.value(); | 672 CSSValue* item = i.value(); |
| 673 t |= *toCSSPrimitiveValue(item); | 673 t |= *toCSSPrimitiveValue(item); |
| 674 } | 674 } |
| 675 state.style()->setTextDecoration(t); | 675 state.style()->setTextDecoration(t); |
| 676 } | 676 } |
| 677 | 677 |
| 678 void StyleBuilderFunctions::applyInheritCSSPropertyTextIndent(StyleResolverState
& state) | 678 void StyleBuilderFunctions::applyInheritCSSPropertyTextIndent(StyleResolverState
& state) |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 default: | 1033 default: |
| 1034 break; | 1034 break; |
| 1035 } | 1035 } |
| 1036 } else if (primitiveValue->isTime()) { | 1036 } else if (primitiveValue->isTime()) { |
| 1037 state.style()->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimi
tiveValue::Milliseconds>()); | 1037 state.style()->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimi
tiveValue::Milliseconds>()); |
| 1038 } else if (primitiveValue->isNumber()) { // For scrollamount support. | 1038 } else if (primitiveValue->isNumber()) { // For scrollamount support. |
| 1039 state.style()->setMarqueeSpeed(primitiveValue->getIntValue()); | 1039 state.style()->setMarqueeSpeed(primitiveValue->getIntValue()); |
| 1040 } | 1040 } |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 // FIXME: We should use the same system for this as the rest of the pseudo-short
hands (e.g. background-position) | |
| 1044 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitPerspectiveOrigin(Style
ResolverState& state) | |
| 1045 { | |
| 1046 applyInitialCSSPropertyWebkitPerspectiveOriginX(state); | |
| 1047 applyInitialCSSPropertyWebkitPerspectiveOriginY(state); | |
| 1048 } | |
| 1049 | |
| 1050 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitPerspectiveOrigin(Style
ResolverState& state) | |
| 1051 { | |
| 1052 applyInheritCSSPropertyWebkitPerspectiveOriginX(state); | |
| 1053 applyInheritCSSPropertyWebkitPerspectiveOriginY(state); | |
| 1054 } | |
| 1055 | |
| 1056 void StyleBuilderFunctions::applyValueCSSPropertyWebkitPerspectiveOrigin(StyleRe
solverState&, CSSValue* value) | |
| 1057 { | |
| 1058 // This is expanded in the parser | |
| 1059 ASSERT_NOT_REACHED(); | |
| 1060 } | |
| 1061 | |
| 1062 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTapHighlightColor(StyleRe
solverState& state, CSSValue* value) | 1043 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTapHighlightColor(StyleRe
solverState& state, CSSValue* value) |
| 1063 { | 1044 { |
| 1064 if (!value->isPrimitiveValue()) | 1045 if (!value->isPrimitiveValue()) |
| 1065 return; | 1046 return; |
| 1066 Color color = state.document().textLinkColors().colorFromPrimitiveValue(toCS
SPrimitiveValue(value), state.style()->color()); | 1047 Color color = state.document().textLinkColors().colorFromPrimitiveValue(toCS
SPrimitiveValue(value), state.style()->color()); |
| 1067 state.style()->setTapHighlightColor(color); | 1048 state.style()->setTapHighlightColor(color); |
| 1068 } | 1049 } |
| 1069 | 1050 |
| 1070 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitTextEmphasisStyle(Style
ResolverState& state) | 1051 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitTextEmphasisStyle(Style
ResolverState& state) |
| 1071 { | 1052 { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 } | 1270 } |
| 1290 | 1271 |
| 1291 void StyleBuilderFunctions::applyValueCSSPropertyFont(StyleResolverState& state,
CSSValue* value) | 1272 void StyleBuilderFunctions::applyValueCSSPropertyFont(StyleResolverState& state,
CSSValue* value) |
| 1292 { | 1273 { |
| 1293 // Only System Font identifiers should come through this method | 1274 // Only System Font identifiers should come through this method |
| 1294 // all other values should have been handled when the shorthand | 1275 // all other values should have been handled when the shorthand |
| 1295 // was expanded by the parser. | 1276 // was expanded by the parser. |
| 1296 // FIXME: System Font identifiers should not hijack this | 1277 // FIXME: System Font identifiers should not hijack this |
| 1297 // short-hand CSSProperty like this (crbug.com/353932) | 1278 // short-hand CSSProperty like this (crbug.com/353932) |
| 1298 state.style()->setLineHeight(RenderStyle::initialLineHeight()); | 1279 state.style()->setLineHeight(RenderStyle::initialLineHeight()); |
| 1299 state.setLineHeightValue(0); | |
| 1300 state.fontBuilder().fromSystemFont(toCSSPrimitiveValue(value)->getValueID(),
state.style()->effectiveZoom()); | 1280 state.fontBuilder().fromSystemFont(toCSSPrimitiveValue(value)->getValueID(),
state.style()->effectiveZoom()); |
| 1301 } | 1281 } |
| 1302 | 1282 |
| 1303 void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState
& state, CSSValue* value) | 1283 void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState
& state, CSSValue* value) |
| 1304 { | 1284 { |
| 1305 if (!value->isPrimitiveValue()) | 1285 if (!value->isPrimitiveValue()) |
| 1306 return; | 1286 return; |
| 1307 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 1287 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 1308 if (primitiveValue->getValueID() == CSSValueAuto) | 1288 if (primitiveValue->getValueID() == CSSValueAuto) |
| 1309 state.style()->setLocale(nullAtom); | 1289 state.style()->setLocale(nullAtom); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1324 { | 1304 { |
| 1325 if (!value->isPrimitiveValue()) | 1305 if (!value->isPrimitiveValue()) |
| 1326 return; | 1306 return; |
| 1327 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 1307 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 1328 if (!primitiveValue->getValueID()) | 1308 if (!primitiveValue->getValueID()) |
| 1329 return; | 1309 return; |
| 1330 state.style()->setDraggableRegionMode(primitiveValue->getValueID() == CSSVal
ueDrag ? DraggableRegionDrag : DraggableRegionNoDrag); | 1310 state.style()->setDraggableRegionMode(primitiveValue->getValueID() == CSSVal
ueDrag ? DraggableRegionDrag : DraggableRegionNoDrag); |
| 1331 state.document().setHasAnnotatedRegions(true); | 1311 state.document().setHasAnnotatedRegions(true); |
| 1332 } | 1312 } |
| 1333 | 1313 |
| 1334 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitPerspective(StyleResolv
erState& state) | |
| 1335 { | |
| 1336 applyInitialCSSPropertyPerspective(state); | |
| 1337 } | |
| 1338 | |
| 1339 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitPerspective(StyleResolv
erState& state) | |
| 1340 { | |
| 1341 applyInheritCSSPropertyPerspective(state); | |
| 1342 } | |
| 1343 | |
| 1344 void StyleBuilderFunctions::applyValueCSSPropertyWebkitPerspective(StyleResolver
State& state, CSSValue* value) | |
| 1345 { | |
| 1346 if (!value->isPrimitiveValue()) | |
| 1347 return; | |
| 1348 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | |
| 1349 if (primitiveValue->isNumber()) { | |
| 1350 float perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDo
ubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.cssToLengthC
onversionData()); | |
| 1351 if (perspectiveValue >= 0.0f) | |
| 1352 state.style()->setPerspective(perspectiveValue); | |
| 1353 } else { | |
| 1354 applyValueCSSPropertyPerspective(state, value); | |
| 1355 } | |
| 1356 } | |
| 1357 | |
| 1358 void StyleBuilderFunctions::applyValueCSSPropertyPerspective(StyleResolverState&
state, CSSValue* value) | 1314 void StyleBuilderFunctions::applyValueCSSPropertyPerspective(StyleResolverState&
state, CSSValue* value) |
| 1359 { | 1315 { |
| 1360 if (!value->isPrimitiveValue()) | 1316 if (!value->isPrimitiveValue()) |
| 1361 return; | 1317 return; |
| 1362 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 1318 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 1363 if (primitiveValue->getValueID() == CSSValueNone) { | 1319 if (primitiveValue->getValueID() == CSSValueNone) { |
| 1364 state.style()->setPerspective(0); | 1320 state.style()->setPerspective(0); |
| 1365 return; | 1321 return; |
| 1366 } | 1322 } |
| 1367 | 1323 |
| 1324 // This case is only hit when using -webkit-perspective |
| 1325 if (primitiveValue->isNumber()) { |
| 1326 float perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDo
ubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.cssToLengthC
onversionData()); |
| 1327 if (perspectiveValue >= 0.0f) |
| 1328 state.style()->setPerspective(perspectiveValue); |
| 1329 return; |
| 1330 } |
| 1331 |
| 1368 if (!primitiveValue->isLength()) | 1332 if (!primitiveValue->isLength()) |
| 1369 return; | 1333 return; |
| 1370 float perspectiveValue = primitiveValue->computeLength<float>(state.cssToLen
gthConversionData()); | 1334 float perspectiveValue = primitiveValue->computeLength<float>(state.cssToLen
gthConversionData()); |
| 1371 if (perspectiveValue >= 0.0f) | 1335 if (perspectiveValue >= 0.0f) |
| 1372 state.style()->setPerspective(perspectiveValue); | 1336 state.style()->setPerspective(perspectiveValue); |
| 1373 } | 1337 } |
| 1374 | 1338 |
| 1375 void StyleBuilderFunctions::applyInitialCSSPropertyInternalCallback(StyleResolve
rState& state) | |
| 1376 { | |
| 1377 } | |
| 1378 | |
| 1379 void StyleBuilderFunctions::applyInheritCSSPropertyInternalCallback(StyleResolve
rState& state) | |
| 1380 { | |
| 1381 } | |
| 1382 | |
| 1383 void StyleBuilderFunctions::applyValueCSSPropertyInternalCallback(StyleResolverS
tate& state, CSSValue* value) | |
| 1384 { | |
| 1385 if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() ==
CSSValueInternalPresence) | |
| 1386 state.style()->addCallbackSelector(state.currentRule()->selectorList().s
electorsText()); | |
| 1387 } | |
| 1388 | |
| 1389 void StyleBuilderFunctions::applyValueCSSPropertyWebkitWritingMode(StyleResolver
State& state, CSSValue* value) | 1339 void StyleBuilderFunctions::applyValueCSSPropertyWebkitWritingMode(StyleResolver
State& state, CSSValue* value) |
| 1390 { | 1340 { |
| 1391 if (value->isPrimitiveValue()) | 1341 if (value->isPrimitiveValue()) |
| 1392 state.setWritingMode(*toCSSPrimitiveValue(value)); | 1342 state.setWritingMode(*toCSSPrimitiveValue(value)); |
| 1393 | 1343 |
| 1394 // FIXME: It is not ok to modify document state while applying style. | 1344 // FIXME: It is not ok to modify document state while applying style. |
| 1395 if (state.element() && state.element() == state.document().documentElement()
) | 1345 if (state.element() && state.element() == state.document().documentElement()
) |
| 1396 state.document().setWritingModeSetOnDocumentElement(true); | 1346 state.document().setWritingModeSetOnDocumentElement(true); |
| 1397 } | 1347 } |
| 1398 | 1348 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 break; | 1459 break; |
| 1510 default: | 1460 default: |
| 1511 ASSERT_NOT_REACHED(); | 1461 ASSERT_NOT_REACHED(); |
| 1512 break; | 1462 break; |
| 1513 } | 1463 } |
| 1514 | 1464 |
| 1515 state.style()->setGridAutoFlow(autoFlow); | 1465 state.style()->setGridAutoFlow(autoFlow); |
| 1516 } | 1466 } |
| 1517 | 1467 |
| 1518 } // namespace blink | 1468 } // namespace blink |
| OLD | NEW |