Modified: branches/subpixellayout/Source/WebCore/platform/mac/ThemeMac.mm (109242 => 109243)
--- branches/subpixellayout/Source/WebCore/platform/mac/ThemeMac.mm 2012-02-29 20:04:07 UTC (rev 109242)
+++ branches/subpixellayout/Source/WebCore/platform/mac/ThemeMac.mm 2012-02-29 20:20:29 UTC (rev 109243)
@@ -141,10 +141,10 @@
return sizeFromNSControlSize(controlSizeForFont(font), zoomedSize, zoomFactor, sizes);
}
-static ControlSize controlSizeFromPixelSize(const IntSize* sizes, const WebCore::FractionalLayoutSize& minZoomedSize, float zoomFactor)
+static ControlSize controlSizeFromPixelSize(const IntSize* sizes, const IntSize& minZoomedSize, float zoomFactor)
{
- if (minZoomedSize.width() >= (sizes[NSRegularControlSize].width() * zoomFactor) &&
- minZoomedSize.height() >= (sizes[NSRegularControlSize].height() * zoomFactor))
+ if (minZoomedSize.width() >= static_cast<int>(sizes[NSRegularControlSize].width() * zoomFactor) &&
+ minZoomedSize.height() >= static_cast<int>(sizes[NSRegularControlSize].height() * zoomFactor))
return NSRegularControlSize;
if (minZoomedSize.width() >= static_cast<int>(sizes[NSSmallControlSize].width() * zoomFactor) &&
minZoomedSize.height() >= static_cast<int>(sizes[NSSmallControlSize].height() * zoomFactor))
@@ -152,7 +152,7 @@
return NSMiniControlSize;
}
-static void setControlSize(NSCell* cell, const IntSize* sizes, const WebCore::FractionalLayoutSize& minZoomedSize, float zoomFactor)
+static void setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minZoomedSize, float zoomFactor)
{
ControlSize size = controlSizeFromPixelSize(sizes, minZoomedSize, zoomFactor);
if (size != [cell controlSize]) // Only update if we have to, since AppKit does work even if the size is the same.
@@ -211,13 +211,13 @@
return kThemeStateActive;
}
-static IntRect inflateRect(const WebCore::IntRect& zoomedRect, const WebCore::IntSize& zoomedSize, const int* margins, float zoomFactor)
+static IntRect inflateRect(const IntRect& zoomedRect, const IntSize& zoomedSize, const int* margins, float zoomFactor)
{
// Only do the inflation if the available width/height are too small. Otherwise try to
// fit the glow/check space into the available box's width/height.
int widthDelta = zoomedRect.width() - (zoomedSize.width() + margins[leftMargin] * zoomFactor + margins[rightMargin] * zoomFactor);
int heightDelta = zoomedRect.height() - (zoomedSize.height() + margins[topMargin] * zoomFactor + margins[bottomMargin] * zoomFactor);
- WebCore::IntRect result(zoomedRect);
+ IntRect result(zoomedRect);
if (widthDelta < 0) {
result.setX(result.x() - margins[leftMargin] * zoomFactor);
result.setWidth(result.width() - widthDelta);
@@ -258,7 +258,7 @@
return sizeFromFont(font, zoomedSize, zoomFactor, checkboxSizes());
}
-static NSButtonCell *checkbox(ControlStates states, const WebCore::FractionalLayoutRect& zoomedRect, float zoomFactor)
+static NSButtonCell *checkbox(ControlStates states, const IntRect& zoomedRect, float zoomFactor)
{
static NSButtonCell *checkboxCell;
if (!checkboxCell) {
@@ -293,13 +293,13 @@
IntSize zoomedSize = checkboxSizes()[controlSize];
zoomedSize.setWidth(zoomedSize.width() * zoomFactor);
zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
- IntRect inflatedRect = pixelSnappedIntRect(inflateRect(zoomedRect, zoomedSize, checkboxMargins(controlSize), zoomFactor));
+ IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, checkboxMargins(controlSize), zoomFactor);
if (zoomFactor != 1.0f) {
inflatedRect.setWidth(inflatedRect.width() / zoomFactor);
inflatedRect.setHeight(inflatedRect.height() / zoomFactor);
context->translate(inflatedRect.x(), inflatedRect.y());
- context->scale(WebCore::FractionalLayoutSize(zoomFactor, zoomFactor));
+ context->scale(FloatSize(zoomFactor, zoomFactor));
context->translate(-inflatedRect.x(), -inflatedRect.y());
}
@@ -343,7 +343,7 @@
return sizeFromFont(font, zoomedSize, zoomFactor, radioSizes());
}
-static NSButtonCell *radio(ControlStates states, const WebCore::FractionalLayoutRect& zoomedRect, float zoomFactor)
+static NSButtonCell *radio(ControlStates states, const IntRect& zoomedRect, float zoomFactor)
{
static NSButtonCell *radioCell;
if (!radioCell) {
@@ -374,19 +374,19 @@
IntSize zoomedSize = radioSizes()[controlSize];
zoomedSize.setWidth(zoomedSize.width() * zoomFactor);
zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
- WebCore::FractionalLayoutRect inflatedRect = inflateRect(zoomedRect, zoomedSize, radioMargins(controlSize), zoomFactor);
+ IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, radioMargins(controlSize), zoomFactor);
if (zoomFactor != 1.0f) {
inflatedRect.setWidth(inflatedRect.width() / zoomFactor);
inflatedRect.setHeight(inflatedRect.height() / zoomFactor);
context->translate(inflatedRect.x(), inflatedRect.y());
- context->scale(WebCore::FractionalLayoutSize(zoomFactor, zoomFactor));
+ context->scale(FloatSize(zoomFactor, zoomFactor));
context->translate(-inflatedRect.x(), -inflatedRect.y());
}
BEGIN_BLOCK_OBJC_EXCEPTIONS
NSView *view = ThemeMac::ensuredView(scrollView);
- [radioCell drawWithFrame:NSRect(pixelSnappedIntRect(inflatedRect)) inView:view];
+ [radioCell drawWithFrame:NSRect(inflatedRect) inView:view];
#if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING
if (states & FocusState)
[radioCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:view];
@@ -435,7 +435,7 @@
return cell;
}
-static void setUpButtonCell(NSButtonCell *cell, ControlPart part, ControlStates states, const WebCore::FractionalLayoutRect& zoomedRect, float zoomFactor)
+static void setUpButtonCell(NSButtonCell *cell, ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor)
{
// Set the control size based off the rectangle we're painting into.
const IntSize* sizes = buttonSizes();
@@ -458,7 +458,7 @@
updateStates(cell, states);
}
-static NSButtonCell *button(ControlPart part, ControlStates states, const WebCore::FractionalLayoutRect& zoomedRect, float zoomFactor)
+static NSButtonCell *button(ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor)
{
NSButtonCell *cell;
if (states & DefaultState) {
@@ -472,7 +472,7 @@
return cell;
}
-static void paintButton(ControlPart part, ControlStates states, GraphicsContext* context, const WebCore::FractionalLayoutRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
+static void paintButton(ControlPart part, ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
@@ -488,7 +488,7 @@
#endif
zoomedSize.setWidth(zoomedRect.width()); // Buttons don't ever constrain width, so the zoomed width can just be honored.
zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
- IntRect inflatedRect = pixelSnappedIntRect(zoomedRect);
+ IntRect inflatedRect = zoomedRect;
if ([buttonCell bezelStyle] == NSRoundedBezelStyle) {
// Center the button within the available space.
if (inflatedRect.height() > zoomedSize.height()) {
@@ -497,13 +497,13 @@
}
// Now inflate it to account for the shadow.
- inflatedRect = pixelSnappedIntRect(inflateRect(inflatedRect, zoomedSize, buttonMargins(controlSize), zoomFactor));
+ inflatedRect = inflateRect(inflatedRect, zoomedSize, buttonMargins(controlSize), zoomFactor);
if (zoomFactor != 1.0f) {
inflatedRect.setWidth(inflatedRect.width() / zoomFactor);
inflatedRect.setHeight(inflatedRect.height() / zoomFactor);
context->translate(inflatedRect.x(), inflatedRect.y());
- context->scale(WebCore::FractionalLayoutSize(zoomFactor, zoomFactor));
+ context->scale(FloatSize(zoomFactor, zoomFactor));
context->translate(-inflatedRect.x(), -inflatedRect.y());
}
}
@@ -574,7 +574,7 @@
rect.setWidth(rect.width() / zoomFactor);
rect.setHeight(rect.height() / zoomFactor);
context->translate(rect.x(), rect.y());
- context->scale(WebCore::FractionalLayoutSize(zoomFactor, zoomFactor));
+ context->scale(FloatSize(zoomFactor, zoomFactor));
context->translate(-rect.x(), -rect.y());
}
CGRect bounds(rect);
@@ -702,7 +702,7 @@
}
}
-void ThemeMac::inflateControlPaintRect(ControlPart part, ControlStates states, WebCore::IntRect& zoomedRect, float zoomFactor) const
+void ThemeMac::inflateControlPaintRect(ControlPart part, ControlStates states, IntRect& zoomedRect, float zoomFactor) const
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
switch (part) {
@@ -711,7 +711,7 @@
// shadow" and the check. We don't consider this part of the bounds of the control in WebKit.
NSCell *cell = checkbox(states, zoomedRect, zoomFactor);
NSControlSize controlSize = [cell controlSize];
- WebCore::IntSize zoomedSize = checkboxSizes()[controlSize];
+ IntSize zoomedSize = checkboxSizes()[controlSize];
zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
zoomedSize.setWidth(zoomedSize.width() * zoomFactor);
zoomedRect = inflateRect(zoomedRect, zoomedSize, checkboxMargins(controlSize), zoomFactor);
@@ -722,7 +722,7 @@
// shadow". We don't consider this part of the bounds of the control in WebKit.
NSCell *cell = radio(states, zoomedRect, zoomFactor);
NSControlSize controlSize = [cell controlSize];
- WebCore::IntSize zoomedSize = radioSizes()[controlSize];
+ IntSize zoomedSize = radioSizes()[controlSize];
zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
zoomedSize.setWidth(zoomedSize.width() * zoomFactor);
zoomedRect = inflateRect(zoomedRect, zoomedSize, radioMargins(controlSize), zoomFactor);
@@ -736,7 +736,7 @@
// We inflate the rect as needed to account for the Aqua button's shadow.
if ([cell bezelStyle] == NSRoundedBezelStyle) {
- WebCore::IntSize zoomedSize = buttonSizes()[controlSize];
+ IntSize zoomedSize = buttonSizes()[controlSize];
zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
zoomedSize.setWidth(zoomedRect.width()); // Buttons don't ever constrain width, so the zoomed width can just be honored.
zoomedRect = inflateRect(zoomedRect, zoomedSize, buttonMargins(controlSize), zoomFactor);
@@ -746,7 +746,7 @@
case InnerSpinButtonPart: {
static const int stepperMargin[4] = { 0, 0, 0, 0 };
ControlSize controlSize = controlSizeFromPixelSize(stepperSizes(), zoomedRect.size(), zoomFactor);
- WebCore::IntSize zoomedSize = stepperSizes()[controlSize];
+ IntSize zoomedSize = stepperSizes()[controlSize];
zoomedSize.setHeight(zoomedSize.height() * zoomFactor);
zoomedSize.setWidth(zoomedSize.width() * zoomFactor);
zoomedRect = inflateRect(zoomedRect, zoomedSize, stepperMargin, zoomFactor);