Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutThemeMac.mm

Issue 1747763002: Remove OSX-specific <meter> rendering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
index a9fea2fdc7cc049f12c24736bc6597d0c252e6e3..18dd4a89429a096e77d995ee6f637d54a1946d76 100644
--- a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
+++ b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
@@ -23,8 +23,6 @@
#import "core/CSSValueKeywords.h"
#import "core/HTMLNames.h"
#import "core/fileapi/FileList.h"
-#import "core/html/HTMLMeterElement.h"
-#import "core/layout/LayoutMeter.h"
#import "core/layout/LayoutProgress.h"
#import "core/layout/LayoutView.h"
#import "core/paint/MediaControlsPainter.h"
@@ -659,91 +657,6 @@ const int* LayoutThemeMac::popupButtonPadding(NSControlSize size) const
return padding[size];
}
-IntSize LayoutThemeMac::meterSizeForBounds(const LayoutMeter& layoutMeter, const IntRect& bounds) const
-{
- if (NoControlPart == layoutMeter.style()->appearance())
- return bounds.size();
-
- NSLevelIndicatorCell* cell = levelIndicatorFor(layoutMeter);
- // Makes enough room for cell's intrinsic size.
- NSSize cellSize = [cell cellSizeForBounds:IntRect(IntPoint(), bounds.size())];
- return IntSize(bounds.width() < cellSize.width ? cellSize.width : bounds.width(),
- bounds.height() < cellSize.height ? cellSize.height : bounds.height());
-}
-
-bool LayoutThemeMac::supportsMeter(ControlPart part) const
-{
- switch (part) {
- case RelevancyLevelIndicatorPart:
- case DiscreteCapacityLevelIndicatorPart:
- case RatingLevelIndicatorPart:
- case MeterPart:
- case ContinuousCapacityLevelIndicatorPart:
- return true;
- default:
- return false;
- }
-}
-
-NSLevelIndicatorStyle LayoutThemeMac::levelIndicatorStyleFor(ControlPart part) const
-{
- switch (part) {
- case RelevancyLevelIndicatorPart:
- return NSRelevancyLevelIndicatorStyle;
- case DiscreteCapacityLevelIndicatorPart:
- return NSDiscreteCapacityLevelIndicatorStyle;
- case RatingLevelIndicatorPart:
- return NSRatingLevelIndicatorStyle;
- case MeterPart:
- case ContinuousCapacityLevelIndicatorPart:
- default:
- return NSContinuousCapacityLevelIndicatorStyle;
- }
-}
-
-NSLevelIndicatorCell* LayoutThemeMac::levelIndicatorFor(const LayoutMeter& layoutMeter) const
-{
- const ComputedStyle& style = layoutMeter.styleRef();
- ASSERT(style.appearance() != NoControlPart);
-
- if (!m_levelIndicator)
- m_levelIndicator.adoptNS([[NSLevelIndicatorCell alloc] initWithLevelIndicatorStyle:NSContinuousCapacityLevelIndicatorStyle]);
- NSLevelIndicatorCell* cell = m_levelIndicator.get();
-
- HTMLMeterElement* element = layoutMeter.meterElement();
- double value = element->value();
-
- // Because NSLevelIndicatorCell does not support optimum-in-the-middle type
- // coloring, we explicitly control the color instead giving low and high
- // value to NSLevelIndicatorCell as is.
- switch (element->gaugeRegion()) {
- case HTMLMeterElement::GaugeRegionOptimum:
- // Make meter the green.
- [cell setWarningValue:value + 1];
- [cell setCriticalValue:value + 2];
- break;
- case HTMLMeterElement::GaugeRegionSuboptimal:
- // Make the meter yellow.
- [cell setWarningValue:value - 1];
- [cell setCriticalValue:value + 1];
- break;
- case HTMLMeterElement::GaugeRegionEvenLessGood:
- // Make the meter red.
- [cell setWarningValue:value - 2];
- [cell setCriticalValue:value - 1];
- break;
- }
-
- [cell setLevelIndicatorStyle:levelIndicatorStyleFor(style.appearance())];
- [cell setBaseWritingDirection:style.isLeftToRightDirection() ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft];
- [cell setMinValue:element->min()];
- [cell setMaxValue:element->max()];
- RetainPtr<NSNumber> valueObject = [NSNumber numberWithDouble:value];
- [cell setObjectValue:valueObject.get()];
-
- return cell;
-}
-
const IntSize* LayoutThemeMac::progressBarSizes() const
{
static const IntSize sizes[3] = { IntSize(0, 20), IntSize(0, 12), IntSize(0, 12) };
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutThemeMac.h ('k') | third_party/WebKit/Source/core/paint/ThemePainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698