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

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

Issue 1835403003: Allow number-percentage calc() in border-image-slice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another approach Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 state.style()->setBorderTopWidth(image.borderSlices().top().length() .value()); 476 state.style()->setBorderTopWidth(image.borderSlices().top().length() .value());
477 if (image.borderSlices().right().isLength() && image.borderSlices().righ t().length().isFixed()) 477 if (image.borderSlices().right().isLength() && image.borderSlices().righ t().length().isFixed())
478 state.style()->setBorderRightWidth(image.borderSlices().right().leng th().value()); 478 state.style()->setBorderRightWidth(image.borderSlices().right().leng th().value());
479 if (image.borderSlices().bottom().isLength() && image.borderSlices().bot tom().length().isFixed()) 479 if (image.borderSlices().bottom().isLength() && image.borderSlices().bot tom().length().isFixed())
480 state.style()->setBorderBottomWidth(image.borderSlices().bottom().le ngth().value()); 480 state.style()->setBorderBottomWidth(image.borderSlices().bottom().le ngth().value());
481 if (image.borderSlices().left().isLength() && image.borderSlices().left( ).length().isFixed()) 481 if (image.borderSlices().left().isLength() && image.borderSlices().left( ).length().isFixed())
482 state.style()->setBorderLeftWidth(image.borderSlices().left().length ().value()); 482 state.style()->setBorderLeftWidth(image.borderSlices().left().length ().value());
483 } 483 }
484 } 484 }
485 485
486 static Length convertBorderImageSliceSide(const CSSPrimitiveValue& value) 486 static Length convertBorderImageSliceSide(const CSSPrimitiveValue& value, const CSSToLengthConversionData& conversionData)
487 { 487 {
488 if (value.isPercentage()) 488 if (value.isPercentage() || value.isCalculated())
489 return Length(value.getDoubleValue(), Percent); 489 return value.convertToLength(conversionData);
490 return Length(round(value.getDoubleValue()), Fixed); 490 return Length(round(value.getDoubleValue()), Fixed);
491 } 491 }
492 492
493 void CSSToStyleMap::mapNinePieceImageSlice(StyleResolverState&, const CSSValue& value, NinePieceImage& image) 493 void CSSToStyleMap::mapNinePieceImageSlice(StyleResolverState& state, const CSSV alue& value, NinePieceImage& image)
494 { 494 {
495 if (!value.isBorderImageSliceValue()) 495 if (!value.isBorderImageSliceValue())
496 return; 496 return;
497 497
498 // Retrieve the border image value. 498 // Retrieve the border image value.
499 const CSSBorderImageSliceValue& borderImageSlice = toCSSBorderImageSliceValu e(value); 499 const CSSBorderImageSliceValue& borderImageSlice = toCSSBorderImageSliceValu e(value);
500 500
501 // Set up a length box to represent our image slices. 501 // Set up a length box to represent our image slices.
502 LengthBox box; 502 LengthBox box;
503 const CSSQuadValue& slices = borderImageSlice.slices(); 503 const CSSQuadValue& slices = borderImageSlice.slices();
504 box.m_top = convertBorderImageSliceSide(*slices.top()); 504 box.m_top = convertBorderImageSliceSide(*slices.top(), state.cssToLengthConv ersionData());
505 box.m_bottom = convertBorderImageSliceSide(*slices.bottom()); 505 box.m_bottom = convertBorderImageSliceSide(*slices.bottom(), state.cssToLeng thConversionData());
506 box.m_left = convertBorderImageSliceSide(*slices.left()); 506 box.m_left = convertBorderImageSliceSide(*slices.left(), state.cssToLengthCo nversionData());
507 box.m_right = convertBorderImageSliceSide(*slices.right()); 507 box.m_right = convertBorderImageSliceSide(*slices.right(), state.cssToLength ConversionData());
508 image.setImageSlices(box); 508 image.setImageSlices(box);
509 509
510 // Set our fill mode. 510 // Set our fill mode.
511 image.setFill(borderImageSlice.fill()); 511 image.setFill(borderImageSlice.fill());
512 } 512 }
513 513
514 static BorderImageLength toBorderImageLength(CSSPrimitiveValue& value, const CSS ToLengthConversionData& conversionData) 514 static BorderImageLength toBorderImageLength(CSSPrimitiveValue& value, const CSS ToLengthConversionData& conversionData)
515 { 515 {
516 if (value.isNumber()) 516 if (value.isNumber())
517 return value.getDoubleValue(); 517 return value.getDoubleValue();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 verticalRule = SpaceImageRule; 575 verticalRule = SpaceImageRule;
576 break; 576 break;
577 default: // CSSValueRepeat 577 default: // CSSValueRepeat
578 verticalRule = RepeatImageRule; 578 verticalRule = RepeatImageRule;
579 break; 579 break;
580 } 580 }
581 image.setVerticalRule(verticalRule); 581 image.setVerticalRule(verticalRule);
582 } 582 }
583 583
584 } // namespace blink 584 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698