Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 603 if (slices->right()->isPercentage()) | 603 if (slices->right()->isPercentage()) |
| 604 box.m_right = Length(slices->right()->getDoubleValue(), Percent); | 604 box.m_right = Length(slices->right()->getDoubleValue(), Percent); |
| 605 else | 605 else |
| 606 box.m_right = Length(slices->right()->getIntValue(CSSPrimitiveValue::CSS _NUMBER), Fixed); | 606 box.m_right = Length(slices->right()->getIntValue(CSSPrimitiveValue::CSS _NUMBER), Fixed); |
| 607 image.setImageSlices(box); | 607 image.setImageSlices(box); |
| 608 | 608 |
| 609 // Set our fill mode. | 609 // Set our fill mode. |
| 610 image.setFill(borderImageSlice->m_fill); | 610 image.setFill(borderImageSlice->m_fill); |
| 611 } | 611 } |
| 612 | 612 |
| 613 static BorderImageLength toBorderImageLength(CSSPrimitiveValue& value, const Ren derStyle* currStyle, const RenderStyle* rootStyle, float multiplier) | |
|
Julien - ping for review
2013/11/24 22:53:01
s/currStyle/currentStyle/ (3 characters isn't much
davve
2013/11/25 22:15:16
Done.
| |
| 614 { | |
| 615 if (value.isNumber()) | |
| 616 return value.getDoubleValue(); | |
| 617 if (value.isPercentage()) | |
| 618 return Length(value.getDoubleValue(CSSPrimitiveValue::CSS_PERCENTAGE), P ercent); | |
| 619 if (value.getValueID() != CSSValueAuto) | |
| 620 return value.computeLength<Length>(currStyle, rootStyle, multiplier); | |
| 621 return Length(Auto); | |
| 622 } | |
| 623 | |
| 613 BorderImageLengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value) const | 624 BorderImageLengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value) const |
| 614 { | 625 { |
| 615 if (!value || !value->isPrimitiveValue()) | 626 if (!value || !value->isPrimitiveValue()) |
| 616 return BorderImageLengthBox(); | 627 return BorderImageLengthBox(Length(Auto)); |
| 617 | 628 |
| 618 // Get our zoom value. | |
| 619 float zoom = useSVGZoomRules() ? 1.0f : style()->effectiveZoom(); | 629 float zoom = useSVGZoomRules() ? 1.0f : style()->effectiveZoom(); |
| 630 Quad* slices = toCSSPrimitiveValue(value)->getQuadValue(); | |
| 620 | 631 |
| 621 // Retrieve the primitive value. | 632 // Set up a border image length box to represent our image slices. |
| 622 CSSPrimitiveValue* borderWidths = toCSSPrimitiveValue(value); | 633 return BorderImageLengthBox( |
| 623 | 634 toBorderImageLength(*slices->top(), style(), rootElementStyle(), zoom), |
| 624 // Set up a length box to represent our image slices. | 635 toBorderImageLength(*slices->right(), style(), rootElementStyle(), zoom) , |
| 625 BorderImageLengthBox box; // Defaults to 'auto' so we don't have to handle t hat explicitly below. | 636 toBorderImageLength(*slices->bottom(), style(), rootElementStyle(), zoom ), |
| 626 Quad* slices = borderWidths->getQuadValue(); | 637 toBorderImageLength(*slices->left(), style(), rootElementStyle(), zoom)) ; |
| 627 if (slices->top()->isNumber()) | |
| 628 box.setTop(slices->top()->getDoubleValue()); | |
| 629 else if (slices->top()->isPercentage()) | |
| 630 box.setTop(Length(slices->top()->getDoubleValue(CSSPrimitiveValue::CSS_P ERCENTAGE), Percent)); | |
| 631 else if (slices->top()->getValueID() != CSSValueAuto) | |
| 632 box.setTop(slices->top()->computeLength<Length>(style(), rootElementStyl e(), zoom)); | |
| 633 | |
| 634 if (slices->right()->isNumber()) | |
| 635 box.setRight(slices->right()->getDoubleValue()); | |
| 636 else if (slices->right()->isPercentage()) | |
| 637 box.setRight(Length(slices->right()->getDoubleValue(CSSPrimitiveValue::C SS_PERCENTAGE), Percent)); | |
| 638 else if (slices->right()->getValueID() != CSSValueAuto) | |
| 639 box.setRight(slices->right()->computeLength<Length>(style(), rootElement Style(), zoom)); | |
| 640 | |
| 641 if (slices->bottom()->isNumber()) | |
| 642 box.setBottom(slices->bottom()->getDoubleValue()); | |
| 643 else if (slices->bottom()->isPercentage()) | |
| 644 box.setBottom(Length(slices->bottom()->getDoubleValue(CSSPrimitiveValue: :CSS_PERCENTAGE), Percent)); | |
| 645 else if (slices->bottom()->getValueID() != CSSValueAuto) | |
| 646 box.setBottom(slices->bottom()->computeLength<Length>(style(), rootEleme ntStyle(), zoom)); | |
| 647 | |
| 648 if (slices->left()->isNumber()) | |
| 649 box.setLeft(slices->left()->getDoubleValue()); | |
| 650 else if (slices->left()->isPercentage()) | |
| 651 box.setLeft(Length(slices->left()->getDoubleValue(CSSPrimitiveValue::CSS _PERCENTAGE), Percent)); | |
| 652 else if (slices->left()->getValueID() != CSSValueAuto) | |
| 653 box.setLeft(slices->left()->computeLength<Length>(style(), rootElementSt yle(), zoom)); | |
| 654 | |
| 655 return box; | |
| 656 } | 638 } |
| 657 | 639 |
| 658 void CSSToStyleMap::mapNinePieceImageRepeat(CSSValue* value, NinePieceImage& ima ge) const | 640 void CSSToStyleMap::mapNinePieceImageRepeat(CSSValue* value, NinePieceImage& ima ge) const |
| 659 { | 641 { |
| 660 if (!value || !value->isPrimitiveValue()) | 642 if (!value || !value->isPrimitiveValue()) |
| 661 return; | 643 return; |
| 662 | 644 |
| 663 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 645 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 664 Pair* pair = primitiveValue->getPairValue(); | 646 Pair* pair = primitiveValue->getPairValue(); |
| 665 if (!pair || !pair->first() || !pair->second()) | 647 if (!pair || !pair->first() || !pair->second()) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 verticalRule = SpaceImageRule; | 679 verticalRule = SpaceImageRule; |
| 698 break; | 680 break; |
| 699 default: // CSSValueRepeat | 681 default: // CSSValueRepeat |
| 700 verticalRule = RepeatImageRule; | 682 verticalRule = RepeatImageRule; |
| 701 break; | 683 break; |
| 702 } | 684 } |
| 703 image.setVerticalRule(verticalRule); | 685 image.setVerticalRule(verticalRule); |
| 704 } | 686 } |
| 705 | 687 |
| 706 }; | 688 }; |
| OLD | NEW |