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

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

Issue 1496683002: Avoid rounding down viewport dimensions in Media Queries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved to double Created 5 years 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 * CSS Media Query Evaluator 2 * CSS Media Query Evaluator
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) 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2013 Intel Corporation. All rights reserved. 6 * Copyright (C) 2013 Intel Corporation. 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 if (value.isValid()) 386 if (value.isValid())
387 return computeLengthAndCompare(value, op, mediaValues, mediaValues.devic eWidth()); 387 return computeLengthAndCompare(value, op, mediaValues, mediaValues.devic eWidth());
388 388
389 // ({,min-,max-}device-width) 389 // ({,min-,max-}device-width)
390 // assume if we have a device, assume non-zero 390 // assume if we have a device, assume non-zero
391 return true; 391 return true;
392 } 392 }
393 393
394 static bool heightMediaFeatureEval(const MediaQueryExpValue& value, MediaFeature Prefix op, const MediaValues& mediaValues) 394 static bool heightMediaFeatureEval(const MediaQueryExpValue& value, MediaFeature Prefix op, const MediaValues& mediaValues)
395 { 395 {
396 int height = mediaValues.viewportHeight(); 396 double height = mediaValues.viewportHeight();
397 if (value.isValid()) 397 if (value.isValid())
398 return computeLengthAndCompare(value, op, mediaValues, height); 398 return computeLengthAndCompare(value, op, mediaValues, height);
399 399
400 return height; 400 return height;
401 } 401 }
402 402
403 static bool widthMediaFeatureEval(const MediaQueryExpValue& value, MediaFeatureP refix op, const MediaValues& mediaValues) 403 static bool widthMediaFeatureEval(const MediaQueryExpValue& value, MediaFeatureP refix op, const MediaValues& mediaValues)
404 { 404 {
405 int width = mediaValues.viewportWidth(); 405 double width = mediaValues.viewportWidth();
406 if (value.isValid()) 406 if (value.isValid())
407 return computeLengthAndCompare(value, op, mediaValues, width); 407 return computeLengthAndCompare(value, op, mediaValues, width);
408 408
409 return width; 409 return width;
410 } 410 }
411 411
412 // Rest of the functions are trampolines which set the prefix according to the m edia feature expression used. 412 // Rest of the functions are trampolines which set the prefix according to the m edia feature expression used.
413 413
414 static bool minColorMediaFeatureEval(const MediaQueryExpValue& value, MediaFeatu rePrefix, const MediaValues& mediaValues) 414 static bool minColorMediaFeatureEval(const MediaQueryExpValue& value, MediaFeatu rePrefix, const MediaValues& mediaValues)
415 { 415 {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 // Call the media feature evaluation function. Assume no prefix and let 659 // Call the media feature evaluation function. Assume no prefix and let
660 // trampoline functions override the prefix if prefix is used. 660 // trampoline functions override the prefix if prefix is used.
661 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); 661 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl());
662 if (func) 662 if (func)
663 return func(expr->expValue(), NoPrefix, *m_mediaValues); 663 return func(expr->expValue(), NoPrefix, *m_mediaValues);
664 664
665 return false; 665 return false;
666 } 666 }
667 667
668 } // namespace 668 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698