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