Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Google, Inc. | 3 * Copyright (C) 2008, 2009 Google, Inc. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 #import "core/layout/LayoutThemeMac.h" | 22 #import "core/layout/LayoutThemeMac.h" |
| 23 | 23 |
| 24 #import "core/CSSValueKeywords.h" | 24 #import "core/CSSValueKeywords.h" |
| 25 #import "core/HTMLNames.h" | 25 #import "core/HTMLNames.h" |
| 26 #import "core/fileapi/FileList.h" | 26 #import "core/fileapi/FileList.h" |
| 27 #import "core/html/HTMLMeterElement.h" | 27 #import "core/html/HTMLMeterElement.h" |
| 28 #import "core/layout/LayoutMeter.h" | 28 #import "core/layout/LayoutMeter.h" |
| 29 #import "core/layout/LayoutProgress.h" | 29 #import "core/layout/LayoutProgress.h" |
| 30 #import "core/layout/LayoutView.h" | 30 #import "core/layout/LayoutView.h" |
| 31 #import "core/paint/MediaControlsPainter.h" | 31 #import "core/paint/MediaControlsPainter.h" |
| 32 #import "core/style/AuthorStyleInfo.h" | |
| 33 #import "core/style/ShadowList.h" | 32 #import "core/style/ShadowList.h" |
| 34 #import "platform/LayoutTestSupport.h" | 33 #import "platform/LayoutTestSupport.h" |
| 35 #import "platform/PlatformResourceLoader.h" | 34 #import "platform/PlatformResourceLoader.h" |
| 36 #import "platform/graphics/BitmapImage.h" | 35 #import "platform/graphics/BitmapImage.h" |
| 37 #import "platform/mac/ColorMac.h" | 36 #import "platform/mac/ColorMac.h" |
| 38 #import "platform/mac/LocalCurrentGraphicsContext.h" | 37 #import "platform/mac/LocalCurrentGraphicsContext.h" |
| 39 #import "platform/mac/ThemeMac.h" | 38 #import "platform/mac/ThemeMac.h" |
| 40 #import "platform/mac/WebCoreNSCellExtras.h" | 39 #import "platform/mac/WebCoreNSCellExtras.h" |
| 41 #import "platform/text/PlatformLocale.h" | 40 #import "platform/text/PlatformLocale.h" |
| 42 #import "platform/text/StringTruncator.h" | 41 #import "platform/text/StringTruncator.h" |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 } | 430 } |
| 432 | 431 |
| 433 if (needsFallback) | 432 if (needsFallback) |
| 434 color = LayoutTheme::systemColor(cssValueId); | 433 color = LayoutTheme::systemColor(cssValueId); |
| 435 | 434 |
| 436 m_systemColorCache.set(cssValueId, color.rgb()); | 435 m_systemColorCache.set(cssValueId, color.rgb()); |
| 437 | 436 |
| 438 return color; | 437 return color; |
| 439 } | 438 } |
| 440 | 439 |
| 441 bool LayoutThemeMac::isControlStyled(const ComputedStyle& style, const AuthorSty leInfo& authorStyle) const | 440 bool LayoutThemeMac::isControlStyled(const ComputedStyle& style) const |
| 442 { | 441 { |
| 443 if (style.appearance() == TextFieldPart || style.appearance() == TextAreaPar t) | 442 if (style.appearance() == TextFieldPart || style.appearance() == TextAreaPar t) |
| 444 return authorStyle.specifiesBorder() || style.boxShadow(); | 443 return style.hasAuthorBorder() || style.boxShadow(); |
| 445 | 444 |
| 446 // FIXME: This is horrible, but there is not much else that can be done. | 445 // FIXME: This is horrible, but there is not much else that can be done. |
| 447 // Menu lists cannot draw properly when scaled. They can't really draw | 446 // Menu lists cannot draw properly when scaled. They can't really draw |
| 448 // properly when transformed either. We can't detect the transform case at | 447 // properly when transformed either. We can't detect the transform case at |
| 449 // style adjustment time so that will just have to stay broken. We can | 448 // style adjustment time so that will just have to stay broken. We can |
| 450 // however detect that we're zooming. If zooming is in effect we treat it | 449 // however detect that we're zooming. If zooming is in effect we treat it |
| 451 // like the control is styled. | 450 // like the control is styled. |
| 452 if (style.appearance() == MenulistPart && style.effectiveZoom() != 1.0f) | 451 if (style.appearance() == MenulistPart && style.effectiveZoom() != 1.0f) |
| 453 return true; | 452 return true; |
| 454 // FIXME: NSSearchFieldCell doesn't work well when scaled. | 453 // FIXME: NSSearchFieldCell doesn't work well when scaled. |
| 455 if (style.appearance() == SearchFieldPart && style.effectiveZoom() != 1) | 454 if (style.appearance() == SearchFieldPart && style.effectiveZoom() != 1) |
| 456 return true; | 455 return true; |
| 457 | 456 |
| 458 return LayoutTheme::isControlStyled(style, authorStyle); | 457 return LayoutTheme::isControlStyled(style); |
| 459 } | 458 } |
| 460 | 459 |
| 461 void LayoutThemeMac::addVisualOverflow(const LayoutObject& object, IntRect& rect ) | 460 void LayoutThemeMac::addVisualOverflow(const LayoutObject& object, IntRect& rect ) |
| 462 { | 461 { |
| 463 ControlPart part = object.style()->appearance(); | 462 ControlPart part = object.style()->appearance(); |
| 464 | 463 |
| 465 #if USE(NEW_THEME) | 464 #if USE(NEW_THEME) |
| 466 switch (part) { | 465 switch (part) { |
| 467 case CheckboxPart: | 466 case CheckboxPart: |
| 468 case RadioPart: | 467 case RadioPart: |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 778 | 777 |
| 779 // Height is locked to auto. | 778 // Height is locked to auto. |
| 780 style.setHeight(Length(Auto)); | 779 style.setHeight(Length(Auto)); |
| 781 | 780 |
| 782 // White-space is locked to pre. | 781 // White-space is locked to pre. |
| 783 style.setWhiteSpace(PRE); | 782 style.setWhiteSpace(PRE); |
| 784 | 783 |
| 785 // Set the foreground color to black or gray when we have the aqua look. | 784 // Set the foreground color to black or gray when we have the aqua look. |
| 786 // Cast to RGB32 is to work around a compiler bug. | 785 // Cast to RGB32 is to work around a compiler bug. |
| 787 style.setColor(e && !e->isDisabledFormControl() ? static_cast<RGBA32>(Color: :black) : Color::darkGray); | 786 style.setColor(e && !e->isDisabledFormControl() ? static_cast<RGBA32>(Color: :black) : Color::darkGray); |
| 787 // The style is not cachable since it depends on the element type. | |
| 788 style.setUnique(); | |
|
Timothy Loh
2015/07/29 03:37:08
We probably don't need to do this since the MPC is
meade_UTC10
2015/07/30 05:38:17
Removed
| |
| 788 | 789 |
| 789 // Set the button's vertical size. | 790 // Set the button's vertical size. |
| 790 setSizeFromFont(style, menuListButtonSizes()); | 791 setSizeFromFont(style, menuListButtonSizes()); |
| 791 | 792 |
| 792 // Our font is locked to the appropriate system font size for the | 793 // Our font is locked to the appropriate system font size for the |
| 793 // control. To clarify, we first use the CSS-specified font to figure out a | 794 // control. To clarify, we first use the CSS-specified font to figure out a |
| 794 // reasonable control size, but once that control size is determined, we | 795 // reasonable control size, but once that control size is determined, we |
| 795 // throw that font away and use the appropriate system font for the control | 796 // throw that font away and use the appropriate system font for the control |
| 796 // size instead. | 797 // size instead. |
| 797 setFontFromControlSize(style, controlSize); | 798 setFontFromControlSize(style, controlSize); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1174 | 1175 |
| 1175 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const | 1176 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const |
| 1176 { | 1177 { |
| 1177 ControlPart part = style.appearance(); | 1178 ControlPart part = style.appearance(); |
| 1178 if (part == CheckboxPart || part == RadioPart) | 1179 if (part == CheckboxPart || part == RadioPart) |
| 1179 return style.effectiveZoom() != 1; | 1180 return style.effectiveZoom() != 1; |
| 1180 return false; | 1181 return false; |
| 1181 } | 1182 } |
| 1182 | 1183 |
| 1183 } // namespace blink | 1184 } // namespace blink |
| OLD | NEW |