| 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 22 matching lines...) Expand all Loading... |
| 33 #import "core/html/HTMLMeterElement.h" | 33 #import "core/html/HTMLMeterElement.h" |
| 34 #import "core/html/TimeRanges.h" | 34 #import "core/html/TimeRanges.h" |
| 35 #import "core/html/shadow/MediaControlElements.h" | 35 #import "core/html/shadow/MediaControlElements.h" |
| 36 #import "core/layout/Layer.h" | 36 #import "core/layout/Layer.h" |
| 37 #import "core/layout/LayoutSlider.h" | 37 #import "core/layout/LayoutSlider.h" |
| 38 #import "core/layout/PaintInfo.h" | 38 #import "core/layout/PaintInfo.h" |
| 39 #import "core/layout/style/AuthorStyleInfo.h" | 39 #import "core/layout/style/AuthorStyleInfo.h" |
| 40 #import "core/layout/style/ShadowList.h" | 40 #import "core/layout/style/ShadowList.h" |
| 41 #import "core/layout/LayoutMedia.h" | 41 #import "core/layout/LayoutMedia.h" |
| 42 #import "core/layout/LayoutMediaControls.h" | 42 #import "core/layout/LayoutMediaControls.h" |
| 43 #import "core/layout/LayoutMeter.h" |
| 43 #import "core/layout/LayoutProgress.h" | 44 #import "core/layout/LayoutProgress.h" |
| 44 #import "core/rendering/RenderMeter.h" | |
| 45 #import "core/rendering/RenderView.h" | 45 #import "core/rendering/RenderView.h" |
| 46 #import "platform/LayoutTestSupport.h" | 46 #import "platform/LayoutTestSupport.h" |
| 47 #import "platform/PlatformResourceLoader.h" | 47 #import "platform/PlatformResourceLoader.h" |
| 48 #import "platform/SharedBuffer.h" | 48 #import "platform/SharedBuffer.h" |
| 49 #import "platform/geometry/FloatRoundedRect.h" | 49 #import "platform/geometry/FloatRoundedRect.h" |
| 50 #import "platform/graphics/BitmapImage.h" | 50 #import "platform/graphics/BitmapImage.h" |
| 51 #import "platform/graphics/GraphicsContextStateSaver.h" | 51 #import "platform/graphics/GraphicsContextStateSaver.h" |
| 52 #import "platform/graphics/Image.h" | 52 #import "platform/graphics/Image.h" |
| 53 #import "platform/graphics/ImageBuffer.h" | 53 #import "platform/graphics/ImageBuffer.h" |
| 54 #import "platform/mac/ColorMac.h" | 54 #import "platform/mac/ColorMac.h" |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 [popupButton drawWithFrame:inflatedRect inView:view]; | 848 [popupButton drawWithFrame:inflatedRect inView:view]; |
| 849 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING | 849 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING |
| 850 if (isFocused(o) && o->style()->outlineStyleIsAuto()) | 850 if (isFocused(o) && o->style()->outlineStyleIsAuto()) |
| 851 [popupButton _web_drawFocusRingWithFrame:inflatedRect inView:view]; | 851 [popupButton _web_drawFocusRingWithFrame:inflatedRect inView:view]; |
| 852 #endif | 852 #endif |
| 853 [popupButton setControlView:nil]; | 853 [popupButton setControlView:nil]; |
| 854 | 854 |
| 855 return false; | 855 return false; |
| 856 } | 856 } |
| 857 | 857 |
| 858 IntSize LayoutThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const
IntRect& bounds) const | 858 IntSize LayoutThemeMac::meterSizeForBounds(const LayoutMeter* layoutMeter, const
IntRect& bounds) const |
| 859 { | 859 { |
| 860 if (NoControlPart == renderMeter->style()->appearance()) | 860 if (NoControlPart == layoutMeter->style()->appearance()) |
| 861 return bounds.size(); | 861 return bounds.size(); |
| 862 | 862 |
| 863 NSLevelIndicatorCell* cell = levelIndicatorFor(renderMeter); | 863 NSLevelIndicatorCell* cell = levelIndicatorFor(layoutMeter); |
| 864 // Makes enough room for cell's intrinsic size. | 864 // Makes enough room for cell's intrinsic size. |
| 865 NSSize cellSize = [cell cellSizeForBounds:IntRect(IntPoint(), bounds.size())
]; | 865 NSSize cellSize = [cell cellSizeForBounds:IntRect(IntPoint(), bounds.size())
]; |
| 866 return IntSize(bounds.width() < cellSize.width ? cellSize.width : bounds.wid
th(), | 866 return IntSize(bounds.width() < cellSize.width ? cellSize.width : bounds.wid
th(), |
| 867 bounds.height() < cellSize.height ? cellSize.height : bounds.
height()); | 867 bounds.height() < cellSize.height ? cellSize.height : bounds.
height()); |
| 868 } | 868 } |
| 869 | 869 |
| 870 bool LayoutThemeMac::paintMeter(LayoutObject* layoutObject, const PaintInfo& pai
ntInfo, const IntRect& rect) | 870 bool LayoutThemeMac::paintMeter(LayoutObject* layoutObject, const PaintInfo& pai
ntInfo, const IntRect& rect) |
| 871 { | 871 { |
| 872 if (!layoutObject->isMeter()) | 872 if (!layoutObject->isMeter()) |
| 873 return true; | 873 return true; |
| 874 | 874 |
| 875 LocalCurrentGraphicsContext localContext(paintInfo.context, rect); | 875 LocalCurrentGraphicsContext localContext(paintInfo.context, rect); |
| 876 | 876 |
| 877 NSLevelIndicatorCell* cell = levelIndicatorFor(toRenderMeter(layoutObject)); | 877 NSLevelIndicatorCell* cell = levelIndicatorFor(toLayoutMeter(layoutObject)); |
| 878 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 878 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 879 | 879 |
| 880 [cell drawWithFrame:rect inView:documentViewFor(layoutObject)]; | 880 [cell drawWithFrame:rect inView:documentViewFor(layoutObject)]; |
| 881 [cell setControlView:nil]; | 881 [cell setControlView:nil]; |
| 882 return false; | 882 return false; |
| 883 } | 883 } |
| 884 | 884 |
| 885 bool LayoutThemeMac::supportsMeter(ControlPart part) const | 885 bool LayoutThemeMac::supportsMeter(ControlPart part) const |
| 886 { | 886 { |
| 887 switch (part) { | 887 switch (part) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 905 return NSDiscreteCapacityLevelIndicatorStyle; | 905 return NSDiscreteCapacityLevelIndicatorStyle; |
| 906 case RatingLevelIndicatorPart: | 906 case RatingLevelIndicatorPart: |
| 907 return NSRatingLevelIndicatorStyle; | 907 return NSRatingLevelIndicatorStyle; |
| 908 case MeterPart: | 908 case MeterPart: |
| 909 case ContinuousCapacityLevelIndicatorPart: | 909 case ContinuousCapacityLevelIndicatorPart: |
| 910 default: | 910 default: |
| 911 return NSContinuousCapacityLevelIndicatorStyle; | 911 return NSContinuousCapacityLevelIndicatorStyle; |
| 912 } | 912 } |
| 913 } | 913 } |
| 914 | 914 |
| 915 NSLevelIndicatorCell* LayoutThemeMac::levelIndicatorFor(const RenderMeter* rende
rMeter) const | 915 NSLevelIndicatorCell* LayoutThemeMac::levelIndicatorFor(const LayoutMeter* layou
tMeter) const |
| 916 { | 916 { |
| 917 const LayoutStyle& style = renderMeter->styleRef(); | 917 const LayoutStyle& style = layoutMeter->styleRef(); |
| 918 ASSERT(style.appearance() != NoControlPart); | 918 ASSERT(style.appearance() != NoControlPart); |
| 919 | 919 |
| 920 if (!m_levelIndicator) | 920 if (!m_levelIndicator) |
| 921 m_levelIndicator.adoptNS([[NSLevelIndicatorCell alloc] initWithLevelIndi
catorStyle:NSContinuousCapacityLevelIndicatorStyle]); | 921 m_levelIndicator.adoptNS([[NSLevelIndicatorCell alloc] initWithLevelIndi
catorStyle:NSContinuousCapacityLevelIndicatorStyle]); |
| 922 NSLevelIndicatorCell* cell = m_levelIndicator.get(); | 922 NSLevelIndicatorCell* cell = m_levelIndicator.get(); |
| 923 | 923 |
| 924 HTMLMeterElement* element = renderMeter->meterElement(); | 924 HTMLMeterElement* element = layoutMeter->meterElement(); |
| 925 double value = element->value(); | 925 double value = element->value(); |
| 926 | 926 |
| 927 // Because NSLevelIndicatorCell does not support optimum-in-the-middle type | 927 // Because NSLevelIndicatorCell does not support optimum-in-the-middle type |
| 928 // coloring, we explicitly control the color instead giving low and high | 928 // coloring, we explicitly control the color instead giving low and high |
| 929 // value to NSLevelIndicatorCell as is. | 929 // value to NSLevelIndicatorCell as is. |
| 930 switch (element->gaugeRegion()) { | 930 switch (element->gaugeRegion()) { |
| 931 case HTMLMeterElement::GaugeRegionOptimum: | 931 case HTMLMeterElement::GaugeRegionOptimum: |
| 932 // Make meter the green. | 932 // Make meter the green. |
| 933 [cell setWarningValue:value + 1]; | 933 [cell setWarningValue:value + 1]; |
| 934 [cell setCriticalValue:value + 2]; | 934 [cell setCriticalValue:value + 2]; |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1844 | 1844 |
| 1845 bool LayoutThemeMac::shouldUseFallbackTheme(const LayoutStyle& style) const | 1845 bool LayoutThemeMac::shouldUseFallbackTheme(const LayoutStyle& style) const |
| 1846 { | 1846 { |
| 1847 ControlPart part = style.appearance(); | 1847 ControlPart part = style.appearance(); |
| 1848 if (part == CheckboxPart || part == RadioPart) | 1848 if (part == CheckboxPart || part == RadioPart) |
| 1849 return style.effectiveZoom() != 1; | 1849 return style.effectiveZoom() != 1; |
| 1850 return false; | 1850 return false; |
| 1851 } | 1851 } |
| 1852 | 1852 |
| 1853 } // namespace blink | 1853 } // namespace blink |
| OLD | NEW |