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

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

Issue 23187005: [DevTools] Use device metrics emulation implemented in content. (Closed) Base URL: svn://svn.chromium.org/blink/trunk/
Patch Set: Reupload Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/inspector/InspectorClient.h » ('j') | Source/core/page/FrameView.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « no previous file | Source/core/inspector/InspectorClient.h » ('j') | Source/core/page/FrameView.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698