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

Side by Side Diff: Source/core/rendering/RenderThemeChromiumMac.mm

Issue 339333002: Removing using declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing mac error Created 6 years, 6 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 unified diff | Download patch
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #import "platform/text/PlatformLocale.h" 56 #import "platform/text/PlatformLocale.h"
57 #import "platform/text/StringTruncator.h" 57 #import "platform/text/StringTruncator.h"
58 58
59 #import <AvailabilityMacros.h> 59 #import <AvailabilityMacros.h>
60 #import <Carbon/Carbon.h> 60 #import <Carbon/Carbon.h>
61 #import <Cocoa/Cocoa.h> 61 #import <Cocoa/Cocoa.h>
62 #import <math.h> 62 #import <math.h>
63 #import <wtf/RetainPtr.h> 63 #import <wtf/RetainPtr.h>
64 #import <wtf/StdLibExtras.h> 64 #import <wtf/StdLibExtras.h>
65 65
66 using namespace std;
67
68 // The methods in this file are specific to the Mac OS X platform. 66 // The methods in this file are specific to the Mac OS X platform.
69 67
70 // We estimate the animation rate of a Mac OS X progress bar is 33 fps. 68 // We estimate the animation rate of a Mac OS X progress bar is 33 fps.
71 // Hard code the value here because we haven't found API for it. 69 // Hard code the value here because we haven't found API for it.
72 const double progressAnimationFrameRate = 0.033; 70 const double progressAnimationFrameRate = 0.033;
73 71
74 // Mac OS X progress bar animation seems to have 256 frames. 72 // Mac OS X progress bar animation seems to have 256 frames.
75 const double progressAnimationNumFrames = 256; 73 const double progressAnimationNumFrames = 256;
76 74
77 @interface WebCoreRenderThemeNotificationObserver : NSObject 75 @interface WebCoreRenderThemeNotificationObserver : NSObject
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 RenderProgress* renderProgress = toRenderProgress(renderObject); 1075 RenderProgress* renderProgress = toRenderProgress(renderObject);
1078 HIThemeTrackDrawInfo trackInfo; 1076 HIThemeTrackDrawInfo trackInfo;
1079 trackInfo.version = 0; 1077 trackInfo.version = 0;
1080 if (controlSize == NSRegularControlSize) 1078 if (controlSize == NSRegularControlSize)
1081 trackInfo.kind = renderProgress->position() < 0 ? kThemeLargeIndetermina teBar : kThemeLargeProgressBar; 1079 trackInfo.kind = renderProgress->position() < 0 ? kThemeLargeIndetermina teBar : kThemeLargeProgressBar;
1082 else 1080 else
1083 trackInfo.kind = renderProgress->position() < 0 ? kThemeMediumIndetermin ateBar : kThemeMediumProgressBar; 1081 trackInfo.kind = renderProgress->position() < 0 ? kThemeMediumIndetermin ateBar : kThemeMediumProgressBar;
1084 1082
1085 trackInfo.bounds = IntRect(IntPoint(), inflatedRect.size()); 1083 trackInfo.bounds = IntRect(IntPoint(), inflatedRect.size());
1086 trackInfo.min = 0; 1084 trackInfo.min = 0;
1087 trackInfo.max = numeric_limits<SInt32>::max(); 1085 trackInfo.max = std::numeric_limits<SInt32>::max();
1088 trackInfo.value = lround(renderProgress->position() * nextafter(trackInfo.ma x, 0)); 1086 trackInfo.value = lround(renderProgress->position() * nextafter(trackInfo.ma x, 0));
1089 trackInfo.trackInfo.progress.phase = lround(renderProgress->animationProgres s() * nextafter(progressAnimationNumFrames, 0)); 1087 trackInfo.trackInfo.progress.phase = lround(renderProgress->animationProgres s() * nextafter(progressAnimationNumFrames, 0));
1090 trackInfo.attributes = kThemeTrackHorizontal; 1088 trackInfo.attributes = kThemeTrackHorizontal;
1091 trackInfo.enableState = isActive(renderObject) ? kThemeTrackActive : kThemeT rackInactive; 1089 trackInfo.enableState = isActive(renderObject) ? kThemeTrackActive : kThemeT rackInactive;
1092 trackInfo.reserved = 0; 1090 trackInfo.reserved = 0;
1093 trackInfo.filler1 = 0; 1091 trackInfo.filler1 = 0;
1094 1092
1095 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(inflatedRect.size()); 1093 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(inflatedRect.size());
1096 if (!imageBuffer) 1094 if (!imageBuffer)
1097 return true; 1095 return true;
(...skipping 26 matching lines...) Expand all
1124 const int styledPopupPaddingTop = 1; 1122 const int styledPopupPaddingTop = 1;
1125 const int styledPopupPaddingBottom = 2; 1123 const int styledPopupPaddingBottom = 2;
1126 1124
1127 bool RenderThemeChromiumMac::paintMenuListButton(RenderObject* o, const PaintInf o& paintInfo, const IntRect& r) 1125 bool RenderThemeChromiumMac::paintMenuListButton(RenderObject* o, const PaintInf o& paintInfo, const IntRect& r)
1128 { 1126 {
1129 IntRect bounds = IntRect(r.x() + o->style()->borderLeftWidth(), 1127 IntRect bounds = IntRect(r.x() + o->style()->borderLeftWidth(),
1130 r.y() + o->style()->borderTopWidth(), 1128 r.y() + o->style()->borderTopWidth(),
1131 r.width() - o->style()->borderLeftWidth() - o->styl e()->borderRightWidth(), 1129 r.width() - o->style()->borderLeftWidth() - o->styl e()->borderRightWidth(),
1132 r.height() - o->style()->borderTopWidth() - o->styl e()->borderBottomWidth()); 1130 r.height() - o->style()->borderTopWidth() - o->styl e()->borderBottomWidth());
1133 // Since we actually know the size of the control here, we restrict the font scale to make sure the arrows will fit vertically in the bounds 1131 // Since we actually know the size of the control here, we restrict the font scale to make sure the arrows will fit vertically in the bounds
1134 float fontScale = min(o->style()->fontSize() / baseFontSize, bounds.height() / (baseArrowHeight * 2 + baseSpaceBetweenArrows)); 1132 float fontScale = std::min(o->style()->fontSize() / baseFontSize, bounds.hei ght() / (baseArrowHeight * 2 + baseSpaceBetweenArrows));
1135 float centerY = bounds.y() + bounds.height() / 2.0f; 1133 float centerY = bounds.y() + bounds.height() / 2.0f;
1136 float arrowHeight = baseArrowHeight * fontScale; 1134 float arrowHeight = baseArrowHeight * fontScale;
1137 float arrowWidth = baseArrowWidth * fontScale; 1135 float arrowWidth = baseArrowWidth * fontScale;
1138 float leftEdge = bounds.maxX() - arrowPaddingRight * o->style()->effectiveZo om() - arrowWidth; 1136 float leftEdge = bounds.maxX() - arrowPaddingRight * o->style()->effectiveZo om() - arrowWidth;
1139 float spaceBetweenArrows = baseSpaceBetweenArrows * fontScale; 1137 float spaceBetweenArrows = baseSpaceBetweenArrows * fontScale;
1140 1138
1141 if (bounds.width() < arrowWidth + arrowPaddingLeft * o->style()->effectiveZo om()) 1139 if (bounds.width() < arrowWidth + arrowPaddingLeft * o->style()->effectiveZo om())
1142 return false; 1140 return false;
1143 1141
1144 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1142 GraphicsContextStateSaver stateSaver(*paintInfo.context);
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 1903
1906 bool RenderThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* style) const 1904 bool RenderThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* style) const
1907 { 1905 {
1908 ControlPart part = style->appearance(); 1906 ControlPart part = style->appearance();
1909 if (part == CheckboxPart || part == RadioPart) 1907 if (part == CheckboxPart || part == RadioPart)
1910 return style->effectiveZoom() != 1; 1908 return style->effectiveZoom() != 1;
1911 return false; 1909 return false;
1912 } 1910 }
1913 1911
1914 } // namespace WebCore 1912 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderTextControlSingleLine.cpp ('k') | Source/core/rendering/RootInlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698