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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutThemeDefault.cpp

Issue 1690493002: Switch to LayoutThemeMobile when emulating mobile device in DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more mac compile Created 4 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. 2 * Copyright (C) 2007 Apple Inc.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2008 Collabora Ltd. 4 * Copyright (C) 2008 Collabora Ltd.
5 * Copyright (C) 2008, 2009 Google Inc. 5 * Copyright (C) 2008, 2009 Google Inc.
6 * Copyright (C) 2009 Kenneth Rohde Christiansen 6 * Copyright (C) 2009 Kenneth Rohde Christiansen
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 unsigned activeForegroundColor, 211 unsigned activeForegroundColor,
212 unsigned inactiveBackgroundColor, 212 unsigned inactiveBackgroundColor,
213 unsigned inactiveForegroundColor) 213 unsigned inactiveForegroundColor)
214 { 214 {
215 m_activeSelectionBackgroundColor = activeBackgroundColor; 215 m_activeSelectionBackgroundColor = activeBackgroundColor;
216 m_activeSelectionForegroundColor = activeForegroundColor; 216 m_activeSelectionForegroundColor = activeForegroundColor;
217 m_inactiveSelectionBackgroundColor = inactiveBackgroundColor; 217 m_inactiveSelectionBackgroundColor = inactiveBackgroundColor;
218 m_inactiveSelectionForegroundColor = inactiveForegroundColor; 218 m_inactiveSelectionForegroundColor = inactiveForegroundColor;
219 } 219 }
220 220
221 #if !USE(NEW_THEME)
221 void LayoutThemeDefault::setCheckboxSize(ComputedStyle& style) const 222 void LayoutThemeDefault::setCheckboxSize(ComputedStyle& style) const
222 { 223 {
223 // If the width and height are both specified, then we have nothing to do. 224 // If the width and height are both specified, then we have nothing to do.
224 if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto()) 225 if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto())
225 return; 226 return;
226 227
227 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P artCheckbox); 228 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P artCheckbox);
228 float zoomLevel = style.effectiveZoom(); 229 float zoomLevel = style.effectiveZoom();
229 size.setWidth(size.width() * zoomLevel); 230 size.setWidth(size.width() * zoomLevel);
230 size.setHeight(size.height() * zoomLevel); 231 size.setHeight(size.height() * zoomLevel);
231 setSizeIfAuto(style, size); 232 setSizeIfAuto(style, size);
232 } 233 }
234 #endif // !USE(NEW_THEME)
233 235
236 #if !USE(NEW_THEME)
234 void LayoutThemeDefault::setRadioSize(ComputedStyle& style) const 237 void LayoutThemeDefault::setRadioSize(ComputedStyle& style) const
235 { 238 {
236 // If the width and height are both specified, then we have nothing to do. 239 // If the width and height are both specified, then we have nothing to do.
237 if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto()) 240 if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto())
238 return; 241 return;
239 242
240 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P artRadio); 243 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P artRadio);
241 float zoomLevel = style.effectiveZoom(); 244 float zoomLevel = style.effectiveZoom();
242 size.setWidth(size.width() * zoomLevel); 245 size.setWidth(size.width() * zoomLevel);
243 size.setHeight(size.height() * zoomLevel); 246 size.setHeight(size.height() * zoomLevel);
244 setSizeIfAuto(style, size); 247 setSizeIfAuto(style, size);
245 } 248 }
249 #endif // !USE(NEW_THEME)
246 250
251 #if !USE(NEW_THEME)
247 void LayoutThemeDefault::adjustInnerSpinButtonStyle(ComputedStyle& style) const 252 void LayoutThemeDefault::adjustInnerSpinButtonStyle(ComputedStyle& style) const
248 { 253 {
249 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P artInnerSpinButton); 254 IntSize size = Platform::current()->themeEngine()->getSize(WebThemeEngine::P artInnerSpinButton);
250 255
251 style.setWidth(Length(size.width(), Fixed)); 256 style.setWidth(Length(size.width(), Fixed));
252 style.setMinWidth(Length(size.width(), Fixed)); 257 style.setMinWidth(Length(size.width(), Fixed));
253 } 258 }
259 #endif // !USE(NEW_THEME)
254 260
255 bool LayoutThemeDefault::shouldOpenPickerWithF4Key() const 261 bool LayoutThemeDefault::shouldOpenPickerWithF4Key() const
256 { 262 {
257 return true; 263 return true;
258 } 264 }
259 265
260 bool LayoutThemeDefault::shouldUseFallbackTheme(const ComputedStyle& style) cons t 266 bool LayoutThemeDefault::shouldUseFallbackTheme(const ComputedStyle& style) cons t
261 { 267 {
262 if (useMockTheme()) { 268 if (useMockTheme()) {
263 // The mock theme can't handle zoomed controls, so we fall back to the " fallback" theme. 269 // The mock theme can't handle zoomed controls, so we fall back to the " fallback" theme.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 IntRect center(const IntRect& original, int width, int height) 310 IntRect center(const IntRect& original, int width, int height)
305 { 311 {
306 width = std::min(original.width(), width); 312 width = std::min(original.width(), width);
307 height = std::min(original.height(), height); 313 height = std::min(original.height(), height);
308 int x = original.x() + (original.width() - width) / 2; 314 int x = original.x() + (original.width() - width) / 2;
309 int y = original.y() + (original.height() - height) / 2; 315 int y = original.y() + (original.height() - height) / 2;
310 316
311 return IntRect(x, y, width, height); 317 return IntRect(x, y, width, height);
312 } 318 }
313 319
320 #if !USE(NEW_THEME)
314 void LayoutThemeDefault::adjustButtonStyle(ComputedStyle& style) const 321 void LayoutThemeDefault::adjustButtonStyle(ComputedStyle& style) const
315 { 322 {
316 if (style.appearance() == PushButtonPart) { 323 if (style.appearance() == PushButtonPart) {
317 // Ignore line-height. 324 // Ignore line-height.
318 style.setLineHeight(ComputedStyle::initialLineHeight()); 325 style.setLineHeight(ComputedStyle::initialLineHeight());
319 } 326 }
320 } 327 }
328 #endif // !USE(NEW_THEME)
321 329
322 void LayoutThemeDefault::adjustSearchFieldStyle(ComputedStyle& style) const 330 void LayoutThemeDefault::adjustSearchFieldStyle(ComputedStyle& style) const
323 { 331 {
324 // Ignore line-height. 332 // Ignore line-height.
325 style.setLineHeight(ComputedStyle::initialLineHeight()); 333 style.setLineHeight(ComputedStyle::initialLineHeight());
326 } 334 }
327 335
328 void LayoutThemeDefault::adjustSearchFieldCancelButtonStyle(ComputedStyle& style ) const 336 void LayoutThemeDefault::adjustSearchFieldCancelButtonStyle(ComputedStyle& style ) const
329 { 337 {
330 // Scale the button size based on the font size 338 // Scale the button size based on the font size
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 { 424 {
417 return progressAnimationInterval; 425 return progressAnimationInterval;
418 } 426 }
419 427
420 double LayoutThemeDefault::animationDurationForProgressBar() const 428 double LayoutThemeDefault::animationDurationForProgressBar() const
421 { 429 {
422 return progressAnimationInterval * progressAnimationFrames * 2; // "2" for b ack and forth 430 return progressAnimationInterval * progressAnimationFrames * 2; // "2" for b ack and forth
423 } 431 }
424 432
425 } // namespace blink 433 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698