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

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

Issue 269053005: Remove CSS media features -webkit-transform-2d, -webkit-animation and -webkit-view-mode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update tests Created 6 years, 7 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 | « Source/core/css/MediaFeatureNames.in ('k') | Source/core/css/MediaQueryExp.cpp » ('j') | no next file with comments »
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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 static bool minResolutionMediaFeatureEval(const MediaQueryExpValue& value, Media FeaturePrefix, const MediaValues& mediaValues) 496 static bool minResolutionMediaFeatureEval(const MediaQueryExpValue& value, Media FeaturePrefix, const MediaValues& mediaValues)
497 { 497 {
498 return resolutionMediaFeatureEval(value, MinPrefix, mediaValues); 498 return resolutionMediaFeatureEval(value, MinPrefix, mediaValues);
499 } 499 }
500 500
501 static bool maxResolutionMediaFeatureEval(const MediaQueryExpValue& value, Media FeaturePrefix, const MediaValues& mediaValues) 501 static bool maxResolutionMediaFeatureEval(const MediaQueryExpValue& value, Media FeaturePrefix, const MediaValues& mediaValues)
502 { 502 {
503 return resolutionMediaFeatureEval(value, MaxPrefix, mediaValues); 503 return resolutionMediaFeatureEval(value, MaxPrefix, mediaValues);
504 } 504 }
505 505
506 static bool animationMediaFeatureEval(const MediaQueryExpValue& value, MediaFeat urePrefix op, const MediaValues& mediaValues)
507 {
508 UseCounter::count(mediaValues.document(), UseCounter::PrefixedAnimationMedia Feature);
509
510 if (value.isValid()) {
511 float number;
512 return numberValue(value, number) && compareValue(1, static_cast<int>(nu mber), op);
513 }
514 return true;
515 }
516
517 static bool transform2dMediaFeatureEval(const MediaQueryExpValue& value, MediaFe aturePrefix op, const MediaValues& mediaValues)
518 {
519 UseCounter::count(mediaValues.document(), UseCounter::PrefixedTransform2dMed iaFeature);
520
521 if (value.isValid()) {
522 float number;
523 return numberValue(value, number) && compareValue(1, static_cast<int>(nu mber), op);
524 }
525 return true;
526 }
527
528 static bool transform3dMediaFeatureEval(const MediaQueryExpValue& value, MediaFe aturePrefix op, const MediaValues& mediaValues) 506 static bool transform3dMediaFeatureEval(const MediaQueryExpValue& value, MediaFe aturePrefix op, const MediaValues& mediaValues)
529 { 507 {
530 UseCounter::count(mediaValues.document(), UseCounter::PrefixedTransform3dMed iaFeature); 508 UseCounter::count(mediaValues.document(), UseCounter::PrefixedTransform3dMed iaFeature);
531 509
532 bool returnValueIfNoParameter; 510 bool returnValueIfNoParameter;
533 int have3dRendering; 511 int have3dRendering;
534 512
535 bool threeDEnabled = mediaValues.threeDEnabled(); 513 bool threeDEnabled = mediaValues.threeDEnabled();
536 514
537 returnValueIfNoParameter = threeDEnabled; 515 returnValueIfNoParameter = threeDEnabled;
538 have3dRendering = threeDEnabled ? 1 : 0; 516 have3dRendering = threeDEnabled ? 1 : 0;
539 517
540 if (value.isValid()) { 518 if (value.isValid()) {
541 float number; 519 float number;
542 return numberValue(value, number) && compareValue(have3dRendering, stati c_cast<int>(number), op); 520 return numberValue(value, number) && compareValue(have3dRendering, stati c_cast<int>(number), op);
543 } 521 }
544 return returnValueIfNoParameter; 522 return returnValueIfNoParameter;
545 } 523 }
546 524
547 static bool viewModeMediaFeatureEval(const MediaQueryExpValue& value, MediaFeatu rePrefix, const MediaValues& mediaValues)
548 {
549 UseCounter::count(mediaValues.document(), UseCounter::PrefixedViewModeMediaF eature);
550
551 if (!value.isValid())
552 return true;
553
554 ASSERT(value.isID);
555
556 return value.id == CSSValueWindowed;
557 }
558
559 static bool hoverMediaFeatureEval(const MediaQueryExpValue& value, MediaFeatureP refix, const MediaValues& mediaValues) 525 static bool hoverMediaFeatureEval(const MediaQueryExpValue& value, MediaFeatureP refix, const MediaValues& mediaValues)
560 { 526 {
561 MediaValues::PointerDeviceType pointer = mediaValues.pointer(); 527 MediaValues::PointerDeviceType pointer = mediaValues.pointer();
562 528
563 // If we're on a port that hasn't explicitly opted into providing pointer de vice information 529 // If we're on a port that hasn't explicitly opted into providing pointer de vice information
564 // (or otherwise can't be confident in the pointer hardware available), then behave exactly 530 // (or otherwise can't be confident in the pointer hardware available), then behave exactly
565 // as if this feature feature isn't supported. 531 // as if this feature feature isn't supported.
566 if (pointer == MediaValues::UnknownPointer) 532 if (pointer == MediaValues::UnknownPointer)
567 return false; 533 return false;
568 534
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 // Call the media feature evaluation function. Assume no prefix and let 602 // Call the media feature evaluation function. Assume no prefix and let
637 // trampoline functions override the prefix if prefix is used. 603 // trampoline functions override the prefix if prefix is used.
638 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); 604 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl());
639 if (func) 605 if (func)
640 return func(expr->expValue(), NoPrefix, *m_mediaValues); 606 return func(expr->expValue(), NoPrefix, *m_mediaValues);
641 607
642 return false; 608 return false;
643 } 609 }
644 610
645 } // namespace 611 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/MediaFeatureNames.in ('k') | Source/core/css/MediaQueryExp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698