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

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

Issue 644813005: Floating point MQs should not match. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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/SizesAttributeParser.h" 6 #include "core/css/parser/SizesAttributeParser.h"
7 7
8 #include "core/MediaTypeNames.h" 8 #include "core/MediaTypeNames.h"
9 #include "core/css/MediaQueryEvaluator.h" 9 #include "core/css/MediaQueryEvaluator.h"
10 #include "core/css/parser/MediaQueryTokenizer.h" 10 #include "core/css/parser/MediaQueryTokenizer.h"
(...skipping 17 matching lines...) Expand all
28 return effectiveSize(); 28 return effectiveSize();
29 return effectiveSizeDefaultValue(); 29 return effectiveSizeDefaultValue();
30 } 30 }
31 31
32 bool SizesAttributeParser::calculateLengthInPixels(MediaQueryTokenIterator start Token, MediaQueryTokenIterator endToken, float& result) 32 bool SizesAttributeParser::calculateLengthInPixels(MediaQueryTokenIterator start Token, MediaQueryTokenIterator endToken, float& result)
33 { 33 {
34 if (startToken == endToken) 34 if (startToken == endToken)
35 return false; 35 return false;
36 MediaQueryTokenType type = startToken->type(); 36 MediaQueryTokenType type = startToken->type();
37 if (type == DimensionToken) { 37 if (type == DimensionToken) {
38 double length; 38 float length;
39 if (!CSSPrimitiveValue::isLength(startToken->unitType())) 39 if (!CSSPrimitiveValue::isLength(startToken->unitType()))
40 return false; 40 return false;
41 m_viewportDependant = CSSPrimitiveValue::isViewportPercentageLength(star tToken->unitType()); 41 m_viewportDependant = CSSPrimitiveValue::isViewportPercentageLength(star tToken->unitType());
42 if ((m_mediaValues->computeLength(startToken->numericValue(), startToken ->unitType(), length)) && (length >= 0)) { 42 if ((m_mediaValues->computeLength(startToken->numericValue(), startToken ->unitType(), length)) && (length >= 0)) {
43 result = clampTo<float>(length); 43 result = clampTo<float>(length);
44 return true; 44 return true;
45 } 45 }
46 } else if (type == FunctionToken) { 46 } else if (type == FunctionToken) {
47 SizesCalcParser calcParser(startToken, endToken, m_mediaValues); 47 SizesCalcParser calcParser(startToken, endToken, m_mediaValues);
48 if (!calcParser.isValid()) 48 if (!calcParser.isValid())
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 unsigned SizesAttributeParser::effectiveSizeDefaultValue() 147 unsigned SizesAttributeParser::effectiveSizeDefaultValue()
148 { 148 {
149 // Returning the equivalent of "100vw" 149 // Returning the equivalent of "100vw"
150 m_viewportDependant = true; 150 m_viewportDependant = true;
151 return m_mediaValues->viewportWidth(); 151 return m_mediaValues->viewportWidth();
152 } 152 }
153 153
154 } // namespace 154 } // namespace
155 155
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698