OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2010, 2011, 2012 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2010, 2011, 2012 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 NSControlSize controlSize = [checkboxCell controlSize]; | 283 NSControlSize controlSize = [checkboxCell controlSize]; |
284 IntSize zoomedSize = checkboxSizes()[controlSize]; | 284 IntSize zoomedSize = checkboxSizes()[controlSize]; |
285 zoomedSize.setWidth(zoomedSize.width() * zoomFactor); | 285 zoomedSize.setWidth(zoomedSize.width() * zoomFactor); |
286 zoomedSize.setHeight(zoomedSize.height() * zoomFactor); | 286 zoomedSize.setHeight(zoomedSize.height() * zoomFactor); |
287 IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, checkboxMargins(c
ontrolSize), zoomFactor); | 287 IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, checkboxMargins(c
ontrolSize), zoomFactor); |
288 | 288 |
289 if (zoomFactor != 1.0f) { | 289 if (zoomFactor != 1.0f) { |
290 inflatedRect.setWidth(inflatedRect.width() / zoomFactor); | 290 inflatedRect.setWidth(inflatedRect.width() / zoomFactor); |
291 inflatedRect.setHeight(inflatedRect.height() / zoomFactor); | 291 inflatedRect.setHeight(inflatedRect.height() / zoomFactor); |
292 context->translate(inflatedRect.x(), inflatedRect.y()); | 292 context->translate(inflatedRect.x(), inflatedRect.y()); |
293 context->scale(FloatSize(zoomFactor, zoomFactor)); | 293 context->scale(zoomFactor, zoomFactor); |
294 context->translate(-inflatedRect.x(), -inflatedRect.y()); | 294 context->translate(-inflatedRect.x(), -inflatedRect.y()); |
295 } | 295 } |
296 | 296 |
297 LocalCurrentGraphicsContext localContext(context); | 297 LocalCurrentGraphicsContext localContext(context); |
298 NSView *view = ThemeMac::ensuredView(scrollView); | 298 NSView *view = ThemeMac::ensuredView(scrollView); |
299 [checkboxCell drawWithFrame:NSRect(inflatedRect) inView:view]; | 299 [checkboxCell drawWithFrame:NSRect(inflatedRect) inView:view]; |
300 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING | 300 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING |
301 if (states & FocusControlState) | 301 if (states & FocusControlState) |
302 [checkboxCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:vi
ew]; | 302 [checkboxCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:vi
ew]; |
303 #endif | 303 #endif |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 NSControlSize controlSize = [radioCell controlSize]; | 363 NSControlSize controlSize = [radioCell controlSize]; |
364 IntSize zoomedSize = radioSizes()[controlSize]; | 364 IntSize zoomedSize = radioSizes()[controlSize]; |
365 zoomedSize.setWidth(zoomedSize.width() * zoomFactor); | 365 zoomedSize.setWidth(zoomedSize.width() * zoomFactor); |
366 zoomedSize.setHeight(zoomedSize.height() * zoomFactor); | 366 zoomedSize.setHeight(zoomedSize.height() * zoomFactor); |
367 IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, radioMargins(cont
rolSize), zoomFactor); | 367 IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, radioMargins(cont
rolSize), zoomFactor); |
368 | 368 |
369 if (zoomFactor != 1.0f) { | 369 if (zoomFactor != 1.0f) { |
370 inflatedRect.setWidth(inflatedRect.width() / zoomFactor); | 370 inflatedRect.setWidth(inflatedRect.width() / zoomFactor); |
371 inflatedRect.setHeight(inflatedRect.height() / zoomFactor); | 371 inflatedRect.setHeight(inflatedRect.height() / zoomFactor); |
372 context->translate(inflatedRect.x(), inflatedRect.y()); | 372 context->translate(inflatedRect.x(), inflatedRect.y()); |
373 context->scale(FloatSize(zoomFactor, zoomFactor)); | 373 context->scale(zoomFactor, zoomFactor); |
374 context->translate(-inflatedRect.x(), -inflatedRect.y()); | 374 context->translate(-inflatedRect.x(), -inflatedRect.y()); |
375 } | 375 } |
376 | 376 |
377 LocalCurrentGraphicsContext localContext(context); | 377 LocalCurrentGraphicsContext localContext(context); |
378 BEGIN_BLOCK_OBJC_EXCEPTIONS | 378 BEGIN_BLOCK_OBJC_EXCEPTIONS |
379 NSView *view = ThemeMac::ensuredView(scrollView); | 379 NSView *view = ThemeMac::ensuredView(scrollView); |
380 [radioCell drawWithFrame:NSRect(inflatedRect) inView:view]; | 380 [radioCell drawWithFrame:NSRect(inflatedRect) inView:view]; |
381 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING | 381 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING |
382 if (states & FocusControlState) | 382 if (states & FocusControlState) |
383 [radioCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:view]
; | 383 [radioCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:view]
; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 inflatedRect.setHeight(zoomedSize.height()); | 455 inflatedRect.setHeight(zoomedSize.height()); |
456 } | 456 } |
457 | 457 |
458 // Now inflate it to account for the shadow. | 458 // Now inflate it to account for the shadow. |
459 inflatedRect = inflateRect(inflatedRect, zoomedSize, buttonMargins(contr
olSize), zoomFactor); | 459 inflatedRect = inflateRect(inflatedRect, zoomedSize, buttonMargins(contr
olSize), zoomFactor); |
460 | 460 |
461 if (zoomFactor != 1.0f) { | 461 if (zoomFactor != 1.0f) { |
462 inflatedRect.setWidth(inflatedRect.width() / zoomFactor); | 462 inflatedRect.setWidth(inflatedRect.width() / zoomFactor); |
463 inflatedRect.setHeight(inflatedRect.height() / zoomFactor); | 463 inflatedRect.setHeight(inflatedRect.height() / zoomFactor); |
464 context->translate(inflatedRect.x(), inflatedRect.y()); | 464 context->translate(inflatedRect.x(), inflatedRect.y()); |
465 context->scale(FloatSize(zoomFactor, zoomFactor)); | 465 context->scale(zoomFactor, zoomFactor); |
466 context->translate(-inflatedRect.x(), -inflatedRect.y()); | 466 context->translate(-inflatedRect.x(), -inflatedRect.y()); |
467 } | 467 } |
468 } | 468 } |
469 | 469 |
470 LocalCurrentGraphicsContext localContext(context); | 470 LocalCurrentGraphicsContext localContext(context); |
471 NSView *view = ThemeMac::ensuredView(scrollView); | 471 NSView *view = ThemeMac::ensuredView(scrollView); |
472 | 472 |
473 [buttonCell drawWithFrame:NSRect(inflatedRect) inView:view]; | 473 [buttonCell drawWithFrame:NSRect(inflatedRect) inView:view]; |
474 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING | 474 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING |
475 if (states & FocusState) | 475 if (states & FocusState) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 drawInfo.kind = kThemeIncDecButtonMini; | 516 drawInfo.kind = kThemeIncDecButtonMini; |
517 else | 517 else |
518 drawInfo.kind = kThemeIncDecButton; | 518 drawInfo.kind = kThemeIncDecButton; |
519 | 519 |
520 IntRect rect(zoomedRect); | 520 IntRect rect(zoomedRect); |
521 GraphicsContextStateSaver stateSaver(*context); | 521 GraphicsContextStateSaver stateSaver(*context); |
522 if (zoomFactor != 1.0f) { | 522 if (zoomFactor != 1.0f) { |
523 rect.setWidth(rect.width() / zoomFactor); | 523 rect.setWidth(rect.width() / zoomFactor); |
524 rect.setHeight(rect.height() / zoomFactor); | 524 rect.setHeight(rect.height() / zoomFactor); |
525 context->translate(rect.x(), rect.y()); | 525 context->translate(rect.x(), rect.y()); |
526 context->scale(FloatSize(zoomFactor, zoomFactor)); | 526 context->scale(zoomFactor, zoomFactor); |
527 context->translate(-rect.x(), -rect.y()); | 527 context->translate(-rect.x(), -rect.y()); |
528 } | 528 } |
529 CGRect bounds(rect); | 529 CGRect bounds(rect); |
530 CGRect backgroundBounds; | 530 CGRect backgroundBounds; |
531 HIThemeGetButtonBackgroundBounds(&bounds, &drawInfo, &backgroundBounds); | 531 HIThemeGetButtonBackgroundBounds(&bounds, &drawInfo, &backgroundBounds); |
532 // Center the stepper rectangle in the specified area. | 532 // Center the stepper rectangle in the specified area. |
533 backgroundBounds.origin.x = bounds.origin.x + (bounds.size.width - backgroun
dBounds.size.width) / 2; | 533 backgroundBounds.origin.x = bounds.origin.x + (bounds.size.width - backgroun
dBounds.size.width) / 2; |
534 if (backgroundBounds.size.height < bounds.size.height) { | 534 if (backgroundBounds.size.height < bounds.size.height) { |
535 int heightDiff = clampToInteger(bounds.size.height - backgroundBounds.si
ze.height); | 535 int heightDiff = clampToInteger(bounds.size.height - backgroundBounds.si
ze.height); |
536 backgroundBounds.origin.y = bounds.origin.y + (heightDiff / 2) + 1; | 536 backgroundBounds.origin.y = bounds.origin.y + (heightDiff / 2) + 1; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 break; | 719 break; |
720 case InnerSpinButtonPart: | 720 case InnerSpinButtonPart: |
721 paintStepper(states, context, zoomedRect, zoomFactor, scrollView); | 721 paintStepper(states, context, zoomedRect, zoomFactor, scrollView); |
722 break; | 722 break; |
723 default: | 723 default: |
724 break; | 724 break; |
725 } | 725 } |
726 } | 726 } |
727 | 727 |
728 } | 728 } |
OLD | NEW |