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

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

Issue 2392343005: Reflow comments in core/css (Closed)
Patch Set: Revert clang-format Created 4 years, 2 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights
4 * reserved.
4 * 5 *
5 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
9 * 10 *
10 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 14 * Library General Public License for more details.
(...skipping 14 matching lines...) Expand all
28 #include "platform/LayoutUnit.h" 29 #include "platform/LayoutUnit.h"
29 #include "wtf/SizeAssertions.h" 30 #include "wtf/SizeAssertions.h"
30 #include "wtf/StdLibExtras.h" 31 #include "wtf/StdLibExtras.h"
31 32
32 using namespace WTF; 33 using namespace WTF;
33 34
34 namespace blink { 35 namespace blink {
35 36
36 namespace { 37 namespace {
37 38
38 // Max/min values for CSS, needs to slightly smaller/larger than the true max/mi n values to allow for rounding without overflowing. 39 // Max/min values for CSS, needs to slightly smaller/larger than the true
39 // Subtract two (rather than one) to allow for values to be converted to float a nd back without exceeding the LayoutUnit::max. 40 // max/min values to allow for rounding without overflowing.
41 // Subtract two (rather than one) to allow for values to be converted to float
42 // and back without exceeding the LayoutUnit::max.
40 const int maxValueForCssLength = INT_MAX / kFixedPointDenominator - 2; 43 const int maxValueForCssLength = INT_MAX / kFixedPointDenominator - 2;
41 const int minValueForCssLength = INT_MIN / kFixedPointDenominator + 2; 44 const int minValueForCssLength = INT_MIN / kFixedPointDenominator + 2;
42 45
43 } // namespace 46 } // namespace
44 47
45 struct SameSizeAsCSSPrimitiveValue : CSSValue { 48 struct SameSizeAsCSSPrimitiveValue : CSSValue {
46 double num; 49 double num;
47 }; 50 };
48 ASSERT_SIZE(CSSPrimitiveValue, SameSizeAsCSSPrimitiveValue); 51 ASSERT_SIZE(CSSPrimitiveValue, SameSizeAsCSSPrimitiveValue);
49 52
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 ASSERT(isCalculated()); 399 ASSERT(isCalculated());
397 return Length(cssCalcValue()->toCalcValue(conversionData)); 400 return Length(cssCalcValue()->toCalcValue(conversionData));
398 } 401 }
399 402
400 double CSSPrimitiveValue::getDoubleValue() const { 403 double CSSPrimitiveValue::getDoubleValue() const {
401 return type() != UnitType::Calc ? m_value.num : m_value.calc->doubleValue(); 404 return type() != UnitType::Calc ? m_value.num : m_value.calc->doubleValue();
402 } 405 }
403 406
404 CSSPrimitiveValue::UnitType CSSPrimitiveValue::canonicalUnitTypeForCategory( 407 CSSPrimitiveValue::UnitType CSSPrimitiveValue::canonicalUnitTypeForCategory(
405 UnitCategory category) { 408 UnitCategory category) {
406 // The canonical unit type is chosen according to the way CSSPropertyParser::v alidUnit() chooses the default unit 409 // The canonical unit type is chosen according to the way
407 // in each category (based on unitflags). 410 // CSSPropertyParser::validUnit() chooses the default unit in each category
411 // (based on unitflags).
408 switch (category) { 412 switch (category) {
409 case UNumber: 413 case UNumber:
410 return UnitType::Number; 414 return UnitType::Number;
411 case ULength: 415 case ULength:
412 return UnitType::Pixels; 416 return UnitType::Pixels;
413 case UPercent: 417 case UPercent:
414 return UnitType::Unknown; // Cannot convert between numbers and percent. 418 return UnitType::Unknown; // Cannot convert between numbers and percent.
415 case UTime: 419 case UTime:
416 return UnitType::Milliseconds; 420 return UnitType::Milliseconds;
417 case UAngle: 421 case UAngle:
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 case UnitType::Calc: 708 case UnitType::Calc:
705 visitor->trace(m_value.calc); 709 visitor->trace(m_value.calc);
706 break; 710 break;
707 default: 711 default:
708 break; 712 break;
709 } 713 }
710 CSSValue::traceAfterDispatch(visitor); 714 CSSValue::traceAfterDispatch(visitor);
711 } 715 }
712 716
713 } // namespace blink 717 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPrimitiveValue.h ('k') | third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698