| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 default: | 128 default: |
| 129 return FontDescription::NoFamily; | 129 return FontDescription::NoFamily; |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 static bool convertFontFamilyName(StyleResolverState& state, CSSValue* value, | 133 static bool convertFontFamilyName(StyleResolverState& state, CSSValue* value, |
| 134 FontDescription::GenericFamilyType& genericFamily, AtomicString& familyName) | 134 FontDescription::GenericFamilyType& genericFamily, AtomicString& familyName) |
| 135 { | 135 { |
| 136 if (value->isCustomIdentValue()) { | 136 if (value->isCustomIdentValue()) { |
| 137 genericFamily = FontDescription::NoFamily; | 137 genericFamily = FontDescription::NoFamily; |
| 138 familyName = AtomicString(toCSSCustomIdentValue(value)->value()); | 138 familyName = AtomicString(toCSSCustomIdentValue(value)->string()); |
| 139 } else if (state.document().settings()) { | 139 } else if (state.document().settings()) { |
| 140 genericFamily = convertGenericFamily(toCSSPrimitiveValue(value)->getValu
eID()); | 140 genericFamily = convertGenericFamily(toCSSPrimitiveValue(value)->getValu
eID()); |
| 141 familyName = state.fontBuilder().genericFontFamilyName(genericFamily); | 141 familyName = state.fontBuilder().genericFontFamilyName(genericFamily); |
| 142 } | 142 } |
| 143 | 143 |
| 144 return !familyName.isEmpty(); | 144 return !familyName.isEmpty(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 FontDescription::FamilyDescription StyleBuilderConverter::convertFontFamily(Styl
eResolverState& state, CSSValue* value) | 147 FontDescription::FamilyDescription StyleBuilderConverter::convertFontFamily(Styl
eResolverState& state, CSSValue* value) |
| 148 { | 148 { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&, CSS
Value* value) | 411 GridPosition StyleBuilderConverter::convertGridPosition(StyleResolverState&, CSS
Value* value) |
| 412 { | 412 { |
| 413 // We accept the specification's grammar: | 413 // We accept the specification's grammar: |
| 414 // 'auto' | [ <integer> || <custom-ident> ] | [ span && [ <integer> || <cust
om-ident> ] ] | <custom-ident> | 414 // 'auto' | [ <integer> || <custom-ident> ] | [ span && [ <integer> || <cust
om-ident> ] ] | <custom-ident> |
| 415 | 415 |
| 416 GridPosition position; | 416 GridPosition position; |
| 417 | 417 |
| 418 if (value->isCustomIdentValue()) { | 418 if (value->isCustomIdentValue()) { |
| 419 // We translate <custom-ident> to <string> during parsing as it | 419 // We translate <custom-ident> to <string> during parsing as it |
| 420 // makes handling it more simple. | 420 // makes handling it more simple. |
| 421 position.setNamedGridArea(toCSSCustomIdentValue(value)->value()); | 421 position.setNamedGridArea(toCSSCustomIdentValue(value)->string()); |
| 422 return position; | 422 return position; |
| 423 } | 423 } |
| 424 | 424 |
| 425 if (value->isPrimitiveValue()) { | 425 if (value->isPrimitiveValue()) { |
| 426 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueAuto); | 426 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueAuto); |
| 427 return position; | 427 return position; |
| 428 } | 428 } |
| 429 | 429 |
| 430 CSSValueList* values = toCSSValueList(value); | 430 CSSValueList* values = toCSSValueList(value); |
| 431 ASSERT(values->length()); | 431 ASSERT(values->length()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 443 currentValue = it != values->end() ? it->get() : nullptr; | 443 currentValue = it != values->end() ? it->get() : nullptr; |
| 444 } | 444 } |
| 445 | 445 |
| 446 if (currentValue && currentValue->isPrimitiveValue() && toCSSPrimitiveValue(
currentValue)->isNumber()) { | 446 if (currentValue && currentValue->isPrimitiveValue() && toCSSPrimitiveValue(
currentValue)->isNumber()) { |
| 447 gridLineNumber = toCSSPrimitiveValue(currentValue)->getIntValue(); | 447 gridLineNumber = toCSSPrimitiveValue(currentValue)->getIntValue(); |
| 448 ++it; | 448 ++it; |
| 449 currentValue = it != values->end() ? it->get() : nullptr; | 449 currentValue = it != values->end() ? it->get() : nullptr; |
| 450 } | 450 } |
| 451 | 451 |
| 452 if (currentValue && currentValue->isCustomIdentValue()) { | 452 if (currentValue && currentValue->isCustomIdentValue()) { |
| 453 gridLineName = toCSSCustomIdentValue(currentValue)->value(); | 453 gridLineName = toCSSCustomIdentValue(currentValue)->string(); |
| 454 ++it; | 454 ++it; |
| 455 } | 455 } |
| 456 | 456 |
| 457 ASSERT(it == values->end()); | 457 ASSERT(it == values->end()); |
| 458 if (isSpanPosition) | 458 if (isSpanPosition) |
| 459 position.setSpanPosition(gridLineNumber, gridLineName); | 459 position.setSpanPosition(gridLineNumber, gridLineName); |
| 460 else | 460 else |
| 461 position.setExplicitPosition(gridLineNumber, gridLineName); | 461 position.setExplicitPosition(gridLineNumber, gridLineName); |
| 462 | 462 |
| 463 return position; | 463 return position; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 479 { | 479 { |
| 480 if (value->isPrimitiveValue()) { | 480 if (value->isPrimitiveValue()) { |
| 481 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone); | 481 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone); |
| 482 return; | 482 return; |
| 483 } | 483 } |
| 484 | 484 |
| 485 size_t currentNamedGridLine = 0; | 485 size_t currentNamedGridLine = 0; |
| 486 for (auto& currValue : *toCSSValueList(value)) { | 486 for (auto& currValue : *toCSSValueList(value)) { |
| 487 if (currValue->isGridLineNamesValue()) { | 487 if (currValue->isGridLineNamesValue()) { |
| 488 for (auto& namedGridLineValue : toCSSGridLineNamesValue(*currValue))
{ | 488 for (auto& namedGridLineValue : toCSSGridLineNamesValue(*currValue))
{ |
| 489 String namedGridLine = toCSSCustomIdentValue(namedGridLineValue.
get())->value(); | 489 String namedGridLine = toCSSCustomIdentValue(namedGridLineValue.
get())->string(); |
| 490 NamedGridLinesMap::AddResult result = namedGridLines.add(namedGr
idLine, Vector<size_t>()); | 490 NamedGridLinesMap::AddResult result = namedGridLines.add(namedGr
idLine, Vector<size_t>()); |
| 491 result.storedValue->value.append(currentNamedGridLine); | 491 result.storedValue->value.append(currentNamedGridLine); |
| 492 OrderedNamedGridLines::AddResult orderedInsertionResult = ordere
dNamedGridLines.add(currentNamedGridLine, Vector<String>()); | 492 OrderedNamedGridLines::AddResult orderedInsertionResult = ordere
dNamedGridLines.add(currentNamedGridLine, Vector<String>()); |
| 493 orderedInsertionResult.storedValue->value.append(namedGridLine); | 493 orderedInsertionResult.storedValue->value.append(namedGridLine); |
| 494 } | 494 } |
| 495 continue; | 495 continue; |
| 496 } | 496 } |
| 497 | 497 |
| 498 ++currentNamedGridLine; | 498 ++currentNamedGridLine; |
| 499 trackSizes.append(convertGridTrackSize(state, currValue.get())); | 499 trackSizes.append(convertGridTrackSize(state, currValue.get())); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 return ScaleTransformOperation::create(sx, sy, sz, TransformOperation::Scale
3D); | 963 return ScaleTransformOperation::create(sx, sy, sz, TransformOperation::Scale
3D); |
| 964 } | 964 } |
| 965 | 965 |
| 966 RespectImageOrientationEnum StyleBuilderConverter::convertImageOrientation(Style
ResolverState& state, CSSValue* value) | 966 RespectImageOrientationEnum StyleBuilderConverter::convertImageOrientation(Style
ResolverState& state, CSSValue* value) |
| 967 { | 967 { |
| 968 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 968 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 969 return primitiveValue->getValueID() == CSSValueFromImage ? RespectImageOrien
tation : DoNotRespectImageOrientation; | 969 return primitiveValue->getValueID() == CSSValueFromImage ? RespectImageOrien
tation : DoNotRespectImageOrientation; |
| 970 } | 970 } |
| 971 | 971 |
| 972 } // namespace blink | 972 } // namespace blink |
| OLD | NEW |