| 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 13 matching lines...) Expand all Loading... |
| 24 #import "core/HTMLNames.h" | 24 #import "core/HTMLNames.h" |
| 25 #import "core/fileapi/FileList.h" | 25 #import "core/fileapi/FileList.h" |
| 26 #import "core/html/HTMLMeterElement.h" | 26 #import "core/html/HTMLMeterElement.h" |
| 27 #import "core/layout/LayoutMeter.h" | 27 #import "core/layout/LayoutMeter.h" |
| 28 #import "core/layout/LayoutProgress.h" | 28 #import "core/layout/LayoutProgress.h" |
| 29 #import "core/layout/LayoutView.h" | 29 #import "core/layout/LayoutView.h" |
| 30 #import "core/paint/MediaControlsPainter.h" | 30 #import "core/paint/MediaControlsPainter.h" |
| 31 #import "core/style/ShadowList.h" | 31 #import "core/style/ShadowList.h" |
| 32 #import "platform/LayoutTestSupport.h" | 32 #import "platform/LayoutTestSupport.h" |
| 33 #import "platform/PlatformResourceLoader.h" | 33 #import "platform/PlatformResourceLoader.h" |
| 34 #import "platform/Theme.h" |
| 34 #import "platform/graphics/BitmapImage.h" | 35 #import "platform/graphics/BitmapImage.h" |
| 35 #import "platform/mac/ColorMac.h" | 36 #import "platform/mac/ColorMac.h" |
| 36 #import "platform/mac/LocalCurrentGraphicsContext.h" | 37 #import "platform/mac/LocalCurrentGraphicsContext.h" |
| 37 #import "platform/mac/ThemeMac.h" | 38 #import "platform/mac/ThemeMac.h" |
| 38 #import "platform/mac/VersionUtilMac.h" | 39 #import "platform/mac/VersionUtilMac.h" |
| 39 #import "platform/mac/WebCoreNSCellExtras.h" | 40 #import "platform/mac/WebCoreNSCellExtras.h" |
| 40 #import "platform/text/PlatformLocale.h" | 41 #import "platform/text/PlatformLocale.h" |
| 41 #import "platform/text/StringTruncator.h" | 42 #import "platform/text/StringTruncator.h" |
| 42 #import <AvailabilityMacros.h> | 43 #import <AvailabilityMacros.h> |
| 43 #import <Carbon/Carbon.h> | 44 #import <Carbon/Carbon.h> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 return nil; | 110 return nil; |
| 110 } | 111 } |
| 111 | 112 |
| 112 @end | 113 @end |
| 113 | 114 |
| 114 namespace blink { | 115 namespace blink { |
| 115 | 116 |
| 116 using namespace HTMLNames; | 117 using namespace HTMLNames; |
| 117 | 118 |
| 118 LayoutThemeMac::LayoutThemeMac() | 119 LayoutThemeMac::LayoutThemeMac() |
| 119 : m_notificationObserver(AdoptNS, [[BlinkLayoutThemeNotificationObserver all
oc] initWithTheme:this]) | 120 : LayoutTheme(platformTheme()) |
| 120 , m_painter(*this) | 121 , m_notificationObserver(AdoptNS, [[BlinkLayoutThemeNotificationObserver all
oc] initWithTheme:this]) |
| 122 , m_painter(*this, platformTheme()) |
| 121 { | 123 { |
| 122 [[NSNotificationCenter defaultCenter] addObserver:m_notificationObserver.get
() | 124 [[NSNotificationCenter defaultCenter] addObserver:m_notificationObserver.get
() |
| 123 selector:@selector(systemColorsDidC
hange:) | 125 selector:@selector(systemColorsDidC
hange:) |
| 124 name:NSSystemColorsDidChangeNot
ification | 126 name:NSSystemColorsDidChangeNot
ification |
| 125 object:nil]; | 127 object:nil]; |
| 126 } | 128 } |
| 127 | 129 |
| 128 LayoutThemeMac::~LayoutThemeMac() | 130 LayoutThemeMac::~LayoutThemeMac() |
| 129 { | 131 { |
| 130 [[NSNotificationCenter defaultCenter] removeObserver:m_notificationObserver.
get()]; | 132 [[NSNotificationCenter defaultCenter] removeObserver:m_notificationObserver.
get()]; |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 break; | 468 break; |
| 467 } | 469 } |
| 468 } | 470 } |
| 469 return LayoutTheme::isControlStyled(style); | 471 return LayoutTheme::isControlStyled(style); |
| 470 } | 472 } |
| 471 | 473 |
| 472 void LayoutThemeMac::addVisualOverflow(const LayoutObject& object, IntRect& rect
) | 474 void LayoutThemeMac::addVisualOverflow(const LayoutObject& object, IntRect& rect
) |
| 473 { | 475 { |
| 474 ControlPart part = object.style()->appearance(); | 476 ControlPart part = object.style()->appearance(); |
| 475 | 477 |
| 476 #if USE(NEW_THEME) | 478 if (hasPlatformTheme()) { |
| 477 switch (part) { | 479 switch (part) { |
| 478 case CheckboxPart: | 480 case CheckboxPart: |
| 479 case RadioPart: | 481 case RadioPart: |
| 480 case PushButtonPart: | 482 case PushButtonPart: |
| 481 case SquareButtonPart: | 483 case SquareButtonPart: |
| 482 case ButtonPart: | 484 case ButtonPart: |
| 483 case InnerSpinButtonPart: | 485 case InnerSpinButtonPart: |
| 484 return LayoutTheme::addVisualOverflow(object, rect); | 486 return LayoutTheme::addVisualOverflow(object, rect); |
| 485 default: | 487 default: |
| 486 break; | 488 break; |
| 489 } |
| 487 } | 490 } |
| 488 #endif | |
| 489 | 491 |
| 490 float zoomLevel = object.style()->effectiveZoom(); | 492 float zoomLevel = object.style()->effectiveZoom(); |
| 491 | 493 |
| 492 if (part == MenulistPart) { | 494 if (part == MenulistPart) { |
| 493 setPopupButtonCellState(object, rect); | 495 setPopupButtonCellState(object, rect); |
| 494 IntSize size = popupButtonSizes()[[popupButton() controlSize]]; | 496 IntSize size = popupButtonSizes()[[popupButton() controlSize]]; |
| 495 size.setHeight(size.height() * zoomLevel); | 497 size.setHeight(size.height() * zoomLevel); |
| 496 size.setWidth(rect.width()); | 498 size.setWidth(rect.width()); |
| 497 rect = ThemeMac::inflateRect(rect, size, popupButtonMargins(), zoomLevel
); | 499 rect = ThemeMac::inflateRect(rect, size, popupButtonMargins(), zoomLevel
); |
| 498 } else if (part == SliderThumbHorizontalPart || part == SliderThumbVerticalP
art) { | 500 } else if (part == SliderThumbHorizontalPart || part == SliderThumbVerticalP
art) { |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 | 1097 |
| 1096 return StringTruncator::centerTruncate(strToTruncate, width, font); | 1098 return StringTruncator::centerTruncate(strToTruncate, width, font); |
| 1097 } | 1099 } |
| 1098 | 1100 |
| 1099 NSView* FlippedView() | 1101 NSView* FlippedView() |
| 1100 { | 1102 { |
| 1101 static NSView* view = [[BlinkFlippedView alloc] init]; | 1103 static NSView* view = [[BlinkFlippedView alloc] init]; |
| 1102 return view; | 1104 return view; |
| 1103 } | 1105 } |
| 1104 | 1106 |
| 1105 LayoutTheme& LayoutTheme::theme() | 1107 LayoutTheme& LayoutTheme::nativeTheme() |
| 1106 { | 1108 { |
| 1107 DEFINE_STATIC_REF(LayoutTheme, layoutTheme, (LayoutThemeMac::create())); | 1109 DEFINE_STATIC_REF(LayoutTheme, layoutTheme, (LayoutThemeMac::create())); |
| 1108 return *layoutTheme; | 1110 return *layoutTheme; |
| 1109 } | 1111 } |
| 1110 | 1112 |
| 1111 PassRefPtr<LayoutTheme> LayoutThemeMac::create() | 1113 PassRefPtr<LayoutTheme> LayoutThemeMac::create() |
| 1112 { | 1114 { |
| 1113 return adoptRef(new LayoutThemeMac); | 1115 return adoptRef(new LayoutThemeMac); |
| 1114 } | 1116 } |
| 1115 | 1117 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 | 1169 |
| 1168 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const | 1170 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const |
| 1169 { | 1171 { |
| 1170 ControlPart part = style.appearance(); | 1172 ControlPart part = style.appearance(); |
| 1171 if (part == CheckboxPart || part == RadioPart) | 1173 if (part == CheckboxPart || part == RadioPart) |
| 1172 return style.effectiveZoom() != 1; | 1174 return style.effectiveZoom() != 1; |
| 1173 return false; | 1175 return false; |
| 1174 } | 1176 } |
| 1175 | 1177 |
| 1176 } // namespace blink | 1178 } // namespace blink |
| OLD | NEW |