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; |
339 int width = Platform::current() | 341 int width = Platform::current() |
340 ->themeEngine() | 342 ->themeEngine() |
341 ->getSize(WebThemeEngine::PartScrollbarUpArrow) | 343 ->getSize(WebThemeEngine::PartScrollbarUpArrow) |
342 .width; | 344 .width; |
343 return width > 0 ? width : 15; | 345 const_cast<LayoutThemeDefault*>(this)->m_menuListArrowWidthInDIP = |
| 346 width > 0 ? width : 15; |
| 347 return m_menuListArrowWidthInDIP; |
344 } | 348 } |
345 | 349 |
346 float LayoutThemeDefault::clampedMenuListArrowPaddingSize( | 350 float LayoutThemeDefault::clampedMenuListArrowPaddingSize( |
347 const HostWindow* host, | 351 const HostWindow* host, |
348 const ComputedStyle& style) const { | 352 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 float size; | 359 if (style.effectiveZoom() < deviceScale) |
360 if (m_cachedMenuListArrowZoomLevel < deviceScale) { | 360 return scaledSize; |
361 size = scaledSize; | 361 // The value should be zoomed though scrollbars aren't scaled by zoom. |
362 } else { | 362 // crbug.com/432795. |
363 // The value should be zoomed though scrollbars aren't scaled by zoom. | 363 return originalSize * style.effectiveZoom(); |
364 // crbug.com/432795. | |
365 size = originalSize * m_cachedMenuListArrowZoomLevel; | |
366 } | |
367 m_cachedMenuListArrowPaddingSize = size; | |
368 return size; | |
369 } | 364 } |
370 | 365 |
371 // static | 366 // static |
372 void LayoutThemeDefault::setDefaultFontSize(int fontSize) { | 367 void LayoutThemeDefault::setDefaultFontSize(int fontSize) { |
373 LayoutThemeFontProvider::setDefaultFontSize(fontSize); | 368 LayoutThemeFontProvider::setDefaultFontSize(fontSize); |
374 } | 369 } |
375 | 370 |
376 int LayoutThemeDefault::menuListInternalPadding(const ComputedStyle& style, | 371 int LayoutThemeDefault::menuListInternalPadding(const ComputedStyle& style, |
377 int padding) const { | 372 int padding) const { |
378 if (style.appearance() == NoControlPart) | 373 if (style.appearance() == NoControlPart) |
(...skipping 10 matching lines...) Expand all Loading... |
389 double LayoutThemeDefault::animationRepeatIntervalForProgressBar() const { | 384 double LayoutThemeDefault::animationRepeatIntervalForProgressBar() const { |
390 return progressAnimationInterval; | 385 return progressAnimationInterval; |
391 } | 386 } |
392 | 387 |
393 double LayoutThemeDefault::animationDurationForProgressBar() const { | 388 double LayoutThemeDefault::animationDurationForProgressBar() const { |
394 return progressAnimationInterval * progressAnimationFrames * | 389 return progressAnimationInterval * progressAnimationFrames * |
395 2; // "2" for back and forth | 390 2; // "2" for back and forth |
396 } | 391 } |
397 | 392 |
398 } // namespace blink | 393 } // namespace blink |
OLD | NEW |