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 "config.h" | 5 #include "config.h" |
6 #include "core/css/parser/SizesAttributeParser.h" | 6 #include "core/css/parser/SizesAttributeParser.h" |
7 | 7 |
8 #include "core/MediaTypeNames.h" | 8 #include "core/MediaTypeNames.h" |
9 #include "core/css/MediaValuesCached.h" | 9 #include "core/css/MediaValuesCached.h" |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 {" /**/ 300px", 300}, | 39 {" /**/ 300px", 300}, |
40 {"300px /**/ ", 300}, | 40 {"300px /**/ ", 300}, |
41 {" /**/ (min-width:500px) /**/ 300px", 300}, | 41 {" /**/ (min-width:500px) /**/ 300px", 300}, |
42 {"-100px, 200px", 200}, | 42 {"-100px, 200px", 200}, |
43 {"-50vw, 20vw", 100}, | 43 {"-50vw, 20vw", 100}, |
44 {"50asdf, 200px", 200}, | 44 {"50asdf, 200px", 200}, |
45 {"asdf, 200px", 200}, | 45 {"asdf, 200px", 200}, |
46 {"(max-width: 3000px) 200w, 400w", 500}, | 46 {"(max-width: 3000px) 200w, 400w", 500}, |
47 {",, , /**/ ,200px", 200}, | 47 {",, , /**/ ,200px", 200}, |
48 {"50vw", 250}, | 48 {"50vw", 250}, |
| 49 {"5em", 80}, |
| 50 {"5rem", 80}, |
49 {"calc(40vw*2)", 400}, | 51 {"calc(40vw*2)", 400}, |
50 {"(min-width:5000px) calc(5000px/10), (min-width:500px) calc(1200px/3)",
400}, | 52 {"(min-width:5000px) calc(5000px/10), (min-width:500px) calc(1200px/3)",
400}, |
51 {"(min-width:500px) calc(1200/3)", 500}, | 53 {"(min-width:500px) calc(1200/3)", 500}, |
52 {"(min-width:500px) calc(1200px/(0px*14))", 500}, | 54 {"(min-width:500px) calc(1200px/(0px*14))", 500}, |
53 {"(max-width: 3000px) 200px, 400px", 200}, | 55 {"(max-width: 3000px) 200px, 400px", 200}, |
54 {"(max-width: 3000px) 20em, 40em", 320}, | 56 {"(max-width: 3000px) 20em, 40em", 320}, |
55 {"(max-width: 3000px) 0, 40em", 0}, | 57 {"(max-width: 3000px) 0, 40em", 0}, |
56 {"(max-width: 3000px) 50vw, 40em", 250}, | 58 {"(max-width: 3000px) 50vw, 40em", 250}, |
57 {0, 0} // Do not remove the terminator line. | 59 {0, 0} // Do not remove the terminator line. |
58 }; | 60 }; |
(...skipping 13 matching lines...) Expand all Loading... |
72 data.strictMode = true; | 74 data.strictMode = true; |
73 RefPtr<MediaValues> mediaValues = MediaValuesCached::create(data); | 75 RefPtr<MediaValues> mediaValues = MediaValuesCached::create(data); |
74 | 76 |
75 for (unsigned i = 0; testCases[i].input; ++i) { | 77 for (unsigned i = 0; testCases[i].input; ++i) { |
76 int effectiveSize = SizesAttributeParser::findEffectiveSize(testCases[i]
.input, mediaValues); | 78 int effectiveSize = SizesAttributeParser::findEffectiveSize(testCases[i]
.input, mediaValues); |
77 ASSERT_EQ(testCases[i].output, effectiveSize); | 79 ASSERT_EQ(testCases[i].output, effectiveSize); |
78 } | 80 } |
79 } | 81 } |
80 | 82 |
81 } // namespace | 83 } // namespace |
OLD | NEW |