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

Side by Side Diff: Source/core/css/parser/SizesCalcParser.cpp

Issue 644813005: Floating point MQs should not match. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added max/min tests Created 6 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 | « Source/core/css/parser/SizesAttributeParser.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/css/parser/SizesCalcParser.h" 6 #include "core/css/parser/SizesCalcParser.h"
7 7
8 #include "core/css/MediaValues.h" 8 #include "core/css/MediaValues.h"
9 #include "core/css/parser/MediaQueryToken.h" 9 #include "core/css/parser/MediaQueryToken.h"
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 void SizesCalcParser::appendNumber(const MediaQueryToken& token) 63 void SizesCalcParser::appendNumber(const MediaQueryToken& token)
64 { 64 {
65 SizesCalcValue value; 65 SizesCalcValue value;
66 value.value = token.numericValue(); 66 value.value = token.numericValue();
67 m_valueList.append(value); 67 m_valueList.append(value);
68 } 68 }
69 69
70 bool SizesCalcParser::appendLength(const MediaQueryToken& token) 70 bool SizesCalcParser::appendLength(const MediaQueryToken& token)
71 { 71 {
72 SizesCalcValue value; 72 SizesCalcValue value;
73 double result = 0; 73 float result = 0;
74 if (!m_mediaValues->computeLength(token.numericValue(), token.unitType(), re sult)) 74 if (!m_mediaValues->computeLength(token.numericValue(), token.unitType(), re sult))
75 return false; 75 return false;
76 value.value = result; 76 value.value = result;
rune 2014/10/10 12:46:04 Now you're taking a double (numericValue()), conve
77 value.isLength = true; 77 value.isLength = true;
78 m_valueList.append(value); 78 m_valueList.append(value);
79 return true; 79 return true;
80 } 80 }
81 81
82 void SizesCalcParser::appendOperator(const MediaQueryToken& token) 82 void SizesCalcParser::appendOperator(const MediaQueryToken& token)
83 { 83 {
84 SizesCalcValue value; 84 SizesCalcValue value;
85 value.operation = token.delimiter(); 85 value.operation = token.delimiter();
86 m_valueList.append(value); 86 m_valueList.append(value);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 212 }
213 } 213 }
214 if (stack.size() == 1 && stack.last().isLength) { 214 if (stack.size() == 1 && stack.last().isLength) {
215 m_result = std::max(clampTo<float>(stack.last().value), (float)0.0); 215 m_result = std::max(clampTo<float>(stack.last().value), (float)0.0);
216 return true; 216 return true;
217 } 217 }
218 return false; 218 return false;
219 } 219 }
220 220
221 } // namespace blink 221 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/SizesAttributeParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698