OLD | NEW |
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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 const ComputedStyle& style) const { | 329 const ComputedStyle& style) const { |
330 return menuListInternalPadding(style, 1); | 330 return menuListInternalPadding(style, 1); |
331 } | 331 } |
332 | 332 |
333 int LayoutThemeDefault::popupInternalPaddingBottom( | 333 int LayoutThemeDefault::popupInternalPaddingBottom( |
334 const ComputedStyle& style) const { | 334 const ComputedStyle& style) const { |
335 return menuListInternalPadding(style, 1); | 335 return menuListInternalPadding(style, 1); |
336 } | 336 } |
337 | 337 |
338 int LayoutThemeDefault::menuListArrowWidthInDIP() const { | 338 int LayoutThemeDefault::menuListArrowWidthInDIP() const { |
339 if (m_menuListArrowWidthInDIP > 0) | |
340 return m_menuListArrowWidthInDIP; | |
341 int width = Platform::current() | 339 int width = Platform::current() |
342 ->themeEngine() | 340 ->themeEngine() |
343 ->getSize(WebThemeEngine::PartScrollbarUpArrow) | 341 ->getSize(WebThemeEngine::PartScrollbarUpArrow) |
344 .width; | 342 .width; |
345 const_cast<LayoutThemeDefault*>(this)->m_menuListArrowWidthInDIP = | 343 return width > 0 ? width : 15; |
346 width > 0 ? width : 15; | |
347 return m_menuListArrowWidthInDIP; | |
348 } | 344 } |
349 | 345 |
350 float LayoutThemeDefault::clampedMenuListArrowPaddingSize( | 346 float LayoutThemeDefault::clampedMenuListArrowPaddingSize( |
351 const HostWindow* host, | 347 const HostWindow* host, |
352 const ComputedStyle& style) const { | 348 const ComputedStyle& style) const { |
| 349 if (m_cachedMenuListArrowPaddingSize > 0 && |
| 350 style.effectiveZoom() == m_cachedMenuListArrowZoomLevel) |
| 351 return m_cachedMenuListArrowPaddingSize; |
| 352 m_cachedMenuListArrowZoomLevel = style.effectiveZoom(); |
353 int originalSize = menuListArrowWidthInDIP(); | 353 int originalSize = menuListArrowWidthInDIP(); |
354 int scaledSize = | 354 int scaledSize = |
355 host ? host->windowToViewportScalar(originalSize) : originalSize; | 355 host ? host->windowToViewportScalar(originalSize) : originalSize; |
356 // The result should not be samller than the scrollbar thickness in order to | 356 // The result should not be samller than the scrollbar thickness in order to |
357 // secure space for scrollbar in popup. | 357 // secure space for scrollbar in popup. |
358 float deviceScale = 1.0f * scaledSize / originalSize; | 358 float deviceScale = 1.0f * scaledSize / originalSize; |
359 if (style.effectiveZoom() < deviceScale) | 359 float size; |
360 return scaledSize; | 360 if (m_cachedMenuListArrowZoomLevel < deviceScale) { |
361 // The value should be zoomed though scrollbars aren't scaled by zoom. | 361 size = scaledSize; |
362 // crbug.com/432795. | 362 } else { |
363 return originalSize * style.effectiveZoom(); | 363 // The value should be zoomed though scrollbars aren't scaled by zoom. |
| 364 // crbug.com/432795. |
| 365 size = originalSize * m_cachedMenuListArrowZoomLevel; |
| 366 } |
| 367 m_cachedMenuListArrowPaddingSize = size; |
| 368 return size; |
364 } | 369 } |
365 | 370 |
366 void LayoutThemeDefault::didChangeThemeEngine() { | 371 void LayoutThemeDefault::didChangeThemeEngine() { |
367 m_menuListArrowWidthInDIP = 0; | 372 m_cachedMenuListArrowZoomLevel = 0; |
| 373 m_cachedMenuListArrowPaddingSize = 0; |
368 } | 374 } |
369 | 375 |
370 // static | 376 // static |
371 void LayoutThemeDefault::setDefaultFontSize(int fontSize) { | 377 void LayoutThemeDefault::setDefaultFontSize(int fontSize) { |
372 LayoutThemeFontProvider::setDefaultFontSize(fontSize); | 378 LayoutThemeFontProvider::setDefaultFontSize(fontSize); |
373 } | 379 } |
374 | 380 |
375 int LayoutThemeDefault::menuListInternalPadding(const ComputedStyle& style, | 381 int LayoutThemeDefault::menuListInternalPadding(const ComputedStyle& style, |
376 int padding) const { | 382 int padding) const { |
377 if (style.appearance() == NoControlPart) | 383 if (style.appearance() == NoControlPart) |
(...skipping 10 matching lines...) Expand all Loading... |
388 double LayoutThemeDefault::animationRepeatIntervalForProgressBar() const { | 394 double LayoutThemeDefault::animationRepeatIntervalForProgressBar() const { |
389 return progressAnimationInterval; | 395 return progressAnimationInterval; |
390 } | 396 } |
391 | 397 |
392 double LayoutThemeDefault::animationDurationForProgressBar() const { | 398 double LayoutThemeDefault::animationDurationForProgressBar() const { |
393 return progressAnimationInterval * progressAnimationFrames * | 399 return progressAnimationInterval * progressAnimationFrames * |
394 2; // "2" for back and forth | 400 2; // "2" for back and forth |
395 } | 401 } |
396 | 402 |
397 } // namespace blink | 403 } // namespace blink |
OLD | NEW |