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

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

Issue 1835403003: Allow number-percentage calc() in border-image-slice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V2 Created 4 years, 8 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 194 }
195 195
196 String customCSSText() const override 196 String customCSSText() const override
197 { 197 {
198 return m_value->cssText(); 198 return m_value->cssText();
199 } 199 }
200 200
201 void accumulatePixelsAndPercent(const CSSToLengthConversionData& conversionD ata, PixelsAndPercent& value, float multiplier) const override 201 void accumulatePixelsAndPercent(const CSSToLengthConversionData& conversionD ata, PixelsAndPercent& value, float multiplier) const override
202 { 202 {
203 switch (m_category) { 203 switch (m_category) {
204 case CalcNumber:
205 value.pixels += m_value->getFloatValue() * multiplier;
206 break;
alancutter (OOO until 2018) 2016/03/30 01:14:01 Numbers aren't always converted straight to pixels
204 case CalcLength: 207 case CalcLength:
205 value.pixels += m_value->computeLength<float>(conversionData) * mult iplier; 208 value.pixels += m_value->computeLength<float>(conversionData) * mult iplier;
206 break; 209 break;
207 case CalcPercent: 210 case CalcPercent:
208 ASSERT(m_value->isPercentage()); 211 ASSERT(m_value->isPercentage());
209 value.percent += m_value->getDoubleValue() * multiplier; 212 value.percent += m_value->getDoubleValue() * multiplier;
210 break; 213 break;
211 default: 214 default:
212 ASSERT_NOT_REACHED(); 215 ASSERT_NOT_REACHED();
213 } 216 }
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 740
738 return expression ? adoptRefWillBeNoop(new CSSCalcValue(expression, range)) : nullptr; 741 return expression ? adoptRefWillBeNoop(new CSSCalcValue(expression, range)) : nullptr;
739 } 742 }
740 743
741 PassRefPtrWillBeRawPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtrWillBeRawPtr <CSSCalcExpressionNode> expression, ValueRange range) 744 PassRefPtrWillBeRawPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtrWillBeRawPtr <CSSCalcExpressionNode> expression, ValueRange range)
742 { 745 {
743 return adoptRefWillBeNoop(new CSSCalcValue(expression, range)); 746 return adoptRefWillBeNoop(new CSSCalcValue(expression, range));
744 } 747 }
745 748
746 } // namespace blink 749 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698