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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 LineBoxContain StyleBuilderConverter::convertLineBoxContain(StyleResolverState&,
CSSValue* value) | 565 LineBoxContain StyleBuilderConverter::convertLineBoxContain(StyleResolverState&,
CSSValue* value) |
566 { | 566 { |
567 if (value->isPrimitiveValue()) { | 567 if (value->isPrimitiveValue()) { |
568 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone); | 568 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone); |
569 return LineBoxContainNone; | 569 return LineBoxContainNone; |
570 } | 570 } |
571 | 571 |
572 return toCSSLineBoxContainValue(value)->value(); | 572 return toCSSLineBoxContainValue(value)->value(); |
573 } | 573 } |
574 | 574 |
| 575 static CSSToLengthConversionData lineHeightToLengthConversionData(StyleResolverS
tate& state) |
| 576 { |
| 577 float multiplier = state.style()->effectiveZoom(); |
| 578 if (LocalFrame* frame = state.document().frame()) |
| 579 multiplier *= frame->textZoomFactor(); |
| 580 return state.cssToLengthConversionData().copyWithAdjustedZoom(multiplier); |
| 581 } |
| 582 |
| 583 Length StyleBuilderConverter::convertLineHeight(StyleResolverState& state, CSSVa
lue* value) |
| 584 { |
| 585 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 586 |
| 587 if (primitiveValue->isLength()) |
| 588 return primitiveValue->computeLength<Length>(lineHeightToLengthConversio
nData(state)); |
| 589 if (primitiveValue->isPercentage()) |
| 590 return Length((state.style()->computedFontSize() * primitiveValue->getIn
tValue()) / 100.0, Fixed); |
| 591 if (primitiveValue->isNumber()) |
| 592 return Length(primitiveValue->getDoubleValue() * 100.0, Percent); |
| 593 if (primitiveValue->isCalculated()) { |
| 594 Length zoomedLength = Length(primitiveValue->cssCalcValue()->toCalcValue
(lineHeightToLengthConversionData(state))); |
| 595 return Length(valueForLength(zoomedLength, state.style()->fontSize()), F
ixed); |
| 596 } |
| 597 |
| 598 ASSERT(primitiveValue->getValueID() == CSSValueNormal); |
| 599 return RenderStyle::initialLineHeight(); |
| 600 } |
| 601 |
575 float StyleBuilderConverter::convertNumberOrPercentage(StyleResolverState& state
, CSSValue* value) | 602 float StyleBuilderConverter::convertNumberOrPercentage(StyleResolverState& state
, CSSValue* value) |
576 { | 603 { |
577 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 604 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
578 ASSERT(primitiveValue->isNumber() || primitiveValue->isPercentage()); | 605 ASSERT(primitiveValue->isNumber() || primitiveValue->isPercentage()); |
579 if (primitiveValue->isNumber()) | 606 if (primitiveValue->isNumber()) |
580 return primitiveValue->getFloatValue(); | 607 return primitiveValue->getFloatValue(); |
581 return primitiveValue->getFloatValue() / 100.0f; | 608 return primitiveValue->getFloatValue() / 100.0f; |
582 } | 609 } |
583 | 610 |
584 static float convertPerspectiveLength(StyleResolverState& state, CSSPrimitiveVal
ue* primitiveValue) | 611 static float convertPerspectiveLength(StyleResolverState& state, CSSPrimitiveVal
ue* primitiveValue) |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2)); | 850 CSSPrimitiveValue* primitiveValueZ = toCSSPrimitiveValue(list->item(2)); |
824 | 851 |
825 return TransformOrigin( | 852 return TransformOrigin( |
826 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX)
, | 853 convertOriginLength<CSSValueLeft, CSSValueRight>(state, primitiveValueX)
, |
827 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY)
, | 854 convertOriginLength<CSSValueTop, CSSValueBottom>(state, primitiveValueY)
, |
828 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu
eZ) | 855 StyleBuilderConverter::convertComputedLength<float>(state, primitiveValu
eZ) |
829 ); | 856 ); |
830 } | 857 } |
831 | 858 |
832 } // namespace blink | 859 } // namespace blink |
OLD | NEW |