| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/css/MediaQueryEvaluator.h" | 5 #include "core/css/MediaQueryEvaluator.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "core/MediaTypeNames.h" | 8 #include "core/MediaTypeNames.h" |
| 9 #include "core/css/MediaList.h" | 9 #include "core/css/MediaList.h" |
| 10 #include "core/css/MediaValuesCached.h" | 10 #include "core/css/MediaValuesCached.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 {"(display-mode: minimal-ui)", 0}, | 59 {"(display-mode: minimal-ui)", 0}, |
| 60 {"(display-mode: browser)", 1}, | 60 {"(display-mode: browser)", 1}, |
| 61 {"(display-mode: min-browser)", 0}, | 61 {"(display-mode: min-browser)", 0}, |
| 62 {"(display-mode: url(browser))", 0}, | 62 {"(display-mode: url(browser))", 0}, |
| 63 {"(display-mode: #browser)", 0}, | 63 {"(display-mode: #browser)", 0}, |
| 64 {"(display-mode: @browser)", 0}, | 64 {"(display-mode: @browser)", 0}, |
| 65 {"(display-mode: 'browser')", 0}, | 65 {"(display-mode: 'browser')", 0}, |
| 66 {"(display-mode: @junk browser)", 0}, | 66 {"(display-mode: @junk browser)", 0}, |
| 67 {"(shape: rect)", 1}, | 67 {"(shape: rect)", 1}, |
| 68 {"(shape: round)", 0}, | 68 {"(shape: round)", 0}, |
| 69 {"(max-device-aspect-ratio: 4294967295/1)", 1}, |
| 70 {"(min-device-aspect-ratio: 1/4294967296)", 1}, |
| 69 {0, 0} // Do not remove the terminator line. | 71 {0, 0} // Do not remove the terminator line. |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 TestCase g_viewport_test_cases[] = { | 74 TestCase g_viewport_test_cases[] = { |
| 73 {"all and (min-width: 500px)", 1}, | 75 {"all and (min-width: 500px)", 1}, |
| 74 {"(min-width: 500px)", 1}, | 76 {"(min-width: 500px)", 1}, |
| 75 {"(min-width: 501px)", 0}, | 77 {"(min-width: 501px)", 0}, |
| 76 {"(max-width: 500px)", 1}, | 78 {"(max-width: 500px)", 1}, |
| 77 {"(max-width: 499px)", 0}, | 79 {"(max-width: 499px)", 0}, |
| 78 {"(width: 500px)", 1}, | 80 {"(width: 500px)", 1}, |
| 79 {"(width: 501px)", 0}, | 81 {"(width: 501px)", 0}, |
| 80 {"(min-height: 500px)", 1}, | 82 {"(min-height: 500px)", 1}, |
| 81 {"(min-height: 501px)", 0}, | 83 {"(min-height: 501px)", 0}, |
| 82 {"(min-height: 500.001px)", 0}, | 84 {"(min-height: 500.001px)", 0}, |
| 83 {"(max-height: 500px)", 1}, | 85 {"(max-height: 500px)", 1}, |
| 84 {"(max-height: 499.999px)", 0}, | 86 {"(max-height: 499.999px)", 0}, |
| 85 {"(max-height: 499px)", 0}, | 87 {"(max-height: 499px)", 0}, |
| 86 {"(height: 500px)", 1}, | 88 {"(height: 500px)", 1}, |
| 87 {"(height: 500.001px)", 0}, | 89 {"(height: 500.001px)", 0}, |
| 88 {"(height: 499.999px)", 0}, | 90 {"(height: 499.999px)", 0}, |
| 89 {"(height: 501px)", 0}, | 91 {"(height: 501px)", 0}, |
| 90 {"(height)", 1}, | 92 {"(height)", 1}, |
| 91 {"(width)", 1}, | 93 {"(width)", 1}, |
| 92 {"(width: whatisthis)", 0}, | 94 {"(width: whatisthis)", 0}, |
| 93 {"screen and (min-width: 400px) and (max-width: 700px)", 1}, | 95 {"screen and (min-width: 400px) and (max-width: 700px)", 1}, |
| 96 {"(max-aspect-ratio: 4294967296/1)", 1}, |
| 97 {"(min-aspect-ratio: 1/4294967295)", 1}, |
| 94 {0, 0} // Do not remove the terminator line. | 98 {0, 0} // Do not remove the terminator line. |
| 95 }; | 99 }; |
| 96 | 100 |
| 97 TestCase g_float_viewport_test_cases[] = { | 101 TestCase g_float_viewport_test_cases[] = { |
| 98 {"all and (min-width: 600.5px)", 1}, | 102 {"all and (min-width: 600.5px)", 1}, |
| 99 {"(min-width: 600px)", 1}, | 103 {"(min-width: 600px)", 1}, |
| 100 {"(min-width: 600.5px)", 1}, | 104 {"(min-width: 600.5px)", 1}, |
| 101 {"(min-width: 601px)", 0}, | 105 {"(min-width: 601px)", 0}, |
| 102 {"(max-width: 600px)", 0}, | 106 {"(max-width: 600px)", 0}, |
| 103 {"(max-width: 600.5px)", 1}, | 107 {"(max-width: 600.5px)", 1}, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 page_holder->GetFrameView().SetInitialViewportSize(IntSize(500, 500)); | 231 page_holder->GetFrameView().SetInitialViewportSize(IntSize(500, 500)); |
| 228 page_holder->GetFrameView().SetLayoutSize(IntSize(800, 800)); | 232 page_holder->GetFrameView().SetLayoutSize(IntSize(800, 800)); |
| 229 page_holder->GetFrameView().SetFrameRect(IntRect(0, 0, 800, 800)); | 233 page_holder->GetFrameView().SetFrameRect(IntRect(0, 0, 800, 800)); |
| 230 | 234 |
| 231 MediaQueryEvaluator media_query_evaluator( | 235 MediaQueryEvaluator media_query_evaluator( |
| 232 MediaValuesInitialViewport::Create(page_holder->GetFrame())); | 236 MediaValuesInitialViewport::Create(page_holder->GetFrame())); |
| 233 TestMQEvaluator(g_viewport_test_cases, media_query_evaluator); | 237 TestMQEvaluator(g_viewport_test_cases, media_query_evaluator); |
| 234 } | 238 } |
| 235 | 239 |
| 236 } // namespace blink | 240 } // namespace blink |
| OLD | NEW |