OLD | NEW |
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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 isInteger), | 281 isInteger), |
282 m_value(value) {} | 282 m_value(value) {} |
283 | 283 |
284 Member<CSSPrimitiveValue> m_value; | 284 Member<CSSPrimitiveValue> m_value; |
285 }; | 285 }; |
286 | 286 |
287 static const CalculationCategory addSubtractResult[CalcOther][CalcOther] = { | 287 static const CalculationCategory addSubtractResult[CalcOther][CalcOther] = { |
288 /* CalcNumber */ {CalcNumber, CalcLengthNumber, CalcPercentNumber, | 288 /* CalcNumber */ {CalcNumber, CalcLengthNumber, CalcPercentNumber, |
289 CalcPercentNumber, CalcOther, CalcOther, CalcOther, | 289 CalcPercentNumber, CalcOther, CalcOther, CalcOther, |
290 CalcOther, CalcLengthNumber, CalcPercentLengthNumber}, | 290 CalcOther, CalcLengthNumber, CalcPercentLengthNumber}, |
291 /* CalcLength */ {CalcLengthNumber, CalcLength, CalcPercentLength, | 291 /* CalcLength */ |
292 CalcOther, CalcPercentLength, CalcOther, CalcOther, | 292 {CalcLengthNumber, CalcLength, CalcPercentLength, CalcOther, |
293 CalcOther, CalcLengthNumber, CalcPercentLengthNumber}, | 293 CalcPercentLength, CalcOther, CalcOther, CalcOther, CalcLengthNumber, |
294 /* CalcPercent */ {CalcPercentNumber, CalcPercentLength, CalcPercent, | 294 CalcPercentLengthNumber}, |
295 CalcPercentNumber, CalcPercentLength, CalcOther, | 295 /* CalcPercent */ |
296 CalcOther, CalcOther, CalcPercentLengthNumber, | 296 {CalcPercentNumber, CalcPercentLength, CalcPercent, CalcPercentNumber, |
297 CalcPercentLengthNumber}, | 297 CalcPercentLength, CalcOther, CalcOther, CalcOther, |
298 /* CalcPercentNumber */ {CalcPercentNumber, CalcPercentLengthNumber, | 298 CalcPercentLengthNumber, CalcPercentLengthNumber}, |
299 CalcPercentNumber, CalcPercentNumber, | 299 /* CalcPercentNumber */ |
300 CalcPercentLengthNumber, CalcOther, CalcOther, | 300 {CalcPercentNumber, CalcPercentLengthNumber, CalcPercentNumber, |
301 CalcOther, CalcOther, CalcPercentLengthNumber}, | 301 CalcPercentNumber, CalcPercentLengthNumber, CalcOther, CalcOther, |
302 /* CalcPercentLength */ {CalcPercentLengthNumber, CalcPercentLength, | 302 CalcOther, CalcOther, CalcPercentLengthNumber}, |
303 CalcPercentLength, CalcPercentLengthNumber, | 303 /* CalcPercentLength */ |
304 CalcPercentLength, CalcOther, CalcOther, CalcOther, | 304 {CalcPercentLengthNumber, CalcPercentLength, CalcPercentLength, |
305 CalcOther, CalcPercentLengthNumber}, | 305 CalcPercentLengthNumber, CalcPercentLength, CalcOther, CalcOther, |
306 /* CalcAngle */ {CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, | 306 CalcOther, CalcOther, CalcPercentLengthNumber}, |
307 CalcAngle, CalcOther, CalcOther, CalcOther, CalcOther}, | 307 /* CalcAngle */ |
308 /* CalcTime */ {CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, | 308 {CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcAngle, |
309 CalcOther, CalcTime, CalcOther, CalcOther, CalcOther}, | 309 CalcOther, CalcOther, CalcOther, CalcOther}, |
310 /* CalcFrequency */ {CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, | 310 /* CalcTime */ |
311 CalcOther, CalcOther, CalcFrequency, CalcOther, | 311 {CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcTime, |
312 CalcOther}, | 312 CalcOther, CalcOther, CalcOther}, |
313 /* CalcLengthNumber */ {CalcLengthNumber, CalcLengthNumber, | 313 /* CalcFrequency */ |
314 CalcPercentLengthNumber, CalcPercentLengthNumber, | 314 {CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, CalcOther, |
315 CalcPercentLengthNumber, CalcOther, CalcOther, | 315 CalcOther, CalcFrequency, CalcOther, CalcOther}, |
316 CalcOther, CalcLengthNumber, | 316 /* CalcLengthNumber */ |
317 CalcPercentLengthNumber}, | 317 {CalcLengthNumber, CalcLengthNumber, CalcPercentLengthNumber, |
318 /* CalcPercentLengthNumber */ { | 318 CalcPercentLengthNumber, CalcPercentLengthNumber, CalcOther, CalcOther, |
319 CalcPercentLengthNumber, CalcPercentLengthNumber, | 319 CalcOther, CalcLengthNumber, CalcPercentLengthNumber}, |
320 CalcPercentLengthNumber, CalcPercentLengthNumber, | 320 /* CalcPercentLengthNumber */ |
321 CalcPercentLengthNumber, CalcOther, CalcOther, CalcOther, | 321 {CalcPercentLengthNumber, CalcPercentLengthNumber, CalcPercentLengthNumber, |
322 CalcPercentLengthNumber, CalcPercentLengthNumber}}; | 322 CalcPercentLengthNumber, CalcPercentLengthNumber, CalcOther, CalcOther, |
| 323 CalcOther, CalcPercentLengthNumber, CalcPercentLengthNumber}}; |
323 | 324 |
324 static CalculationCategory determineCategory( | 325 static CalculationCategory determineCategory( |
325 const CSSCalcExpressionNode& leftSide, | 326 const CSSCalcExpressionNode& leftSide, |
326 const CSSCalcExpressionNode& rightSide, | 327 const CSSCalcExpressionNode& rightSide, |
327 CalcOperator op) { | 328 CalcOperator op) { |
328 CalculationCategory leftCategory = leftSide.category(); | 329 CalculationCategory leftCategory = leftSide.category(); |
329 CalculationCategory rightCategory = rightSide.category(); | 330 CalculationCategory rightCategory = rightSide.category(); |
330 | 331 |
331 if (leftCategory == CalcOther || rightCategory == CalcOther) | 332 if (leftCategory == CalcOther || rightCategory == CalcOther) |
332 return CalcOther; | 333 return CalcOther; |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 | 837 |
837 return expression ? new CSSCalcValue(expression, range) : nullptr; | 838 return expression ? new CSSCalcValue(expression, range) : nullptr; |
838 } | 839 } |
839 | 840 |
840 CSSCalcValue* CSSCalcValue::create(CSSCalcExpressionNode* expression, | 841 CSSCalcValue* CSSCalcValue::create(CSSCalcExpressionNode* expression, |
841 ValueRange range) { | 842 ValueRange range) { |
842 return new CSSCalcValue(expression, range); | 843 return new CSSCalcValue(expression, range); |
843 } | 844 } |
844 | 845 |
845 } // namespace blink | 846 } // namespace blink |
OLD | NEW |