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

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

Issue 82083002: Move viewport unit resolution to style recalc time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rebased.. Created 7 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 341 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
342 342
343 if (primitiveValue->isNumber()) { 343 if (primitiveValue->isNumber()) {
344 result = primitiveValue->getIntValue(); 344 result = primitiveValue->getIntValue();
345 return !strict || !result; 345 return !strict || !result;
346 } 346 }
347 347
348 if (primitiveValue->isLength()) { 348 if (primitiveValue->isLength()) {
349 // Relative (like EM) and root relative (like REM) units are always reso lved against the initial values 349 // Relative (like EM) and root relative (like REM) units are always reso lved against the initial values
350 // for media queries, hence the two initialStyle parameters. 350 // for media queries, hence the two initialStyle parameters.
351 result = primitiveValue->computeLength<int>(CSSToLengthConversionData(in itialStyle, initialStyle, 1.0 /* zoom */, true /* computingFontSize */)); 351 // FIXME: We need to plumb viewport units down to here.
352 result = primitiveValue->computeLength<int>(CSSToLengthConversionData(in itialStyle, initialStyle, 0, 1.0 /* zoom */, true /* computingFontSize */));
352 return true; 353 return true;
353 } 354 }
354 355
355 return false; 356 return false;
356 } 357 }
357 358
358 static bool deviceHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Fr ame* frame, MediaFeaturePrefix op) 359 static bool deviceHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Fr ame* frame, MediaFeaturePrefix op)
359 { 360 {
360 if (value) { 361 if (value) {
361 int length; 362 int length;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 // and let trampoline functions override the prefix if prefix is 687 // and let trampoline functions override the prefix if prefix is
687 // used 688 // used
688 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); 689 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl());
689 if (func) 690 if (func)
690 return func(expr->value(), m_style.get(), m_frame, NoPrefix); 691 return func(expr->value(), m_style.get(), m_frame, NoPrefix);
691 692
692 return false; 693 return false;
693 } 694 }
694 695
695 } // namespace 696 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698