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

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

Issue 2824753005: Rename HostWindow to PlatformChromeClient (Closed)
Patch Set: mac Created 3 years, 8 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 10 matching lines...) Expand all
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 * 22 *
23 */ 23 */
24 24
25 #include "core/layout/LayoutThemeDefault.h" 25 #include "core/layout/LayoutThemeDefault.h"
26 26
27 #include "core/CSSValueKeywords.h" 27 #include "core/CSSValueKeywords.h"
28 #include "core/layout/LayoutThemeFontProvider.h" 28 #include "core/layout/LayoutThemeFontProvider.h"
29 #include "core/paint/MediaControlsPainter.h" 29 #include "core/paint/MediaControlsPainter.h"
30 #include "core/style/ComputedStyle.h" 30 #include "core/style/ComputedStyle.h"
31 #include "platform/HostWindow.h"
32 #include "platform/LayoutTestSupport.h" 31 #include "platform/LayoutTestSupport.h"
32 #include "platform/PlatformChromeClient.h"
33 #include "platform/PlatformResourceLoader.h" 33 #include "platform/PlatformResourceLoader.h"
34 #include "platform/graphics/Color.h" 34 #include "platform/graphics/Color.h"
35 #include "platform/wtf/text/StringBuilder.h" 35 #include "platform/wtf/text/StringBuilder.h"
36 #include "public/platform/Platform.h" 36 #include "public/platform/Platform.h"
37 #include "public/platform/WebThemeEngine.h" 37 #include "public/platform/WebThemeEngine.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 // These values all match Safari/Win. 41 // These values all match Safari/Win.
42 static const float kDefaultControlFontPixelSize = 13; 42 static const float kDefaultControlFontPixelSize = 13;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 // The following internal paddings are in addition to the user-supplied padding. 312 // The following internal paddings are in addition to the user-supplied padding.
313 // Matches the Firefox behavior. 313 // Matches the Firefox behavior.
314 314
315 int LayoutThemeDefault::PopupInternalPaddingStart( 315 int LayoutThemeDefault::PopupInternalPaddingStart(
316 const ComputedStyle& style) const { 316 const ComputedStyle& style) const {
317 return MenuListInternalPadding(style, 4); 317 return MenuListInternalPadding(style, 4);
318 } 318 }
319 319
320 int LayoutThemeDefault::PopupInternalPaddingEnd( 320 int LayoutThemeDefault::PopupInternalPaddingEnd(
321 const HostWindow* host, 321 const PlatformChromeClient* client,
322 const ComputedStyle& style) const { 322 const ComputedStyle& style) const {
323 if (style.Appearance() == kNoControlPart) 323 if (style.Appearance() == kNoControlPart)
324 return 0; 324 return 0;
325 return 1 * style.EffectiveZoom() + 325 return 1 * style.EffectiveZoom() +
326 ClampedMenuListArrowPaddingSize(host, style); 326 ClampedMenuListArrowPaddingSize(client, style);
327 } 327 }
328 328
329 int LayoutThemeDefault::PopupInternalPaddingTop( 329 int LayoutThemeDefault::PopupInternalPaddingTop(
330 const ComputedStyle& style) const { 330 const ComputedStyle& style) const {
331 return MenuListInternalPadding(style, 1); 331 return MenuListInternalPadding(style, 1);
332 } 332 }
333 333
334 int LayoutThemeDefault::PopupInternalPaddingBottom( 334 int LayoutThemeDefault::PopupInternalPaddingBottom(
335 const ComputedStyle& style) const { 335 const ComputedStyle& style) const {
336 return MenuListInternalPadding(style, 1); 336 return MenuListInternalPadding(style, 1);
337 } 337 }
338 338
339 int LayoutThemeDefault::MenuListArrowWidthInDIP() const { 339 int LayoutThemeDefault::MenuListArrowWidthInDIP() const {
340 int width = Platform::Current() 340 int width = Platform::Current()
341 ->ThemeEngine() 341 ->ThemeEngine()
342 ->GetSize(WebThemeEngine::kPartScrollbarUpArrow) 342 ->GetSize(WebThemeEngine::kPartScrollbarUpArrow)
343 .width; 343 .width;
344 return width > 0 ? width : 15; 344 return width > 0 ? width : 15;
345 } 345 }
346 346
347 float LayoutThemeDefault::ClampedMenuListArrowPaddingSize( 347 float LayoutThemeDefault::ClampedMenuListArrowPaddingSize(
348 const HostWindow* host, 348 const PlatformChromeClient* client,
349 const ComputedStyle& style) const { 349 const ComputedStyle& style) const {
350 if (cached_menu_list_arrow_padding_size_ > 0 && 350 if (cached_menu_list_arrow_padding_size_ > 0 &&
351 style.EffectiveZoom() == cached_menu_list_arrow_zoom_level_) 351 style.EffectiveZoom() == cached_menu_list_arrow_zoom_level_)
352 return cached_menu_list_arrow_padding_size_; 352 return cached_menu_list_arrow_padding_size_;
353 cached_menu_list_arrow_zoom_level_ = style.EffectiveZoom(); 353 cached_menu_list_arrow_zoom_level_ = style.EffectiveZoom();
354 int original_size = MenuListArrowWidthInDIP(); 354 int original_size = MenuListArrowWidthInDIP();
355 int scaled_size = 355 int scaled_size =
356 host ? host->WindowToViewportScalar(original_size) : original_size; 356 client ? client->WindowToViewportScalar(original_size) : original_size;
357 // The result should not be samller than the scrollbar thickness in order to 357 // The result should not be samller than the scrollbar thickness in order to
358 // secure space for scrollbar in popup. 358 // secure space for scrollbar in popup.
359 float device_scale = 1.0f * scaled_size / original_size; 359 float device_scale = 1.0f * scaled_size / original_size;
360 float size; 360 float size;
361 if (cached_menu_list_arrow_zoom_level_ < device_scale) { 361 if (cached_menu_list_arrow_zoom_level_ < device_scale) {
362 size = scaled_size; 362 size = scaled_size;
363 } else { 363 } else {
364 // The value should be zoomed though scrollbars aren't scaled by zoom. 364 // The value should be zoomed though scrollbars aren't scaled by zoom.
365 // crbug.com/432795. 365 // crbug.com/432795.
366 size = original_size * cached_menu_list_arrow_zoom_level_; 366 size = original_size * cached_menu_list_arrow_zoom_level_;
(...skipping 28 matching lines...) Expand all
395 double LayoutThemeDefault::AnimationRepeatIntervalForProgressBar() const { 395 double LayoutThemeDefault::AnimationRepeatIntervalForProgressBar() const {
396 return kProgressAnimationInterval; 396 return kProgressAnimationInterval;
397 } 397 }
398 398
399 double LayoutThemeDefault::AnimationDurationForProgressBar() const { 399 double LayoutThemeDefault::AnimationDurationForProgressBar() const {
400 return kProgressAnimationInterval * kProgressAnimationFrames * 400 return kProgressAnimationInterval * kProgressAnimationFrames *
401 2; // "2" for back and forth 401 2; // "2" for back and forth
402 } 402 }
403 403
404 } // namespace blink 404 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutThemeDefault.h ('k') | third_party/WebKit/Source/core/layout/LayoutThemeMac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698