Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: Source/core/css/resolver/CSSToStyleMap.cpp

Issue 1304993002: Change Rect and Quad to be CSSValues (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@split_counter_out_attempt_3
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
26 */ 26 */
27 27
28 #include "config.h" 28 #include "config.h"
29 #include "core/css/resolver/CSSToStyleMap.h" 29 #include "core/css/resolver/CSSToStyleMap.h"
30 30
31 #include "core/CSSValueKeywords.h" 31 #include "core/CSSValueKeywords.h"
32 #include "core/animation/css/CSSAnimationData.h" 32 #include "core/animation/css/CSSAnimationData.h"
33 #include "core/css/CSSBorderImageSliceValue.h" 33 #include "core/css/CSSBorderImageSliceValue.h"
34 #include "core/css/CSSPrimitiveValue.h" 34 #include "core/css/CSSPrimitiveValue.h"
35 #include "core/css/CSSPrimitiveValueMappings.h" 35 #include "core/css/CSSPrimitiveValueMappings.h"
36 #include "core/css/CSSQuadValue.h"
36 #include "core/css/CSSTimingFunctionValue.h" 37 #include "core/css/CSSTimingFunctionValue.h"
37 #include "core/css/Pair.h" 38 #include "core/css/Pair.h"
38 #include "core/css/Rect.h"
39 #include "core/css/resolver/StyleBuilderConverter.h" 39 #include "core/css/resolver/StyleBuilderConverter.h"
40 #include "core/css/resolver/StyleResolverState.h" 40 #include "core/css/resolver/StyleResolverState.h"
41 #include "core/style/BorderImageLengthBox.h" 41 #include "core/style/BorderImageLengthBox.h"
42 #include "core/style/FillLayer.h" 42 #include "core/style/FillLayer.h"
43 43
44 namespace blink { 44 namespace blink {
45 45
46 void CSSToStyleMap::mapFillAttachment(StyleResolverState&, FillLayer* layer, CSS Value* value) 46 void CSSToStyleMap::mapFillAttachment(StyleResolverState&, FillLayer* layer, CSS Value* value)
47 { 47 {
48 if (value->isInitialValue()) { 48 if (value->isInitialValue()) {
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 void CSSToStyleMap::mapNinePieceImageSlice(StyleResolverState&, CSSValue* value, NinePieceImage& image) 487 void CSSToStyleMap::mapNinePieceImageSlice(StyleResolverState&, CSSValue* value, NinePieceImage& image)
488 { 488 {
489 if (!value || !value->isBorderImageSliceValue()) 489 if (!value || !value->isBorderImageSliceValue())
490 return; 490 return;
491 491
492 // Retrieve the border image value. 492 // Retrieve the border image value.
493 CSSBorderImageSliceValue* borderImageSlice = toCSSBorderImageSliceValue(valu e); 493 CSSBorderImageSliceValue* borderImageSlice = toCSSBorderImageSliceValue(valu e);
494 494
495 // Set up a length box to represent our image slices. 495 // Set up a length box to represent our image slices.
496 LengthBox box; 496 LengthBox box;
497 Quad* slices = borderImageSlice->slices(); 497 CSSQuadValue* slices = borderImageSlice->slices();
498 if (slices->top()->isPercentage()) 498 if (slices->top()->isPercentage())
499 box.m_top = Length(slices->top()->getDoubleValue(), Percent); 499 box.m_top = Length(slices->top()->getDoubleValue(), Percent);
500 else 500 else
501 box.m_top = Length(slices->top()->getIntValue(), Fixed); 501 box.m_top = Length(slices->top()->getIntValue(), Fixed);
502 if (slices->bottom()->isPercentage()) 502 if (slices->bottom()->isPercentage())
503 box.m_bottom = Length(slices->bottom()->getDoubleValue(), Percent); 503 box.m_bottom = Length(slices->bottom()->getDoubleValue(), Percent);
504 else 504 else
505 box.m_bottom = Length(slices->bottom()->getIntValue(), Fixed); 505 box.m_bottom = Length(slices->bottom()->getIntValue(), Fixed);
506 if (slices->left()->isPercentage()) 506 if (slices->left()->isPercentage())
507 box.m_left = Length(slices->left()->getDoubleValue(), Percent); 507 box.m_left = Length(slices->left()->getDoubleValue(), Percent);
(...skipping 15 matching lines...) Expand all
523 return value.getDoubleValue(); 523 return value.getDoubleValue();
524 if (value.isPercentage()) 524 if (value.isPercentage())
525 return Length(value.getDoubleValue(), Percent); 525 return Length(value.getDoubleValue(), Percent);
526 if (value.getValueID() != CSSValueAuto) 526 if (value.getValueID() != CSSValueAuto)
527 return value.computeLength<Length>(conversionData); 527 return value.computeLength<Length>(conversionData);
528 return Length(Auto); 528 return Length(Auto);
529 } 529 }
530 530
531 BorderImageLengthBox CSSToStyleMap::mapNinePieceImageQuad(StyleResolverState& st ate, CSSValue* value) 531 BorderImageLengthBox CSSToStyleMap::mapNinePieceImageQuad(StyleResolverState& st ate, CSSValue* value)
532 { 532 {
533 if (!value || !value->isPrimitiveValue()) 533 if (!value || !value->isQuadValue())
534 return BorderImageLengthBox(Length(Auto)); 534 return BorderImageLengthBox(Length(Auto));
535 535
536 Quad* slices = toCSSPrimitiveValue(value)->getQuadValue(); 536 RefPtrWillBeRawPtr<CSSQuadValue> slices = toCSSQuadValue(value);
537 537
538 // Set up a border image length box to represent our image slices. 538 // Set up a border image length box to represent our image slices.
539 return BorderImageLengthBox( 539 return BorderImageLengthBox(
540 toBorderImageLength(*slices->top(), state.cssToLengthConversionData()), 540 toBorderImageLength(*slices->top(), state.cssToLengthConversionData()),
541 toBorderImageLength(*slices->right(), state.cssToLengthConversionData()) , 541 toBorderImageLength(*slices->right(), state.cssToLengthConversionData()) ,
542 toBorderImageLength(*slices->bottom(), state.cssToLengthConversionData() ), 542 toBorderImageLength(*slices->bottom(), state.cssToLengthConversionData() ),
543 toBorderImageLength(*slices->left(), state.cssToLengthConversionData())) ; 543 toBorderImageLength(*slices->left(), state.cssToLengthConversionData())) ;
544 } 544 }
545 545
546 void CSSToStyleMap::mapNinePieceImageRepeat(StyleResolverState&, CSSValue* value , NinePieceImage& image) 546 void CSSToStyleMap::mapNinePieceImageRepeat(StyleResolverState&, CSSValue* value , NinePieceImage& image)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 verticalRule = SpaceImageRule; 585 verticalRule = SpaceImageRule;
586 break; 586 break;
587 default: // CSSValueRepeat 587 default: // CSSValueRepeat
588 verticalRule = RepeatImageRule; 588 verticalRule = RepeatImageRule;
589 break; 589 break;
590 } 590 }
591 image.setVerticalRule(verticalRule); 591 image.setVerticalRule(verticalRule);
592 } 592 }
593 593
594 }; 594 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698