| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Andreas Kling (kling@webkit.org) | 2 * Copyright (C) 2011 Andreas Kling (kling@webkit.org) |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "core/css/CSSCustomIdentValue.h" | 36 #include "core/css/CSSCustomIdentValue.h" |
| 37 #include "core/css/CSSCustomPropertyDeclaration.h" | 37 #include "core/css/CSSCustomPropertyDeclaration.h" |
| 38 #include "core/css/CSSFontFaceSrcValue.h" | 38 #include "core/css/CSSFontFaceSrcValue.h" |
| 39 #include "core/css/CSSFontFamilyValue.h" | 39 #include "core/css/CSSFontFamilyValue.h" |
| 40 #include "core/css/CSSFontFeatureValue.h" | 40 #include "core/css/CSSFontFeatureValue.h" |
| 41 #include "core/css/CSSFunctionValue.h" | 41 #include "core/css/CSSFunctionValue.h" |
| 42 #include "core/css/CSSGradientValue.h" | 42 #include "core/css/CSSGradientValue.h" |
| 43 #include "core/css/CSSGridAutoRepeatValue.h" | 43 #include "core/css/CSSGridAutoRepeatValue.h" |
| 44 #include "core/css/CSSGridLineNamesValue.h" | 44 #include "core/css/CSSGridLineNamesValue.h" |
| 45 #include "core/css/CSSGridTemplateAreasValue.h" | 45 #include "core/css/CSSGridTemplateAreasValue.h" |
| 46 #include "core/css/CSSIdentifierValue.h" |
| 46 #include "core/css/CSSImageSetValue.h" | 47 #include "core/css/CSSImageSetValue.h" |
| 47 #include "core/css/CSSImageValue.h" | 48 #include "core/css/CSSImageValue.h" |
| 48 #include "core/css/CSSInheritedValue.h" | 49 #include "core/css/CSSInheritedValue.h" |
| 49 #include "core/css/CSSInitialValue.h" | 50 #include "core/css/CSSInitialValue.h" |
| 50 #include "core/css/CSSPaintValue.h" | 51 #include "core/css/CSSPaintValue.h" |
| 51 #include "core/css/CSSPathValue.h" | 52 #include "core/css/CSSPathValue.h" |
| 52 #include "core/css/CSSPendingSubstitutionValue.h" | 53 #include "core/css/CSSPendingSubstitutionValue.h" |
| 53 #include "core/css/CSSPrimitiveValue.h" | 54 #include "core/css/CSSPrimitiveValue.h" |
| 54 #include "core/css/CSSQuadValue.h" | 55 #include "core/css/CSSQuadValue.h" |
| 55 #include "core/css/CSSReflectValue.h" | 56 #include "core/css/CSSReflectValue.h" |
| 56 #include "core/css/CSSShadowValue.h" | 57 #include "core/css/CSSShadowValue.h" |
| 57 #include "core/css/CSSStringValue.h" | 58 #include "core/css/CSSStringValue.h" |
| 58 #include "core/css/CSSTimingFunctionValue.h" | 59 #include "core/css/CSSTimingFunctionValue.h" |
| 59 #include "core/css/CSSURIValue.h" | 60 #include "core/css/CSSURIValue.h" |
| 60 #include "core/css/CSSUnicodeRangeValue.h" | 61 #include "core/css/CSSUnicodeRangeValue.h" |
| 61 #include "core/css/CSSUnsetValue.h" | 62 #include "core/css/CSSUnsetValue.h" |
| 62 #include "core/css/CSSValueList.h" | 63 #include "core/css/CSSValueList.h" |
| 63 #include "core/css/CSSValuePair.h" | 64 #include "core/css/CSSValuePair.h" |
| 64 #include "core/css/CSSVariableReferenceValue.h" | 65 #include "core/css/CSSVariableReferenceValue.h" |
| 66 #include "platform/Length.h" |
| 65 #include "wtf/SizeAssertions.h" | 67 #include "wtf/SizeAssertions.h" |
| 66 | 68 |
| 67 namespace blink { | 69 namespace blink { |
| 68 | 70 |
| 69 struct SameSizeAsCSSValue | 71 struct SameSizeAsCSSValue |
| 70 : public GarbageCollectedFinalized<SameSizeAsCSSValue> { | 72 : public GarbageCollectedFinalized<SameSizeAsCSSValue> { |
| 71 uint32_t bitfields; | 73 uint32_t bitfields; |
| 72 }; | 74 }; |
| 73 ASSERT_SIZE(CSSValue, SameSizeAsCSSValue); | 75 ASSERT_SIZE(CSSValue, SameSizeAsCSSValue); |
| 74 | 76 |
| 77 CSSValue* CSSValue::create(const Length& value, float zoom) { |
| 78 switch (value.type()) { |
| 79 case Auto: |
| 80 case MinContent: |
| 81 case MaxContent: |
| 82 case FillAvailable: |
| 83 case FitContent: |
| 84 case ExtendToZoom: |
| 85 return CSSIdentifierValue::create(value); |
| 86 case Percent: |
| 87 case Fixed: |
| 88 case Calculated: |
| 89 return CSSPrimitiveValue::create(value, zoom); |
| 90 case DeviceWidth: |
| 91 case DeviceHeight: |
| 92 case MaxSizeNone: |
| 93 NOTREACHED(); |
| 94 break; |
| 95 } |
| 96 return nullptr; |
| 97 } |
| 98 |
| 75 bool CSSValue::isImplicitInitialValue() const { | 99 bool CSSValue::isImplicitInitialValue() const { |
| 76 return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit(); | 100 return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit(); |
| 77 } | 101 } |
| 78 | 102 |
| 79 bool CSSValue::hasFailedOrCanceledSubresources() const { | 103 bool CSSValue::hasFailedOrCanceledSubresources() const { |
| 80 if (isValueList()) | 104 if (isValueList()) |
| 81 return toCSSValueList(this)->hasFailedOrCanceledSubresources(); | 105 return toCSSValueList(this)->hasFailedOrCanceledSubresources(); |
| 82 if (getClassType() == FontFaceSrcClass) | 106 if (getClassType() == FontFaceSrcClass) |
| 83 return toCSSFontFaceSrcValue(this)->hasFailedOrCanceledSubresources(); | 107 return toCSSFontFaceSrcValue(this)->hasFailedOrCanceledSubresources(); |
| 84 if (getClassType() == ImageClass) | 108 if (getClassType() == ImageClass) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 case GridAutoRepeatClass: | 170 case GridAutoRepeatClass: |
| 147 return compareCSSValues<CSSGridAutoRepeatValue>(*this, other); | 171 return compareCSSValues<CSSGridAutoRepeatValue>(*this, other); |
| 148 case GridLineNamesClass: | 172 case GridLineNamesClass: |
| 149 return compareCSSValues<CSSGridLineNamesValue>(*this, other); | 173 return compareCSSValues<CSSGridLineNamesValue>(*this, other); |
| 150 case GridTemplateAreasClass: | 174 case GridTemplateAreasClass: |
| 151 return compareCSSValues<CSSGridTemplateAreasValue>(*this, other); | 175 return compareCSSValues<CSSGridTemplateAreasValue>(*this, other); |
| 152 case PathClass: | 176 case PathClass: |
| 153 return compareCSSValues<CSSPathValue>(*this, other); | 177 return compareCSSValues<CSSPathValue>(*this, other); |
| 154 case PrimitiveClass: | 178 case PrimitiveClass: |
| 155 return compareCSSValues<CSSPrimitiveValue>(*this, other); | 179 return compareCSSValues<CSSPrimitiveValue>(*this, other); |
| 180 case IdentifierClass: |
| 181 return compareCSSValues<CSSIdentifierValue>(*this, other); |
| 156 case QuadClass: | 182 case QuadClass: |
| 157 return compareCSSValues<CSSQuadValue>(*this, other); | 183 return compareCSSValues<CSSQuadValue>(*this, other); |
| 158 case ReflectClass: | 184 case ReflectClass: |
| 159 return compareCSSValues<CSSReflectValue>(*this, other); | 185 return compareCSSValues<CSSReflectValue>(*this, other); |
| 160 case ShadowClass: | 186 case ShadowClass: |
| 161 return compareCSSValues<CSSShadowValue>(*this, other); | 187 return compareCSSValues<CSSShadowValue>(*this, other); |
| 162 case StringClass: | 188 case StringClass: |
| 163 return compareCSSValues<CSSStringValue>(*this, other); | 189 return compareCSSValues<CSSStringValue>(*this, other); |
| 164 case CubicBezierTimingFunctionClass: | 190 case CubicBezierTimingFunctionClass: |
| 165 return compareCSSValues<CSSCubicBezierTimingFunctionValue>(*this, | 191 return compareCSSValues<CSSCubicBezierTimingFunctionValue>(*this, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 case GridAutoRepeatClass: | 264 case GridAutoRepeatClass: |
| 239 return toCSSGridAutoRepeatValue(this)->customCSSText(); | 265 return toCSSGridAutoRepeatValue(this)->customCSSText(); |
| 240 case GridLineNamesClass: | 266 case GridLineNamesClass: |
| 241 return toCSSGridLineNamesValue(this)->customCSSText(); | 267 return toCSSGridLineNamesValue(this)->customCSSText(); |
| 242 case GridTemplateAreasClass: | 268 case GridTemplateAreasClass: |
| 243 return toCSSGridTemplateAreasValue(this)->customCSSText(); | 269 return toCSSGridTemplateAreasValue(this)->customCSSText(); |
| 244 case PathClass: | 270 case PathClass: |
| 245 return toCSSPathValue(this)->customCSSText(); | 271 return toCSSPathValue(this)->customCSSText(); |
| 246 case PrimitiveClass: | 272 case PrimitiveClass: |
| 247 return toCSSPrimitiveValue(this)->customCSSText(); | 273 return toCSSPrimitiveValue(this)->customCSSText(); |
| 274 case IdentifierClass: |
| 275 return toCSSIdentifierValue(this)->customCSSText(); |
| 248 case QuadClass: | 276 case QuadClass: |
| 249 return toCSSQuadValue(this)->customCSSText(); | 277 return toCSSQuadValue(this)->customCSSText(); |
| 250 case ReflectClass: | 278 case ReflectClass: |
| 251 return toCSSReflectValue(this)->customCSSText(); | 279 return toCSSReflectValue(this)->customCSSText(); |
| 252 case ShadowClass: | 280 case ShadowClass: |
| 253 return toCSSShadowValue(this)->customCSSText(); | 281 return toCSSShadowValue(this)->customCSSText(); |
| 254 case StringClass: | 282 case StringClass: |
| 255 return toCSSStringValue(this)->customCSSText(); | 283 return toCSSStringValue(this)->customCSSText(); |
| 256 case CubicBezierTimingFunctionClass: | 284 case CubicBezierTimingFunctionClass: |
| 257 return toCSSCubicBezierTimingFunctionValue(this)->customCSSText(); | 285 return toCSSCubicBezierTimingFunctionValue(this)->customCSSText(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 return; | 381 return; |
| 354 case GridTemplateAreasClass: | 382 case GridTemplateAreasClass: |
| 355 toCSSGridTemplateAreasValue(this)->~CSSGridTemplateAreasValue(); | 383 toCSSGridTemplateAreasValue(this)->~CSSGridTemplateAreasValue(); |
| 356 return; | 384 return; |
| 357 case PathClass: | 385 case PathClass: |
| 358 toCSSPathValue(this)->~CSSPathValue(); | 386 toCSSPathValue(this)->~CSSPathValue(); |
| 359 return; | 387 return; |
| 360 case PrimitiveClass: | 388 case PrimitiveClass: |
| 361 toCSSPrimitiveValue(this)->~CSSPrimitiveValue(); | 389 toCSSPrimitiveValue(this)->~CSSPrimitiveValue(); |
| 362 return; | 390 return; |
| 391 case IdentifierClass: |
| 392 toCSSIdentifierValue(this)->~CSSIdentifierValue(); |
| 393 return; |
| 363 case QuadClass: | 394 case QuadClass: |
| 364 toCSSQuadValue(this)->~CSSQuadValue(); | 395 toCSSQuadValue(this)->~CSSQuadValue(); |
| 365 return; | 396 return; |
| 366 case ReflectClass: | 397 case ReflectClass: |
| 367 toCSSReflectValue(this)->~CSSReflectValue(); | 398 toCSSReflectValue(this)->~CSSReflectValue(); |
| 368 return; | 399 return; |
| 369 case ShadowClass: | 400 case ShadowClass: |
| 370 toCSSShadowValue(this)->~CSSShadowValue(); | 401 toCSSShadowValue(this)->~CSSShadowValue(); |
| 371 return; | 402 return; |
| 372 case StringClass: | 403 case StringClass: |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 return; | 514 return; |
| 484 case GridTemplateAreasClass: | 515 case GridTemplateAreasClass: |
| 485 toCSSGridTemplateAreasValue(this)->traceAfterDispatch(visitor); | 516 toCSSGridTemplateAreasValue(this)->traceAfterDispatch(visitor); |
| 486 return; | 517 return; |
| 487 case PathClass: | 518 case PathClass: |
| 488 toCSSPathValue(this)->traceAfterDispatch(visitor); | 519 toCSSPathValue(this)->traceAfterDispatch(visitor); |
| 489 return; | 520 return; |
| 490 case PrimitiveClass: | 521 case PrimitiveClass: |
| 491 toCSSPrimitiveValue(this)->traceAfterDispatch(visitor); | 522 toCSSPrimitiveValue(this)->traceAfterDispatch(visitor); |
| 492 return; | 523 return; |
| 524 case IdentifierClass: |
| 525 toCSSIdentifierValue(this)->traceAfterDispatch(visitor); |
| 526 return; |
| 493 case QuadClass: | 527 case QuadClass: |
| 494 toCSSQuadValue(this)->traceAfterDispatch(visitor); | 528 toCSSQuadValue(this)->traceAfterDispatch(visitor); |
| 495 return; | 529 return; |
| 496 case ReflectClass: | 530 case ReflectClass: |
| 497 toCSSReflectValue(this)->traceAfterDispatch(visitor); | 531 toCSSReflectValue(this)->traceAfterDispatch(visitor); |
| 498 return; | 532 return; |
| 499 case ShadowClass: | 533 case ShadowClass: |
| 500 toCSSShadowValue(this)->traceAfterDispatch(visitor); | 534 toCSSShadowValue(this)->traceAfterDispatch(visitor); |
| 501 return; | 535 return; |
| 502 case StringClass: | 536 case StringClass: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 533 toCSSCustomPropertyDeclaration(this)->traceAfterDispatch(visitor); | 567 toCSSCustomPropertyDeclaration(this)->traceAfterDispatch(visitor); |
| 534 return; | 568 return; |
| 535 case PendingSubstitutionValueClass: | 569 case PendingSubstitutionValueClass: |
| 536 toCSSPendingSubstitutionValue(this)->traceAfterDispatch(visitor); | 570 toCSSPendingSubstitutionValue(this)->traceAfterDispatch(visitor); |
| 537 return; | 571 return; |
| 538 } | 572 } |
| 539 ASSERT_NOT_REACHED(); | 573 ASSERT_NOT_REACHED(); |
| 540 } | 574 } |
| 541 | 575 |
| 542 } // namespace blink | 576 } // namespace blink |
| OLD | NEW |