| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
| 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 585 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 586 | 586 |
| 587 if (primitiveValue->getValueID()) { | 587 if (primitiveValue->getValueID()) { |
| 588 state.style()->setVerticalAlign(*primitiveValue); | 588 state.style()->setVerticalAlign(*primitiveValue); |
| 589 return; | 589 return; |
| 590 } | 590 } |
| 591 | 591 |
| 592 state.style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedC
onversion | PercentConversion>(state.cssToLengthConversionData())); | 592 state.style()->setVerticalAlignLength(primitiveValue->convertToLength<FixedC
onversion | PercentConversion>(state.cssToLengthConversionData())); |
| 593 } | 593 } |
| 594 | 594 |
| 595 static void resetEffectiveZoom(StyleResolverState& state) | |
| 596 { | |
| 597 // Reset the zoom in effect. This allows the setZoom method to accurately co
mpute a new zoom in effect. | |
| 598 state.setEffectiveZoom(state.parentStyle() ? state.parentStyle()->effectiveZ
oom() : RenderStyle::initialZoom()); | |
| 599 } | |
| 600 | |
| 601 void StyleBuilderFunctions::applyInitialCSSPropertyZoom(StyleResolverState& stat
e) | |
| 602 { | |
| 603 resetEffectiveZoom(state); | |
| 604 state.setZoom(RenderStyle::initialZoom()); | |
| 605 } | |
| 606 | |
| 607 void StyleBuilderFunctions::applyInheritCSSPropertyZoom(StyleResolverState& stat
e) | |
| 608 { | |
| 609 resetEffectiveZoom(state); | |
| 610 state.setZoom(state.parentStyle()->zoom()); | |
| 611 } | |
| 612 | |
| 613 void StyleBuilderFunctions::applyValueCSSPropertyZoom(StyleResolverState& state,
CSSValue* value) | |
| 614 { | |
| 615 ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue()); | |
| 616 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | |
| 617 | |
| 618 if (primitiveValue->getValueID() == CSSValueNormal) { | |
| 619 resetEffectiveZoom(state); | |
| 620 state.setZoom(RenderStyle::initialZoom()); | |
| 621 } else if (primitiveValue->getValueID() == CSSValueReset) { | |
| 622 state.setEffectiveZoom(RenderStyle::initialZoom()); | |
| 623 state.setZoom(RenderStyle::initialZoom()); | |
| 624 } else if (primitiveValue->getValueID() == CSSValueDocument) { | |
| 625 float docZoom = state.rootElementStyle() ? state.rootElementStyle()->zoo
m() : RenderStyle::initialZoom(); | |
| 626 state.setEffectiveZoom(docZoom); | |
| 627 state.setZoom(docZoom); | |
| 628 } else if (primitiveValue->isPercentage()) { | |
| 629 resetEffectiveZoom(state); | |
| 630 if (float percent = primitiveValue->getFloatValue()) | |
| 631 state.setZoom(percent / 100.0f); | |
| 632 } else if (primitiveValue->isNumber()) { | |
| 633 resetEffectiveZoom(state); | |
| 634 if (float number = primitiveValue->getFloatValue()) | |
| 635 state.setZoom(number); | |
| 636 } | |
| 637 } | |
| 638 | |
| 639 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitAspectRatio(StyleResolv
erState& state) | 595 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitAspectRatio(StyleResolv
erState& state) |
| 640 { | 596 { |
| 641 state.style()->setHasAspectRatio(RenderStyle::initialHasAspectRatio()); | 597 state.style()->setHasAspectRatio(RenderStyle::initialHasAspectRatio()); |
| 642 state.style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDeno
minator()); | 598 state.style()->setAspectRatioDenominator(RenderStyle::initialAspectRatioDeno
minator()); |
| 643 state.style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumera
tor()); | 599 state.style()->setAspectRatioNumerator(RenderStyle::initialAspectRatioNumera
tor()); |
| 644 } | 600 } |
| 645 | 601 |
| 646 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitAspectRatio(StyleResolv
erState& state) | 602 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitAspectRatio(StyleResolv
erState& state) |
| 647 { | 603 { |
| 648 if (!state.parentStyle()->hasAspectRatio()) | 604 if (!state.parentStyle()->hasAspectRatio()) |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 state.style()->setPerspective(perspectiveValue); | 838 state.style()->setPerspective(perspectiveValue); |
| 883 } | 839 } |
| 884 | 840 |
| 885 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso
lverState& state, CSSValue* value) | 841 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso
lverState& state, CSSValue* value) |
| 886 { | 842 { |
| 887 if (value->isPrimitiveValue()) | 843 if (value->isPrimitiveValue()) |
| 888 state.setTextOrientation(*toCSSPrimitiveValue(value)); | 844 state.setTextOrientation(*toCSSPrimitiveValue(value)); |
| 889 } | 845 } |
| 890 | 846 |
| 891 } // namespace blink | 847 } // namespace blink |
| OLD | NEW |