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

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

Issue 2836613002: Better overflow handling for aspect-ratio MQ. (Closed)
Patch Set: Created 3 years, 8 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/core/css/MediaQueryEvaluatorTest.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 /* 1 /*
2 * CSS Media Query 2 * CSS Media Query
3 * 3 *
4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 * Copyright (C) 2013 Apple Inc. All rights reserved. 6 * Copyright (C) 2013 Apple Inc. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 if (delimiter.GetType() != kDelimiterToken || delimiter.Delimiter() != '/') 277 if (delimiter.GetType() != kDelimiterToken || delimiter.Delimiter() != '/')
278 return nullptr; 278 return nullptr;
279 if (numerator.GetType() != kNumberToken || numerator.NumericValue() <= 0 || 279 if (numerator.GetType() != kNumberToken || numerator.NumericValue() <= 0 ||
280 numerator.GetNumericValueType() != kIntegerValueType) 280 numerator.GetNumericValueType() != kIntegerValueType)
281 return nullptr; 281 return nullptr;
282 if (denominator.GetType() != kNumberToken || 282 if (denominator.GetType() != kNumberToken ||
283 denominator.NumericValue() <= 0 || 283 denominator.NumericValue() <= 0 ||
284 denominator.GetNumericValueType() != kIntegerValueType) 284 denominator.GetNumericValueType() != kIntegerValueType)
285 return nullptr; 285 return nullptr;
286 286
287 exp_value.numerator = (unsigned)numerator.NumericValue(); 287 exp_value.numerator = clampTo<unsigned>(numerator.NumericValue());
288 exp_value.denominator = (unsigned)denominator.NumericValue(); 288 exp_value.denominator = clampTo<unsigned>(denominator.NumericValue());
289 exp_value.is_ratio = true; 289 exp_value.is_ratio = true;
290 } else { 290 } else {
291 return nullptr; 291 return nullptr;
292 } 292 }
293 293
294 return new MediaQueryExp(lower_media_feature, exp_value); 294 return new MediaQueryExp(lower_media_feature, exp_value);
295 } 295 }
296 296
297 MediaQueryExp::~MediaQueryExp() {} 297 MediaQueryExp::~MediaQueryExp() {}
298 298
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 output.Append('/'); 330 output.Append('/');
331 output.Append(PrintNumber(denominator)); 331 output.Append(PrintNumber(denominator));
332 } else if (is_id) { 332 } else if (is_id) {
333 output.Append(getValueName(id)); 333 output.Append(getValueName(id));
334 } 334 }
335 335
336 return output.ToString(); 336 return output.ToString();
337 } 337 }
338 338
339 } // namespace blink 339 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698