| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * * Redistributions of source code must retain the above copyright | 4 * * Redistributions of source code must retain the above copyright |
| 5 * notice, this list of conditions and the following disclaimer. | 5 * notice, this list of conditions and the following disclaimer. |
| 6 * * Redistributions in binary form must reproduce the above | 6 * * Redistributions in binary form must reproduce the above |
| 7 * copyright notice, this list of conditions and the following disclaimer | 7 * copyright notice, this list of conditions and the following disclaimer |
| 8 * in the documentation and/or other materials provided with the | 8 * in the documentation and/or other materials provided with the |
| 9 * distribution. | 9 * distribution. |
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 alignmentData.setOverflow( | 460 alignmentData.setOverflow( |
| 461 toCSSIdentifierValue(pair.second()).convertTo<OverflowAlignment>()); | 461 toCSSIdentifierValue(pair.second()).convertTo<OverflowAlignment>()); |
| 462 } | 462 } |
| 463 } else { | 463 } else { |
| 464 alignmentData.setPosition( | 464 alignmentData.setPosition( |
| 465 toCSSIdentifierValue(value).convertTo<ItemPosition>()); | 465 toCSSIdentifierValue(value).convertTo<ItemPosition>()); |
| 466 } | 466 } |
| 467 return alignmentData; | 467 return alignmentData; |
| 468 } | 468 } |
| 469 | 469 |
| 470 StyleContentAlignmentData StyleBuilderConverter::convertContentAlignmentData( | 470 StyleContentAlignmentData StyleBuilderConverter::convertAlignContent( |
| 471 StyleResolverState&, | 471 StyleResolverState&, |
| 472 const CSSValue& value) { | 472 const CSSValue& value) { |
| 473 StyleContentAlignmentData alignmentData = | 473 StyleContentAlignmentData alignmentData = |
| 474 ComputedStyle::initialContentAlignment(); | 474 ComputedStyle::initialAlignContent(); |
| 475 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) { | 475 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) { |
| 476 const CSSIdentifierValue& identifierValue = toCSSIdentifierValue(value); | 476 const CSSIdentifierValue& identifierValue = toCSSIdentifierValue(value); |
| 477 switch (identifierValue.getValueID()) { | 477 switch (identifierValue.getValueID()) { |
| 478 case CSSValueStretch: |
| 479 case CSSValueSpaceBetween: |
| 480 case CSSValueSpaceAround: |
| 481 alignmentData.setDistribution( |
| 482 identifierValue.convertTo<ContentDistributionType>()); |
| 483 break; |
| 484 case CSSValueFlexStart: |
| 485 case CSSValueFlexEnd: |
| 486 case CSSValueCenter: |
| 487 alignmentData.setPosition(identifierValue.convertTo<ContentPosition>()); |
| 488 break; |
| 489 default: |
| 490 NOTREACHED(); |
| 491 } |
| 492 return alignmentData; |
| 493 } |
| 494 const CSSContentDistributionValue& contentValue = |
| 495 toCSSContentDistributionValue(value); |
| 496 if (contentValue.distribution()->getValueID() != CSSValueInvalid) { |
| 497 alignmentData.setDistribution( |
| 498 contentValue.distribution()->convertTo<ContentDistributionType>()); |
| 499 } |
| 500 if (contentValue.position()->getValueID() != CSSValueInvalid) { |
| 501 alignmentData.setPosition( |
| 502 contentValue.position()->convertTo<ContentPosition>()); |
| 503 } |
| 504 if (contentValue.overflow()->getValueID() != CSSValueInvalid) { |
| 505 alignmentData.setOverflow( |
| 506 contentValue.overflow()->convertTo<OverflowAlignment>()); |
| 507 } |
| 508 return alignmentData; |
| 509 } |
| 510 |
| 511 StyleContentAlignmentData StyleBuilderConverter::convertJustifyContent( |
| 512 StyleResolverState&, |
| 513 const CSSValue& value) { |
| 514 StyleContentAlignmentData alignmentData = |
| 515 ComputedStyle::initialJustifyContent(); |
| 516 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) { |
| 517 const CSSIdentifierValue& identifierValue = toCSSIdentifierValue(value); |
| 518 switch (identifierValue.getValueID()) { |
| 478 case CSSValueStretch: | 519 case CSSValueStretch: |
| 479 case CSSValueSpaceBetween: | 520 case CSSValueSpaceBetween: |
| 480 case CSSValueSpaceAround: | 521 case CSSValueSpaceAround: |
| 481 alignmentData.setDistribution( | 522 alignmentData.setDistribution( |
| 482 identifierValue.convertTo<ContentDistributionType>()); | 523 identifierValue.convertTo<ContentDistributionType>()); |
| 483 break; | 524 break; |
| 484 case CSSValueFlexStart: | 525 case CSSValueFlexStart: |
| 485 case CSSValueFlexEnd: | 526 case CSSValueFlexEnd: |
| 486 case CSSValueCenter: | 527 case CSSValueCenter: |
| 487 alignmentData.setPosition(identifierValue.convertTo<ContentPosition>()); | 528 alignmentData.setPosition(identifierValue.convertTo<ContentPosition>()); |
| 488 break; | 529 break; |
| 489 default: | 530 default: |
| 490 ASSERT_NOT_REACHED(); | 531 ASSERT_NOT_REACHED(); |
| 491 } | 532 } |
| 492 return alignmentData; | 533 return alignmentData; |
| 493 } | 534 } |
| 494 const CSSContentDistributionValue& contentValue = | 535 const CSSContentDistributionValue& contentValue = |
| 495 toCSSContentDistributionValue(value); | 536 toCSSContentDistributionValue(value); |
| 496 if (contentValue.distribution()->getValueID() != CSSValueInvalid) | 537 if (contentValue.distribution()->getValueID() != CSSValueInvalid) { |
| 497 alignmentData.setDistribution( | 538 alignmentData.setDistribution( |
| 498 contentValue.distribution()->convertTo<ContentDistributionType>()); | 539 contentValue.distribution()->convertTo<ContentDistributionType>()); |
| 499 if (contentValue.position()->getValueID() != CSSValueInvalid) | 540 } |
| 541 if (contentValue.position()->getValueID() != CSSValueInvalid) { |
| 500 alignmentData.setPosition( | 542 alignmentData.setPosition( |
| 501 contentValue.position()->convertTo<ContentPosition>()); | 543 contentValue.position()->convertTo<ContentPosition>()); |
| 502 if (contentValue.overflow()->getValueID() != CSSValueInvalid) | 544 } |
| 545 if (contentValue.overflow()->getValueID() != CSSValueInvalid) { |
| 503 alignmentData.setOverflow( | 546 alignmentData.setOverflow( |
| 504 contentValue.overflow()->convertTo<OverflowAlignment>()); | 547 contentValue.overflow()->convertTo<OverflowAlignment>()); |
| 548 } |
| 505 return alignmentData; | 549 return alignmentData; |
| 506 } | 550 } |
| 507 | 551 |
| 508 GridAutoFlow StyleBuilderConverter::convertGridAutoFlow(StyleResolverState&, | 552 GridAutoFlow StyleBuilderConverter::convertGridAutoFlow(StyleResolverState&, |
| 509 const CSSValue& value) { | 553 const CSSValue& value) { |
| 510 const CSSValueList& list = toCSSValueList(value); | 554 const CSSValueList& list = toCSSValueList(value); |
| 511 | 555 |
| 512 ASSERT(list.length() >= 1); | 556 ASSERT(list.length() >= 1); |
| 513 const CSSIdentifierValue& first = toCSSIdentifierValue(list.item(0)); | 557 const CSSIdentifierValue& first = toCSSIdentifierValue(list.item(0)); |
| 514 const CSSIdentifierValue* second = | 558 const CSSIdentifierValue* second = |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 // Instead of the actual zoom, use 1 to avoid potential rounding errors | 1335 // Instead of the actual zoom, use 1 to avoid potential rounding errors |
| 1292 Length length = primitiveValue.convertToLength( | 1336 Length length = primitiveValue.convertToLength( |
| 1293 state.cssToLengthConversionData().copyWithAdjustedZoom(1)); | 1337 state.cssToLengthConversionData().copyWithAdjustedZoom(1)); |
| 1294 return *CSSPrimitiveValue::create(length, 1); | 1338 return *CSSPrimitiveValue::create(length, 1); |
| 1295 } | 1339 } |
| 1296 } | 1340 } |
| 1297 return value; | 1341 return value; |
| 1298 } | 1342 } |
| 1299 | 1343 |
| 1300 } // namespace blink | 1344 } // namespace blink |
| OLD | NEW |