OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>. | 2 * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>. |
3 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
4 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 4 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
5 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> | 5 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "sky/engine/core/css/CSSPrimitiveValue.h" | 35 #include "sky/engine/core/css/CSSPrimitiveValue.h" |
36 #include "sky/engine/core/css/CSSPrimitiveValueMappings.h" | 36 #include "sky/engine/core/css/CSSPrimitiveValueMappings.h" |
37 #include "sky/engine/core/css/CSSToLengthConversionData.h" | 37 #include "sky/engine/core/css/CSSToLengthConversionData.h" |
38 #include "sky/engine/core/rendering/style/RenderStyleConstants.h" | 38 #include "sky/engine/core/rendering/style/RenderStyleConstants.h" |
39 #include "sky/engine/platform/Length.h" | 39 #include "sky/engine/platform/Length.h" |
40 #include "sky/engine/platform/fonts/FontDescription.h" | 40 #include "sky/engine/platform/fonts/FontDescription.h" |
41 #include "sky/engine/platform/fonts/FontSmoothingMode.h" | 41 #include "sky/engine/platform/fonts/FontSmoothingMode.h" |
42 #include "sky/engine/platform/fonts/TextRenderingMode.h" | 42 #include "sky/engine/platform/fonts/TextRenderingMode.h" |
43 #include "sky/engine/platform/graphics/GraphicsTypes.h" | 43 #include "sky/engine/platform/graphics/GraphicsTypes.h" |
44 #include "sky/engine/platform/graphics/Path.h" | 44 #include "sky/engine/platform/graphics/Path.h" |
45 #include "sky/engine/platform/scroll/ScrollTypes.h" | |
46 #include "sky/engine/platform/text/TextDirection.h" | 45 #include "sky/engine/platform/text/TextDirection.h" |
47 #include "sky/engine/platform/text/UnicodeBidi.h" | 46 #include "sky/engine/platform/text/UnicodeBidi.h" |
48 #include "sky/engine/wtf/MathExtras.h" | 47 #include "sky/engine/wtf/MathExtras.h" |
49 | 48 |
50 namespace blink { | 49 namespace blink { |
51 | 50 |
52 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(short i) | 51 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(short i) |
53 : CSSValue(PrimitiveClass) | 52 : CSSValue(PrimitiveClass) |
54 { | 53 { |
55 m_primitiveUnitType = CSS_NUMBER; | 54 m_primitiveUnitType = CSS_NUMBER; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 ASSERT_NOT_REACHED(); | 296 ASSERT_NOT_REACHED(); |
298 return BackfaceVisibilityHidden; | 297 return BackfaceVisibilityHidden; |
299 } | 298 } |
300 | 299 |
301 | 300 |
302 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillAttachment e) | 301 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillAttachment e) |
303 : CSSValue(PrimitiveClass) | 302 : CSSValue(PrimitiveClass) |
304 { | 303 { |
305 m_primitiveUnitType = CSS_VALUE_ID; | 304 m_primitiveUnitType = CSS_VALUE_ID; |
306 switch (e) { | 305 switch (e) { |
307 case ScrollBackgroundAttachment: | |
308 m_value.valueID = CSSValueScroll; | |
309 break; | |
310 case LocalBackgroundAttachment: | 306 case LocalBackgroundAttachment: |
311 m_value.valueID = CSSValueLocal; | 307 m_value.valueID = CSSValueLocal; |
312 break; | 308 break; |
313 case FixedBackgroundAttachment: | 309 case FixedBackgroundAttachment: |
314 m_value.valueID = CSSValueFixed; | 310 m_value.valueID = CSSValueFixed; |
315 break; | 311 break; |
316 } | 312 } |
317 } | 313 } |
318 | 314 |
319 template<> inline CSSPrimitiveValue::operator EFillAttachment() const | 315 template<> inline CSSPrimitiveValue::operator EFillAttachment() const |
320 { | 316 { |
321 ASSERT(isValueID()); | 317 ASSERT(isValueID()); |
322 switch (m_value.valueID) { | 318 switch (m_value.valueID) { |
323 case CSSValueScroll: | |
324 return ScrollBackgroundAttachment; | |
325 case CSSValueLocal: | 319 case CSSValueLocal: |
326 return LocalBackgroundAttachment; | 320 return LocalBackgroundAttachment; |
327 case CSSValueFixed: | 321 case CSSValueFixed: |
328 return FixedBackgroundAttachment; | 322 return FixedBackgroundAttachment; |
329 default: | 323 default: |
330 break; | 324 break; |
331 } | 325 } |
332 | 326 |
333 ASSERT_NOT_REACHED(); | 327 ASSERT_NOT_REACHED(); |
334 return ScrollBackgroundAttachment; | 328 return LocalBackgroundAttachment; |
335 } | 329 } |
336 | 330 |
337 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e) | 331 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e) |
338 : CSSValue(PrimitiveClass) | 332 : CSSValue(PrimitiveClass) |
339 { | 333 { |
340 m_primitiveUnitType = CSS_VALUE_ID; | 334 m_primitiveUnitType = CSS_VALUE_ID; |
341 switch (e) { | 335 switch (e) { |
342 case BorderFillBox: | 336 case BorderFillBox: |
343 m_value.valueID = CSSValueBorderBox; | 337 m_value.valueID = CSSValueBorderBox; |
344 break; | 338 break; |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 : CSSValue(PrimitiveClass) | 1437 : CSSValue(PrimitiveClass) |
1444 { | 1438 { |
1445 m_primitiveUnitType = CSS_VALUE_ID; | 1439 m_primitiveUnitType = CSS_VALUE_ID; |
1446 switch (e) { | 1440 switch (e) { |
1447 case OVISIBLE: | 1441 case OVISIBLE: |
1448 m_value.valueID = CSSValueVisible; | 1442 m_value.valueID = CSSValueVisible; |
1449 break; | 1443 break; |
1450 case OHIDDEN: | 1444 case OHIDDEN: |
1451 m_value.valueID = CSSValueHidden; | 1445 m_value.valueID = CSSValueHidden; |
1452 break; | 1446 break; |
1453 case OSCROLL: | |
1454 m_value.valueID = CSSValueScroll; | |
1455 break; | |
1456 case OAUTO: | 1447 case OAUTO: |
1457 m_value.valueID = CSSValueAuto; | 1448 m_value.valueID = CSSValueAuto; |
1458 break; | 1449 break; |
1459 case OOVERLAY: | 1450 case OOVERLAY: |
1460 m_value.valueID = CSSValueOverlay; | 1451 m_value.valueID = CSSValueOverlay; |
1461 break; | 1452 break; |
1462 case OPAGEDX: | 1453 case OPAGEDX: |
1463 m_value.valueID = CSSValueWebkitPagedX; | 1454 m_value.valueID = CSSValueWebkitPagedX; |
1464 break; | 1455 break; |
1465 case OPAGEDY: | 1456 case OPAGEDY: |
1466 m_value.valueID = CSSValueWebkitPagedY; | 1457 m_value.valueID = CSSValueWebkitPagedY; |
1467 break; | 1458 break; |
1468 } | 1459 } |
1469 } | 1460 } |
1470 | 1461 |
1471 template<> inline CSSPrimitiveValue::operator EOverflow() const | 1462 template<> inline CSSPrimitiveValue::operator EOverflow() const |
1472 { | 1463 { |
1473 ASSERT(isValueID()); | 1464 ASSERT(isValueID()); |
1474 switch (m_value.valueID) { | 1465 switch (m_value.valueID) { |
1475 case CSSValueVisible: | 1466 case CSSValueVisible: |
1476 return OVISIBLE; | 1467 return OVISIBLE; |
1477 case CSSValueHidden: | 1468 case CSSValueHidden: |
1478 return OHIDDEN; | 1469 return OHIDDEN; |
1479 case CSSValueScroll: | |
1480 return OSCROLL; | |
1481 case CSSValueAuto: | 1470 case CSSValueAuto: |
1482 return OAUTO; | 1471 return OAUTO; |
1483 case CSSValueOverlay: | 1472 case CSSValueOverlay: |
1484 return OOVERLAY; | 1473 return OOVERLAY; |
1485 case CSSValueWebkitPagedX: | 1474 case CSSValueWebkitPagedX: |
1486 return OPAGEDX; | 1475 return OPAGEDX; |
1487 case CSSValueWebkitPagedY: | 1476 case CSSValueWebkitPagedY: |
1488 return OPAGEDY; | 1477 return OPAGEDY; |
1489 default: | 1478 default: |
1490 break; | 1479 break; |
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3435 return OverflowAlignmentTrue; | 3424 return OverflowAlignmentTrue; |
3436 case CSSValueSafe: | 3425 case CSSValueSafe: |
3437 return OverflowAlignmentSafe; | 3426 return OverflowAlignmentSafe; |
3438 default: | 3427 default: |
3439 break; | 3428 break; |
3440 } | 3429 } |
3441 ASSERT_NOT_REACHED(); | 3430 ASSERT_NOT_REACHED(); |
3442 return OverflowAlignmentTrue; | 3431 return OverflowAlignmentTrue; |
3443 } | 3432 } |
3444 | 3433 |
3445 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollBehavior behavior) | |
3446 : CSSValue(PrimitiveClass) | |
3447 { | |
3448 m_primitiveUnitType = CSS_VALUE_ID; | |
3449 switch (behavior) { | |
3450 case ScrollBehaviorInstant: | |
3451 m_value.valueID = CSSValueInstant; | |
3452 break; | |
3453 case ScrollBehaviorSmooth: | |
3454 m_value.valueID = CSSValueSmooth; | |
3455 break; | |
3456 case ScrollBehaviorAuto: | |
3457 // Behavior 'auto' is only allowed in ScrollOptions arguments passed to | |
3458 // CSSOM scroll APIs. | |
3459 ASSERT_NOT_REACHED(); | |
3460 } | |
3461 } | |
3462 | |
3463 template<> inline CSSPrimitiveValue::operator ScrollBehavior() const | |
3464 { | |
3465 switch (getValueID()) { | |
3466 case CSSValueInstant: | |
3467 return ScrollBehaviorInstant; | |
3468 case CSSValueSmooth: | |
3469 return ScrollBehaviorSmooth; | |
3470 default: | |
3471 break; | |
3472 } | |
3473 ASSERT_NOT_REACHED(); | |
3474 return ScrollBehaviorInstant; | |
3475 } | |
3476 | |
3477 } | 3434 } |
3478 | 3435 |
3479 #endif // SKY_ENGINE_CORE_CSS_CSSPRIMITIVEVALUEMAPPINGS_H_ | 3436 #endif // SKY_ENGINE_CORE_CSS_CSSPRIMITIVEVALUEMAPPINGS_H_ |
OLD | NEW |