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

Side by Side Diff: third_party/WebKit/Source/platform/LengthFunctions.cpp

Issue 1420303002: Remove support for intrinsic and min-intrinsic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « third_party/WebKit/Source/platform/Length.h ('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 Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
4 Copyright (C) 2011 Rik Cabanier (cabanier@adobe.com) 4 Copyright (C) 2011 Rik Cabanier (cabanier@adobe.com)
5 Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
6 Copyright (C) 2012 Motorola Mobility, Inc. All rights reserved. 6 Copyright (C) 2012 Motorola Mobility, Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 28 matching lines...) Expand all
39 switch (length.type()) { 39 switch (length.type()) {
40 case Fixed: 40 case Fixed:
41 return length.getFloatValue(); 41 return length.getFloatValue();
42 case Percent: 42 case Percent:
43 return static_cast<float>(maximumValue * length.percent() / 100.0f); 43 return static_cast<float>(maximumValue * length.percent() / 100.0f);
44 case FillAvailable: 44 case FillAvailable:
45 case Auto: 45 case Auto:
46 return static_cast<float>(maximumValue); 46 return static_cast<float>(maximumValue);
47 case Calculated: 47 case Calculated:
48 return length.nonNanCalculatedValue(maximumValue); 48 return length.nonNanCalculatedValue(maximumValue);
49 case Intrinsic:
50 case MinIntrinsic:
51 case MinContent: 49 case MinContent:
52 case MaxContent: 50 case MaxContent:
53 case FitContent: 51 case FitContent:
54 case ExtendToZoom: 52 case ExtendToZoom:
55 case DeviceWidth: 53 case DeviceWidth:
56 case DeviceHeight: 54 case DeviceHeight:
57 case MaxSizeNone: 55 case MaxSizeNone:
58 ASSERT_NOT_REACHED(); 56 ASSERT_NOT_REACHED();
59 return 0; 57 return 0;
60 } 58 }
61 ASSERT_NOT_REACHED(); 59 ASSERT_NOT_REACHED();
62 return 0; 60 return 0;
63 } 61 }
64 62
65 LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue) 63 LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue)
66 { 64 {
67 switch (length.type()) { 65 switch (length.type()) {
68 case Fixed: 66 case Fixed:
69 return length.value(); 67 return length.value();
70 case Percent: 68 case Percent:
71 // Don't remove the extra cast to float. It is needed for rounding on 32 -bit Intel machines that use the FPU stack. 69 // Don't remove the extra cast to float. It is needed for rounding on 32 -bit Intel machines that use the FPU stack.
72 return static_cast<float>(maximumValue * length.percent() / 100.0f); 70 return static_cast<float>(maximumValue * length.percent() / 100.0f);
73 case Calculated: 71 case Calculated:
74 return length.nonNanCalculatedValue(maximumValue.toFloat()); 72 return length.nonNanCalculatedValue(maximumValue.toFloat());
75 case FillAvailable: 73 case FillAvailable:
76 case Auto: 74 case Auto:
77 return 0; 75 return 0;
78 case Intrinsic:
79 case MinIntrinsic:
80 case MinContent: 76 case MinContent:
81 case MaxContent: 77 case MaxContent:
82 case FitContent: 78 case FitContent:
83 case ExtendToZoom: 79 case ExtendToZoom:
84 case DeviceWidth: 80 case DeviceWidth:
85 case DeviceHeight: 81 case DeviceHeight:
86 case MaxSizeNone: 82 case MaxSizeNone:
87 ASSERT_NOT_REACHED(); 83 ASSERT_NOT_REACHED();
88 return 0; 84 return 0;
89 } 85 }
(...skipping 11 matching lines...) Expand all
101 LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue) 97 LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue)
102 { 98 {
103 switch (length.type()) { 99 switch (length.type()) {
104 case Fixed: 100 case Fixed:
105 case Percent: 101 case Percent:
106 case Calculated: 102 case Calculated:
107 return minimumValueForLength(length, maximumValue); 103 return minimumValueForLength(length, maximumValue);
108 case FillAvailable: 104 case FillAvailable:
109 case Auto: 105 case Auto:
110 return maximumValue; 106 return maximumValue;
111 case Intrinsic:
112 case MinIntrinsic:
113 case MinContent: 107 case MinContent:
114 case MaxContent: 108 case MaxContent:
115 case FitContent: 109 case FitContent:
116 case ExtendToZoom: 110 case ExtendToZoom:
117 case DeviceWidth: 111 case DeviceWidth:
118 case DeviceHeight: 112 case DeviceHeight:
119 case MaxSizeNone: 113 case MaxSizeNone:
120 ASSERT_NOT_REACHED(); 114 ASSERT_NOT_REACHED();
121 return 0; 115 return 0;
122 } 116 }
123 ASSERT_NOT_REACHED(); 117 ASSERT_NOT_REACHED();
124 return 0; 118 return 0;
125 } 119 }
126 120
127 FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatSize& boxSize) 121 FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatSize& boxSize)
128 { 122 {
129 return FloatSize(floatValueForLength(lengthSize.width(), boxSize.width()), f loatValueForLength(lengthSize.height(), boxSize.height())); 123 return FloatSize(floatValueForLength(lengthSize.width(), boxSize.width()), f loatValueForLength(lengthSize.height(), boxSize.height()));
130 } 124 }
131 125
132 } // namespace blink 126 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/Length.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698