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

Side by Side Diff: Source/core/dom/ViewportArguments.cpp

Issue 16962002: [css-device-adapt] insertRule tests and ASSERT for device lengths. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « LayoutTests/css3/device-adapt/viewport-insert-rule-before-expected.txt ('k') | no next file » | 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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 switch (int(resultHeight)) { 96 switch (int(resultHeight)) {
97 case ViewportArguments::ValueDeviceWidth: 97 case ViewportArguments::ValueDeviceWidth:
98 resultHeight = deviceSize.width(); 98 resultHeight = deviceSize.width();
99 break; 99 break;
100 case ViewportArguments::ValueDeviceHeight: 100 case ViewportArguments::ValueDeviceHeight:
101 resultHeight = deviceSize.height(); 101 resultHeight = deviceSize.height();
102 break; 102 break;
103 } 103 }
104 104
105 if (type == ViewportArguments::CSSDeviceAdaptation) { 105 if (type == ViewportArguments::CSSDeviceAdaptation) {
106 switch (int(resultMinWidth)) {
107 case ViewportArguments::ValueDeviceWidth:
108 resultMinWidth = deviceSize.width();
109 break;
110 case ViewportArguments::ValueDeviceHeight:
111 resultMinWidth = deviceSize.height();
112 break;
113 }
114 106
115 switch (int(resultMaxWidth)) { 107 // device-width/device-height not supported for @viewport.
116 case ViewportArguments::ValueDeviceWidth: 108 ASSERT(resultMinWidth != ViewportArguments::ValueDeviceWidth);
117 resultMaxWidth = deviceSize.width(); 109 ASSERT(resultMinWidth != ViewportArguments::ValueDeviceHeight);
118 break; 110 ASSERT(resultMaxWidth != ViewportArguments::ValueDeviceWidth);
119 case ViewportArguments::ValueDeviceHeight: 111 ASSERT(resultMaxWidth != ViewportArguments::ValueDeviceHeight);
120 resultMaxWidth = deviceSize.height(); 112 ASSERT(resultMinHeight != ViewportArguments::ValueDeviceWidth);
121 break; 113 ASSERT(resultMinHeight != ViewportArguments::ValueDeviceHeight);
122 } 114 ASSERT(resultMaxHeight != ViewportArguments::ValueDeviceWidth);
123 115 ASSERT(resultMaxHeight != ViewportArguments::ValueDeviceHeight);
124 switch (int(resultMinHeight)) {
125 case ViewportArguments::ValueDeviceWidth:
126 resultMinHeight = deviceSize.width();
127 break;
128 case ViewportArguments::ValueDeviceHeight:
129 resultMinHeight = deviceSize.height();
130 break;
131 }
132
133 switch (int(resultMaxHeight)) {
134 case ViewportArguments::ValueDeviceWidth:
135 resultMaxHeight = deviceSize.width();
136 break;
137 case ViewportArguments::ValueDeviceHeight:
138 resultMaxHeight = deviceSize.height();
139 break;
140 }
141 116
142 if (resultMinWidth != ViewportArguments::ValueAuto || resultMaxWidth != ViewportArguments::ValueAuto) 117 if (resultMinWidth != ViewportArguments::ValueAuto || resultMaxWidth != ViewportArguments::ValueAuto)
143 resultWidth = compareIgnoringAuto(resultMinWidth, compareIgnoringAut o(resultMaxWidth, deviceSize.width(), min), max); 118 resultWidth = compareIgnoringAuto(resultMinWidth, compareIgnoringAut o(resultMaxWidth, deviceSize.width(), min), max);
144 119
145 if (resultMinHeight != ViewportArguments::ValueAuto || resultMaxHeight ! = ViewportArguments::ValueAuto) 120 if (resultMinHeight != ViewportArguments::ValueAuto || resultMaxHeight ! = ViewportArguments::ValueAuto)
146 resultHeight = compareIgnoringAuto(resultMinHeight, compareIgnoringA uto(resultMaxHeight, deviceSize.height(), min), max); 121 resultHeight = compareIgnoringAuto(resultMinHeight, compareIgnoringA uto(resultMaxHeight, deviceSize.height(), min), max);
147 122
148 if (resultMinZoom != ViewportArguments::ValueAuto && resultMaxZoom != Vi ewportArguments::ValueAuto) 123 if (resultMinZoom != ViewportArguments::ValueAuto && resultMaxZoom != Vi ewportArguments::ValueAuto)
149 resultMaxZoom = max(resultMinZoom, resultMaxZoom); 124 resultMaxZoom = max(resultMinZoom, resultMaxZoom);
150 125
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 message.replace("%replacement2", replacement2); 398 message.replace("%replacement2", replacement2);
424 399
425 if ((errorCode == UnrecognizedViewportArgumentValueError || errorCode == Tru ncatedViewportArgumentValueError) && replacement1.find(';') != WTF::notFound) 400 if ((errorCode == UnrecognizedViewportArgumentValueError || errorCode == Tru ncatedViewportArgumentValueError) && replacement1.find(';') != WTF::notFound)
426 message.append(" Note that ';' is not a separator in viewport values. Th e list should be comma-separated."); 401 message.append(" Note that ';' is not a separator in viewport values. Th e list should be comma-separated.");
427 402
428 // FIXME: This message should be moved off the console once a solution to ht tps://bugs.webkit.org/show_bug.cgi?id=103274 exists. 403 // FIXME: This message should be moved off the console once a solution to ht tps://bugs.webkit.org/show_bug.cgi?id=103274 exists.
429 document->addConsoleMessage(RenderingMessageSource, viewportErrorMessageLeve l(errorCode), message); 404 document->addConsoleMessage(RenderingMessageSource, viewportErrorMessageLeve l(errorCode), message);
430 } 405 }
431 406
432 } // namespace WebCore 407 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/css3/device-adapt/viewport-insert-rule-before-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698