OLD | NEW |
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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 } | 352 } |
353 | 353 |
354 return false; | 354 return false; |
355 } | 355 } |
356 | 356 |
357 static bool deviceHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Fr
ame* frame, MediaFeaturePrefix op) | 357 static bool deviceHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Fr
ame* frame, MediaFeaturePrefix op) |
358 { | 358 { |
359 if (value) { | 359 if (value) { |
360 FloatRect sg = screenRect(frame->page()->mainFrame()->view()); | 360 FloatRect sg = screenRect(frame->page()->mainFrame()->view()); |
361 int length; | 361 int length; |
362 long height = sg.height(); | 362 return computeLength(value, !frame->document()->inQuirksMode(), style, l
ength) && compareValue(static_cast<int>(sg.height()), length, op); |
363 InspectorInstrumentation::applyScreenHeightOverride(frame, &height); | |
364 return computeLength(value, !frame->document()->inQuirksMode(), style, l
ength) && compareValue(static_cast<int>(height), length, op); | |
365 } | 363 } |
366 // ({,min-,max-}device-height) | 364 // ({,min-,max-}device-height) |
367 // assume if we have a device, assume non-zero | 365 // assume if we have a device, assume non-zero |
368 return true; | 366 return true; |
369 } | 367 } |
370 | 368 |
371 static bool deviceWidthMediaFeatureEval(CSSValue* value, RenderStyle* style, Fra
me* frame, MediaFeaturePrefix op) | 369 static bool deviceWidthMediaFeatureEval(CSSValue* value, RenderStyle* style, Fra
me* frame, MediaFeaturePrefix op) |
372 { | 370 { |
373 if (value) { | 371 if (value) { |
374 FloatRect sg = screenRect(frame->page()->mainFrame()->view()); | 372 FloatRect sg = screenRect(frame->page()->mainFrame()->view()); |
375 int length; | 373 int length; |
376 long width = sg.width(); | 374 return computeLength(value, !frame->document()->inQuirksMode(), style, l
ength) && compareValue(static_cast<int>(sg.width()), length, op); |
377 InspectorInstrumentation::applyScreenWidthOverride(frame, &width); | |
378 return computeLength(value, !frame->document()->inQuirksMode(), style, l
ength) && compareValue(static_cast<int>(width), length, op); | |
379 } | 375 } |
380 // ({,min-,max-}device-width) | 376 // ({,min-,max-}device-width) |
381 // assume if we have a device, assume non-zero | 377 // assume if we have a device, assume non-zero |
382 return true; | 378 return true; |
383 } | 379 } |
384 | 380 |
385 static bool heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* f
rame, MediaFeaturePrefix op) | 381 static bool heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* f
rame, MediaFeaturePrefix op) |
386 { | 382 { |
387 FrameView* view = frame->view(); | 383 FrameView* view = frame->view(); |
388 | 384 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 // and let trampoline functions override the prefix if prefix is | 677 // and let trampoline functions override the prefix if prefix is |
682 // used | 678 // used |
683 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); | 679 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); |
684 if (func) | 680 if (func) |
685 return func(expr->value(), m_style.get(), m_frame, NoPrefix); | 681 return func(expr->value(), m_style.get(), m_frame, NoPrefix); |
686 | 682 |
687 return false; | 683 return false; |
688 } | 684 } |
689 | 685 |
690 } // namespace | 686 } // namespace |
OLD | NEW |