| 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 return true; | 485 return true; |
| 486 // FIXME: NSSearchFieldCell doesn't work well when scaled. | 486 // FIXME: NSSearchFieldCell doesn't work well when scaled. |
| 487 if (style->appearance() == SearchFieldPart && style->effectiveZoom() != 1) | 487 if (style->appearance() == SearchFieldPart && style->effectiveZoom() != 1) |
| 488 return true; | 488 return true; |
| 489 | 489 |
| 490 return LayoutTheme::isControlStyled(style, uaStyle); | 490 return LayoutTheme::isControlStyled(style, uaStyle); |
| 491 } | 491 } |
| 492 | 492 |
| 493 const int sliderThumbShadowBlur = 1; | 493 const int sliderThumbShadowBlur = 1; |
| 494 | 494 |
| 495 void LayoutThemeChromiumMac::adjustPaintInvalidationRect(const RenderObject* o,
IntRect& r) | 495 void LayoutThemeChromiumMac::adjustPaintInvalidationRect(const LayoutObject* o,
IntRect& r) |
| 496 { | 496 { |
| 497 ControlPart part = o->style()->appearance(); | 497 ControlPart part = o->style()->appearance(); |
| 498 | 498 |
| 499 #if USE(NEW_THEME) | 499 #if USE(NEW_THEME) |
| 500 switch (part) { | 500 switch (part) { |
| 501 case CheckboxPart: | 501 case CheckboxPart: |
| 502 case RadioPart: | 502 case RadioPart: |
| 503 case PushButtonPart: | 503 case PushButtonPart: |
| 504 case SquareButtonPart: | 504 case SquareButtonPart: |
| 505 case ButtonPart: | 505 case ButtonPart: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 516 setPopupButtonCellState(o, r); | 516 setPopupButtonCellState(o, r); |
| 517 IntSize size = popupButtonSizes()[[popupButton() controlSize]]; | 517 IntSize size = popupButtonSizes()[[popupButton() controlSize]]; |
| 518 size.setHeight(size.height() * zoomLevel); | 518 size.setHeight(size.height() * zoomLevel); |
| 519 size.setWidth(r.width()); | 519 size.setWidth(r.width()); |
| 520 r = ThemeMac::inflateRect(r, size, popupButtonMargins(), zoomLevel); | 520 r = ThemeMac::inflateRect(r, size, popupButtonMargins(), zoomLevel); |
| 521 } else if (part == SliderThumbHorizontalPart || part == SliderThumbVerticalP
art) { | 521 } else if (part == SliderThumbHorizontalPart || part == SliderThumbVerticalP
art) { |
| 522 r.setHeight(r.height() + sliderThumbShadowBlur); | 522 r.setHeight(r.height() + sliderThumbShadowBlur); |
| 523 } | 523 } |
| 524 } | 524 } |
| 525 | 525 |
| 526 FloatRect LayoutThemeChromiumMac::convertToPaintingRect(const RenderObject* inpu
tRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const I
ntRect& r) const | 526 FloatRect LayoutThemeChromiumMac::convertToPaintingRect(const LayoutObject* inpu
tRenderer, const LayoutObject* partRenderer, const FloatRect& inputRect, const I
ntRect& r) const |
| 527 { | 527 { |
| 528 FloatRect partRect(inputRect); | 528 FloatRect partRect(inputRect); |
| 529 | 529 |
| 530 // Compute an offset between the part renderer and the input renderer. | 530 // Compute an offset between the part renderer and the input renderer. |
| 531 FloatSize offsetFromInputRenderer; | 531 FloatSize offsetFromInputRenderer; |
| 532 const RenderObject* renderer = partRenderer; | 532 const LayoutObject* renderer = partRenderer; |
| 533 while (renderer && renderer != inputRenderer) { | 533 while (renderer && renderer != inputRenderer) { |
| 534 RenderObject* containingRenderer = renderer->container(); | 534 LayoutObject* containingRenderer = renderer->container(); |
| 535 offsetFromInputRenderer -= roundedIntSize(renderer->offsetFromContainer(
containingRenderer, LayoutPoint())); | 535 offsetFromInputRenderer -= roundedIntSize(renderer->offsetFromContainer(
containingRenderer, LayoutPoint())); |
| 536 renderer = containingRenderer; | 536 renderer = containingRenderer; |
| 537 } | 537 } |
| 538 // If the input renderer was not a container, something went wrong. | 538 // If the input renderer was not a container, something went wrong. |
| 539 ASSERT(renderer == inputRenderer); | 539 ASSERT(renderer == inputRenderer); |
| 540 // Move the rect into partRenderer's coords. | 540 // Move the rect into partRenderer's coords. |
| 541 partRect.move(offsetFromInputRenderer); | 541 partRect.move(offsetFromInputRenderer); |
| 542 // Account for the local drawing offset (tx, ty). | 542 // Account for the local drawing offset (tx, ty). |
| 543 partRect.move(r.x(), r.y()); | 543 partRect.move(r.x(), r.y()); |
| 544 | 544 |
| 545 return partRect; | 545 return partRect; |
| 546 } | 546 } |
| 547 | 547 |
| 548 void LayoutThemeChromiumMac::updateCheckedState(NSCell* cell, const RenderObject
* o) | 548 void LayoutThemeChromiumMac::updateCheckedState(NSCell* cell, const LayoutObject
* o) |
| 549 { | 549 { |
| 550 bool oldIndeterminate = [cell state] == NSMixedState; | 550 bool oldIndeterminate = [cell state] == NSMixedState; |
| 551 bool indeterminate = isIndeterminate(o); | 551 bool indeterminate = isIndeterminate(o); |
| 552 bool checked = isChecked(o); | 552 bool checked = isChecked(o); |
| 553 | 553 |
| 554 if (oldIndeterminate != indeterminate) { | 554 if (oldIndeterminate != indeterminate) { |
| 555 [cell setState:indeterminate ? NSMixedState : (checked ? NSOnState : NSO
ffState)]; | 555 [cell setState:indeterminate ? NSMixedState : (checked ? NSOnState : NSO
ffState)]; |
| 556 return; | 556 return; |
| 557 } | 557 } |
| 558 | 558 |
| 559 bool oldChecked = [cell state] == NSOnState; | 559 bool oldChecked = [cell state] == NSOnState; |
| 560 if (checked != oldChecked) | 560 if (checked != oldChecked) |
| 561 [cell setState:checked ? NSOnState : NSOffState]; | 561 [cell setState:checked ? NSOnState : NSOffState]; |
| 562 } | 562 } |
| 563 | 563 |
| 564 void LayoutThemeChromiumMac::updateEnabledState(NSCell* cell, const RenderObject
* o) | 564 void LayoutThemeChromiumMac::updateEnabledState(NSCell* cell, const LayoutObject
* o) |
| 565 { | 565 { |
| 566 bool oldEnabled = [cell isEnabled]; | 566 bool oldEnabled = [cell isEnabled]; |
| 567 bool enabled = isEnabled(o); | 567 bool enabled = isEnabled(o); |
| 568 if (enabled != oldEnabled) | 568 if (enabled != oldEnabled) |
| 569 [cell setEnabled:enabled]; | 569 [cell setEnabled:enabled]; |
| 570 } | 570 } |
| 571 | 571 |
| 572 void LayoutThemeChromiumMac::updateFocusedState(NSCell* cell, const RenderObject
* o) | 572 void LayoutThemeChromiumMac::updateFocusedState(NSCell* cell, const LayoutObject
* o) |
| 573 { | 573 { |
| 574 bool oldFocused = [cell showsFirstResponder]; | 574 bool oldFocused = [cell showsFirstResponder]; |
| 575 bool focused = isFocused(o) && o->style()->outlineStyleIsAuto(); | 575 bool focused = isFocused(o) && o->style()->outlineStyleIsAuto(); |
| 576 if (focused != oldFocused) | 576 if (focused != oldFocused) |
| 577 [cell setShowsFirstResponder:focused]; | 577 [cell setShowsFirstResponder:focused]; |
| 578 } | 578 } |
| 579 | 579 |
| 580 void LayoutThemeChromiumMac::updatePressedState(NSCell* cell, const RenderObject
* o) | 580 void LayoutThemeChromiumMac::updatePressedState(NSCell* cell, const LayoutObject
* o) |
| 581 { | 581 { |
| 582 bool oldPressed = [cell isHighlighted]; | 582 bool oldPressed = [cell isHighlighted]; |
| 583 bool pressed = o->node() && o->node()->active(); | 583 bool pressed = o->node() && o->node()->active(); |
| 584 if (pressed != oldPressed) | 584 if (pressed != oldPressed) |
| 585 [cell setHighlighted:pressed]; | 585 [cell setHighlighted:pressed]; |
| 586 } | 586 } |
| 587 | 587 |
| 588 NSControlSize LayoutThemeChromiumMac::controlSizeForFont(RenderStyle* style) con
st | 588 NSControlSize LayoutThemeChromiumMac::controlSizeForFont(RenderStyle* style) con
st |
| 589 { | 589 { |
| 590 int fontSize = style->fontSize(); | 590 int fontSize = style->fontSize(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 float zoomLevel = style->effectiveZoom(); | 678 float zoomLevel = style->effectiveZoom(); |
| 679 if (zoomLevel != 1) | 679 if (zoomLevel != 1) |
| 680 fontSize /= zoomLevel; | 680 fontSize /= zoomLevel; |
| 681 if (fontSize >= [NSFont systemFontSizeForControlSize:NSRegularControlSize]) | 681 if (fontSize >= [NSFont systemFontSizeForControlSize:NSRegularControlSize]) |
| 682 return NSRegularControlSize; | 682 return NSRegularControlSize; |
| 683 if (fontSize >= [NSFont systemFontSizeForControlSize:NSSmallControlSize]) | 683 if (fontSize >= [NSFont systemFontSizeForControlSize:NSSmallControlSize]) |
| 684 return NSSmallControlSize; | 684 return NSSmallControlSize; |
| 685 return NSMiniControlSize; | 685 return NSMiniControlSize; |
| 686 } | 686 } |
| 687 | 687 |
| 688 bool LayoutThemeChromiumMac::paintTextField(RenderObject* o, const PaintInfo& pa
intInfo, const IntRect& r) | 688 bool LayoutThemeChromiumMac::paintTextField(LayoutObject* o, const PaintInfo& pa
intInfo, const IntRect& r) |
| 689 { | 689 { |
| 690 LocalCurrentGraphicsContext localContext(paintInfo.context, r); | 690 LocalCurrentGraphicsContext localContext(paintInfo.context, r); |
| 691 | 691 |
| 692 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 | 692 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 |
| 693 bool useNSTextFieldCell = o->style()->hasAppearance() | 693 bool useNSTextFieldCell = o->style()->hasAppearance() |
| 694 && o->style()->visitedDependentColor(CSSPropertyBackgroundColor) == Colo
r::white | 694 && o->style()->visitedDependentColor(CSSPropertyBackgroundColor) == Colo
r::white |
| 695 && !o->style()->hasBackgroundImage(); | 695 && !o->style()->hasBackgroundImage(); |
| 696 | 696 |
| 697 // We do not use NSTextFieldCell to draw styled text fields on Lion and | 697 // We do not use NSTextFieldCell to draw styled text fields on Lion and |
| 698 // SnowLeopard because there are a number of bugs on those platforms that | 698 // SnowLeopard because there are a number of bugs on those platforms that |
| (...skipping 11 matching lines...) Expand all Loading... |
| 710 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 710 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 711 | 711 |
| 712 [textField setEnabled:(isEnabled(o) && !isReadOnlyControl(o))]; | 712 [textField setEnabled:(isEnabled(o) && !isReadOnlyControl(o))]; |
| 713 [textField drawWithFrame:NSRect(r) inView:documentViewFor(o)]; | 713 [textField drawWithFrame:NSRect(r) inView:documentViewFor(o)]; |
| 714 | 714 |
| 715 [textField setControlView:nil]; | 715 [textField setControlView:nil]; |
| 716 | 716 |
| 717 return false; | 717 return false; |
| 718 } | 718 } |
| 719 | 719 |
| 720 bool LayoutThemeChromiumMac::paintCapsLockIndicator(RenderObject*, const PaintIn
fo& paintInfo, const IntRect& r) | 720 bool LayoutThemeChromiumMac::paintCapsLockIndicator(LayoutObject*, const PaintIn
fo& paintInfo, const IntRect& r) |
| 721 { | 721 { |
| 722 // This draws the caps lock indicator as it was done by | 722 // This draws the caps lock indicator as it was done by |
| 723 // WKDrawCapsLockIndicator. | 723 // WKDrawCapsLockIndicator. |
| 724 LocalCurrentGraphicsContext localContext(paintInfo.context, r); | 724 LocalCurrentGraphicsContext localContext(paintInfo.context, r); |
| 725 CGContextRef c = localContext.cgContext(); | 725 CGContextRef c = localContext.cgContext(); |
| 726 CGMutablePathRef shape = CGPathCreateMutable(); | 726 CGMutablePathRef shape = CGPathCreateMutable(); |
| 727 | 727 |
| 728 // To draw the caps lock indicator, draw the shape into a small | 728 // To draw the caps lock indicator, draw the shape into a small |
| 729 // square that is then scaled to the size of r. | 729 // square that is then scaled to the size of r. |
| 730 const CGFloat kSquareSize = 17; | 730 const CGFloat kSquareSize = 17; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 | 771 |
| 772 CGContextSetRGBFillColor(c, 0, 0, 0, 0.4); | 772 CGContextSetRGBFillColor(c, 0, 0, 0, 0.4); |
| 773 CGContextBeginPath(c); | 773 CGContextBeginPath(c); |
| 774 CGContextAddPath(c, paintPath); | 774 CGContextAddPath(c, paintPath); |
| 775 CGContextFillPath(c); | 775 CGContextFillPath(c); |
| 776 CGPathRelease(paintPath); | 776 CGPathRelease(paintPath); |
| 777 | 777 |
| 778 return false; | 778 return false; |
| 779 } | 779 } |
| 780 | 780 |
| 781 bool LayoutThemeChromiumMac::paintTextArea(RenderObject* o, const PaintInfo& pai
ntInfo, const IntRect& r) | 781 bool LayoutThemeChromiumMac::paintTextArea(LayoutObject* o, const PaintInfo& pai
ntInfo, const IntRect& r) |
| 782 { | 782 { |
| 783 LocalCurrentGraphicsContext localContext(paintInfo.context, r); | 783 LocalCurrentGraphicsContext localContext(paintInfo.context, r); |
| 784 _NSDrawCarbonThemeListBox(r, isEnabled(o) && !isReadOnlyControl(o), YES, YES
); | 784 _NSDrawCarbonThemeListBox(r, isEnabled(o) && !isReadOnlyControl(o), YES, YES
); |
| 785 return false; | 785 return false; |
| 786 } | 786 } |
| 787 | 787 |
| 788 const int* LayoutThemeChromiumMac::popupButtonMargins() const | 788 const int* LayoutThemeChromiumMac::popupButtonMargins() const |
| 789 { | 789 { |
| 790 static const int margins[3][4] = | 790 static const int margins[3][4] = |
| 791 { | 791 { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 806 { | 806 { |
| 807 static const int padding[3][4] = | 807 static const int padding[3][4] = |
| 808 { | 808 { |
| 809 { 2, 26, 3, 8 }, | 809 { 2, 26, 3, 8 }, |
| 810 { 2, 23, 3, 8 }, | 810 { 2, 23, 3, 8 }, |
| 811 { 2, 22, 3, 10 } | 811 { 2, 22, 3, 10 } |
| 812 }; | 812 }; |
| 813 return padding[size]; | 813 return padding[size]; |
| 814 } | 814 } |
| 815 | 815 |
| 816 bool LayoutThemeChromiumMac::paintMenuList(RenderObject* o, const PaintInfo& pai
ntInfo, const IntRect& r) | 816 bool LayoutThemeChromiumMac::paintMenuList(LayoutObject* o, const PaintInfo& pai
ntInfo, const IntRect& r) |
| 817 { | 817 { |
| 818 setPopupButtonCellState(o, r); | 818 setPopupButtonCellState(o, r); |
| 819 | 819 |
| 820 NSPopUpButtonCell* popupButton = this->popupButton(); | 820 NSPopUpButtonCell* popupButton = this->popupButton(); |
| 821 | 821 |
| 822 float zoomLevel = o->style()->effectiveZoom(); | 822 float zoomLevel = o->style()->effectiveZoom(); |
| 823 IntSize size = popupButtonSizes()[[popupButton controlSize]]; | 823 IntSize size = popupButtonSizes()[[popupButton controlSize]]; |
| 824 size.setHeight(size.height() * zoomLevel); | 824 size.setHeight(size.height() * zoomLevel); |
| 825 size.setWidth(r.width()); | 825 size.setWidth(r.width()); |
| 826 | 826 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 if (NoControlPart == renderMeter->style()->appearance()) | 860 if (NoControlPart == renderMeter->style()->appearance()) |
| 861 return bounds.size(); | 861 return bounds.size(); |
| 862 | 862 |
| 863 NSLevelIndicatorCell* cell = levelIndicatorFor(renderMeter); | 863 NSLevelIndicatorCell* cell = levelIndicatorFor(renderMeter); |
| 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 LayoutThemeChromiumMac::paintMeter(RenderObject* renderObject, const PaintI
nfo& paintInfo, const IntRect& rect) | 870 bool LayoutThemeChromiumMac::paintMeter(LayoutObject* layoutObject, const PaintI
nfo& paintInfo, const IntRect& rect) |
| 871 { | 871 { |
| 872 if (!renderObject->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(renderObject)); | 877 NSLevelIndicatorCell* cell = levelIndicatorFor(toRenderMeter(layoutObject)); |
| 878 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 878 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 879 | 879 |
| 880 [cell drawWithFrame:rect inView:documentViewFor(renderObject)]; | 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 LayoutThemeChromiumMac::supportsMeter(ControlPart part) const | 885 bool LayoutThemeChromiumMac::supportsMeter(ControlPart part) const |
| 886 { | 886 { |
| 887 switch (part) { | 887 switch (part) { |
| 888 case RelevancyLevelIndicatorPart: | 888 case RelevancyLevelIndicatorPart: |
| 889 case DiscreteCapacityLevelIndicatorPart: | 889 case DiscreteCapacityLevelIndicatorPart: |
| 890 case RatingLevelIndicatorPart: | 890 case RatingLevelIndicatorPart: |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 double LayoutThemeChromiumMac::animationRepeatIntervalForProgressBar(RenderProgr
ess*) const | 980 double LayoutThemeChromiumMac::animationRepeatIntervalForProgressBar(RenderProgr
ess*) const |
| 981 { | 981 { |
| 982 return progressAnimationFrameRate; | 982 return progressAnimationFrameRate; |
| 983 } | 983 } |
| 984 | 984 |
| 985 double LayoutThemeChromiumMac::animationDurationForProgressBar(RenderProgress*)
const | 985 double LayoutThemeChromiumMac::animationDurationForProgressBar(RenderProgress*)
const |
| 986 { | 986 { |
| 987 return progressAnimationNumFrames * progressAnimationFrameRate; | 987 return progressAnimationNumFrames * progressAnimationFrameRate; |
| 988 } | 988 } |
| 989 | 989 |
| 990 bool LayoutThemeChromiumMac::paintProgressBar(RenderObject* renderObject, const
PaintInfo& paintInfo, const IntRect& rect) | 990 bool LayoutThemeChromiumMac::paintProgressBar(LayoutObject* layoutObject, const
PaintInfo& paintInfo, const IntRect& rect) |
| 991 { | 991 { |
| 992 if (!renderObject->isProgress()) | 992 if (!layoutObject->isProgress()) |
| 993 return true; | 993 return true; |
| 994 | 994 |
| 995 float zoomLevel = renderObject->style()->effectiveZoom(); | 995 float zoomLevel = layoutObject->style()->effectiveZoom(); |
| 996 int controlSize = controlSizeForFont(renderObject->style()); | 996 int controlSize = controlSizeForFont(layoutObject->style()); |
| 997 IntSize size = progressBarSizes()[controlSize]; | 997 IntSize size = progressBarSizes()[controlSize]; |
| 998 size.setHeight(size.height() * zoomLevel); | 998 size.setHeight(size.height() * zoomLevel); |
| 999 size.setWidth(rect.width()); | 999 size.setWidth(rect.width()); |
| 1000 | 1000 |
| 1001 // Now inflate it to account for the shadow. | 1001 // Now inflate it to account for the shadow. |
| 1002 IntRect inflatedRect = rect; | 1002 IntRect inflatedRect = rect; |
| 1003 if (rect.height() <= minimumProgressBarHeight(renderObject->style())) | 1003 if (rect.height() <= minimumProgressBarHeight(layoutObject->style())) |
| 1004 inflatedRect = ThemeMac::inflateRect(inflatedRect, size, progressBarMarg
ins(controlSize), zoomLevel); | 1004 inflatedRect = ThemeMac::inflateRect(inflatedRect, size, progressBarMarg
ins(controlSize), zoomLevel); |
| 1005 | 1005 |
| 1006 RenderProgress* renderProgress = toRenderProgress(renderObject); | 1006 RenderProgress* renderProgress = toRenderProgress(layoutObject); |
| 1007 HIThemeTrackDrawInfo trackInfo; | 1007 HIThemeTrackDrawInfo trackInfo; |
| 1008 trackInfo.version = 0; | 1008 trackInfo.version = 0; |
| 1009 if (controlSize == NSRegularControlSize) | 1009 if (controlSize == NSRegularControlSize) |
| 1010 trackInfo.kind = renderProgress->position() < 0 ? kThemeLargeIndetermina
teBar : kThemeLargeProgressBar; | 1010 trackInfo.kind = renderProgress->position() < 0 ? kThemeLargeIndetermina
teBar : kThemeLargeProgressBar; |
| 1011 else | 1011 else |
| 1012 trackInfo.kind = renderProgress->position() < 0 ? kThemeMediumIndetermin
ateBar : kThemeMediumProgressBar; | 1012 trackInfo.kind = renderProgress->position() < 0 ? kThemeMediumIndetermin
ateBar : kThemeMediumProgressBar; |
| 1013 | 1013 |
| 1014 trackInfo.bounds = IntRect(IntPoint(), inflatedRect.size()); | 1014 trackInfo.bounds = IntRect(IntPoint(), inflatedRect.size()); |
| 1015 trackInfo.min = 0; | 1015 trackInfo.min = 0; |
| 1016 trackInfo.max = std::numeric_limits<SInt32>::max(); | 1016 trackInfo.max = std::numeric_limits<SInt32>::max(); |
| 1017 trackInfo.value = lround(renderProgress->position() * nextafter(trackInfo.ma
x, 0)); | 1017 trackInfo.value = lround(renderProgress->position() * nextafter(trackInfo.ma
x, 0)); |
| 1018 trackInfo.trackInfo.progress.phase = lround(renderProgress->animationProgres
s() * nextafter(progressAnimationNumFrames, 0)); | 1018 trackInfo.trackInfo.progress.phase = lround(renderProgress->animationProgres
s() * nextafter(progressAnimationNumFrames, 0)); |
| 1019 trackInfo.attributes = kThemeTrackHorizontal; | 1019 trackInfo.attributes = kThemeTrackHorizontal; |
| 1020 trackInfo.enableState = isActive(renderObject) ? kThemeTrackActive : kThemeT
rackInactive; | 1020 trackInfo.enableState = isActive(layoutObject) ? kThemeTrackActive : kThemeT
rackInactive; |
| 1021 trackInfo.reserved = 0; | 1021 trackInfo.reserved = 0; |
| 1022 trackInfo.filler1 = 0; | 1022 trackInfo.filler1 = 0; |
| 1023 | 1023 |
| 1024 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(inflatedRect.size()); | 1024 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(inflatedRect.size()); |
| 1025 if (!imageBuffer) | 1025 if (!imageBuffer) |
| 1026 return true; | 1026 return true; |
| 1027 | 1027 |
| 1028 LocalCurrentGraphicsContext localContext(imageBuffer->context(), IntRect(Int
Point(), inflatedRect.size())); | 1028 LocalCurrentGraphicsContext localContext(imageBuffer->context(), IntRect(Int
Point(), inflatedRect.size())); |
| 1029 CGContextRef cgContext = localContext.cgContext(); | 1029 CGContextRef cgContext = localContext.cgContext(); |
| 1030 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); | 1030 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1046 const float baseArrowWidth = 5.0f; | 1046 const float baseArrowWidth = 5.0f; |
| 1047 const float baseSpaceBetweenArrows = 2.0f; | 1047 const float baseSpaceBetweenArrows = 2.0f; |
| 1048 const int arrowPaddingLeft = 6; | 1048 const int arrowPaddingLeft = 6; |
| 1049 const int arrowPaddingRight = 6; | 1049 const int arrowPaddingRight = 6; |
| 1050 const int paddingBeforeSeparator = 4; | 1050 const int paddingBeforeSeparator = 4; |
| 1051 const int baseBorderRadius = 5; | 1051 const int baseBorderRadius = 5; |
| 1052 const int styledPopupPaddingLeft = 8; | 1052 const int styledPopupPaddingLeft = 8; |
| 1053 const int styledPopupPaddingTop = 1; | 1053 const int styledPopupPaddingTop = 1; |
| 1054 const int styledPopupPaddingBottom = 2; | 1054 const int styledPopupPaddingBottom = 2; |
| 1055 | 1055 |
| 1056 bool LayoutThemeChromiumMac::paintMenuListButton(RenderObject* o, const PaintInf
o& paintInfo, const IntRect& r) | 1056 bool LayoutThemeChromiumMac::paintMenuListButton(LayoutObject* o, const PaintInf
o& paintInfo, const IntRect& r) |
| 1057 { | 1057 { |
| 1058 IntRect bounds = IntRect(r.x() + o->style()->borderLeftWidth(), | 1058 IntRect bounds = IntRect(r.x() + o->style()->borderLeftWidth(), |
| 1059 r.y() + o->style()->borderTopWidth(), | 1059 r.y() + o->style()->borderTopWidth(), |
| 1060 r.width() - o->style()->borderLeftWidth() - o->styl
e()->borderRightWidth(), | 1060 r.width() - o->style()->borderLeftWidth() - o->styl
e()->borderRightWidth(), |
| 1061 r.height() - o->style()->borderTopWidth() - o->styl
e()->borderBottomWidth()); | 1061 r.height() - o->style()->borderTopWidth() - o->styl
e()->borderBottomWidth()); |
| 1062 // Since we actually know the size of the control here, we restrict the font | 1062 // Since we actually know the size of the control here, we restrict the font |
| 1063 // scale to make sure the arrows will fit vertically in the bounds | 1063 // scale to make sure the arrows will fit vertically in the bounds |
| 1064 float fontScale = std::min(o->style()->fontSize() / baseFontSize, bounds.hei
ght() / (baseArrowHeight * 2 + baseSpaceBetweenArrows)); | 1064 float fontScale = std::min(o->style()->fontSize() / baseFontSize, bounds.hei
ght() / (baseArrowHeight * 2 + baseSpaceBetweenArrows)); |
| 1065 float centerY = bounds.y() + bounds.height() / 2.0f; | 1065 float centerY = bounds.y() + bounds.height() / 2.0f; |
| 1066 float arrowHeight = baseArrowHeight * fontScale; | 1066 float arrowHeight = baseArrowHeight * fontScale; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 | 1184 |
| 1185 style->resetPadding(); | 1185 style->resetPadding(); |
| 1186 style->setBorderRadius(IntSize(int(baseBorderRadius + fontScale - 1), int(ba
seBorderRadius + fontScale - 1))); // FIXME: Round up? | 1186 style->setBorderRadius(IntSize(int(baseBorderRadius + fontScale - 1), int(ba
seBorderRadius + fontScale - 1))); // FIXME: Round up? |
| 1187 | 1187 |
| 1188 const int minHeight = 15; | 1188 const int minHeight = 15; |
| 1189 style->setMinHeight(Length(minHeight, Fixed)); | 1189 style->setMinHeight(Length(minHeight, Fixed)); |
| 1190 | 1190 |
| 1191 style->setLineHeight(RenderStyle::initialLineHeight()); | 1191 style->setLineHeight(RenderStyle::initialLineHeight()); |
| 1192 } | 1192 } |
| 1193 | 1193 |
| 1194 void LayoutThemeChromiumMac::setPopupButtonCellState(const RenderObject* o, cons
t IntRect& r) | 1194 void LayoutThemeChromiumMac::setPopupButtonCellState(const LayoutObject* o, cons
t IntRect& r) |
| 1195 { | 1195 { |
| 1196 NSPopUpButtonCell* popupButton = this->popupButton(); | 1196 NSPopUpButtonCell* popupButton = this->popupButton(); |
| 1197 | 1197 |
| 1198 // Set the control size based off the rectangle we're painting into. | 1198 // Set the control size based off the rectangle we're painting into. |
| 1199 setControlSize(popupButton, popupButtonSizes(), r.size(), o->style()->effect
iveZoom()); | 1199 setControlSize(popupButton, popupButtonSizes(), r.size(), o->style()->effect
iveZoom()); |
| 1200 | 1200 |
| 1201 // Update the various states we respond to. | 1201 // Update the various states we respond to. |
| 1202 updateActiveState(popupButton, o); | 1202 updateActiveState(popupButton, o); |
| 1203 updateCheckedState(popupButton, o); | 1203 updateCheckedState(popupButton, o); |
| 1204 updateEnabledState(popupButton, o); | 1204 updateEnabledState(popupButton, o); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 int LayoutThemeChromiumMac::minimumMenuListSize(RenderStyle* style) const | 1217 int LayoutThemeChromiumMac::minimumMenuListSize(RenderStyle* style) const |
| 1218 { | 1218 { |
| 1219 return sizeForSystemFont(style, menuListSizes()).width(); | 1219 return sizeForSystemFont(style, menuListSizes()).width(); |
| 1220 } | 1220 } |
| 1221 | 1221 |
| 1222 const int sliderTrackWidth = 5; | 1222 const int sliderTrackWidth = 5; |
| 1223 const int sliderTrackBorderWidth = 1; | 1223 const int sliderTrackBorderWidth = 1; |
| 1224 | 1224 |
| 1225 bool LayoutThemeChromiumMac::paintSliderTrack(RenderObject* o, const PaintInfo&
paintInfo, const IntRect& r) | 1225 bool LayoutThemeChromiumMac::paintSliderTrack(LayoutObject* o, const PaintInfo&
paintInfo, const IntRect& r) |
| 1226 { | 1226 { |
| 1227 paintSliderTicks(o, paintInfo, r); | 1227 paintSliderTicks(o, paintInfo, r); |
| 1228 | 1228 |
| 1229 float zoomLevel = o->style()->effectiveZoom(); | 1229 float zoomLevel = o->style()->effectiveZoom(); |
| 1230 FloatRect unzoomedRect = r; | 1230 FloatRect unzoomedRect = r; |
| 1231 | 1231 |
| 1232 if (o->style()->appearance() == SliderHorizontalPart || o->style()->appeara
nce() == MediaSliderPart) { | 1232 if (o->style()->appearance() == SliderHorizontalPart || o->style()->appeara
nce() == MediaSliderPart) { |
| 1233 unzoomedRect.setY(ceilf(unzoomedRect.y() + unzoomedRect.height() / 2 - z
oomLevel * sliderTrackWidth / 2)); | 1233 unzoomedRect.setY(ceilf(unzoomedRect.y() + unzoomedRect.height() / 2 - z
oomLevel * sliderTrackWidth / 2)); |
| 1234 unzoomedRect.setHeight(zoomLevel * sliderTrackWidth); | 1234 unzoomedRect.setHeight(zoomLevel * sliderTrackWidth); |
| 1235 } else if (o->style()->appearance() == SliderVerticalPart) { | 1235 } else if (o->style()->appearance() == SliderVerticalPart) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 paintInfo.context->setStrokeGradient(borderGradient); | 1295 paintInfo.context->setStrokeGradient(borderGradient); |
| 1296 paintInfo.context->setStrokeThickness(sliderTrackBorderWidth); | 1296 paintInfo.context->setStrokeThickness(sliderTrackBorderWidth); |
| 1297 paintInfo.context->strokePath(borderPath); | 1297 paintInfo.context->strokePath(borderPath); |
| 1298 return false; | 1298 return false; |
| 1299 } | 1299 } |
| 1300 | 1300 |
| 1301 const int sliderThumbWidth = 15; | 1301 const int sliderThumbWidth = 15; |
| 1302 const int sliderThumbHeight = 15; | 1302 const int sliderThumbHeight = 15; |
| 1303 const int sliderThumbBorderWidth = 1; | 1303 const int sliderThumbBorderWidth = 1; |
| 1304 | 1304 |
| 1305 bool LayoutThemeChromiumMac::paintSliderThumb(RenderObject* o, const PaintInfo&
paintInfo, const IntRect& r) | 1305 bool LayoutThemeChromiumMac::paintSliderThumb(LayoutObject* o, const PaintInfo&
paintInfo, const IntRect& r) |
| 1306 { | 1306 { |
| 1307 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1307 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 1308 float zoomLevel = o->style()->effectiveZoom(); | 1308 float zoomLevel = o->style()->effectiveZoom(); |
| 1309 | 1309 |
| 1310 FloatRect unzoomedRect(r.x(), r.y(), sliderThumbWidth, sliderThumbHeight); | 1310 FloatRect unzoomedRect(r.x(), r.y(), sliderThumbWidth, sliderThumbHeight); |
| 1311 if (zoomLevel != 1.0f) { | 1311 if (zoomLevel != 1.0f) { |
| 1312 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 1312 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
| 1313 paintInfo.context->scale(zoomLevel, zoomLevel); | 1313 paintInfo.context->scale(zoomLevel, zoomLevel); |
| 1314 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 1314 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
| 1315 } | 1315 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 | 1370 |
| 1371 if (isFocused(o)) { | 1371 if (isFocused(o)) { |
| 1372 Path borderPath; | 1372 Path borderPath; |
| 1373 borderPath.addEllipse(borderBounds); | 1373 borderPath.addEllipse(borderBounds); |
| 1374 paintInfo.context->drawFocusRing(borderPath, 5, -2, focusRingColor()); | 1374 paintInfo.context->drawFocusRing(borderPath, 5, -2, focusRingColor()); |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 return false; | 1377 return false; |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 bool LayoutThemeChromiumMac::paintSearchField(RenderObject* o, const PaintInfo&
paintInfo, const IntRect& r) | 1380 bool LayoutThemeChromiumMac::paintSearchField(LayoutObject* o, const PaintInfo&
paintInfo, const IntRect& r) |
| 1381 { | 1381 { |
| 1382 LocalCurrentGraphicsContext localContext(paintInfo.context, r); | 1382 LocalCurrentGraphicsContext localContext(paintInfo.context, r); |
| 1383 | 1383 |
| 1384 NSSearchFieldCell* search = this->search(); | 1384 NSSearchFieldCell* search = this->search(); |
| 1385 setSearchCellState(o, r); | 1385 setSearchCellState(o, r); |
| 1386 [search setControlSize:searchFieldControlSizeForFont(o->style())]; | 1386 [search setControlSize:searchFieldControlSizeForFont(o->style())]; |
| 1387 | 1387 |
| 1388 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1388 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 1389 | 1389 |
| 1390 float zoomLevel = o->style()->effectiveZoom(); | 1390 float zoomLevel = o->style()->effectiveZoom(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1404 [search setSearchButtonCell:nil]; | 1404 [search setSearchButtonCell:nil]; |
| 1405 | 1405 |
| 1406 [search drawWithFrame:NSRect(unzoomedRect) inView:documentViewFor(o)]; | 1406 [search drawWithFrame:NSRect(unzoomedRect) inView:documentViewFor(o)]; |
| 1407 | 1407 |
| 1408 [search setControlView:nil]; | 1408 [search setControlView:nil]; |
| 1409 [search resetSearchButtonCell]; | 1409 [search resetSearchButtonCell]; |
| 1410 | 1410 |
| 1411 return false; | 1411 return false; |
| 1412 } | 1412 } |
| 1413 | 1413 |
| 1414 void LayoutThemeChromiumMac::setSearchCellState(RenderObject* o, const IntRect&) | 1414 void LayoutThemeChromiumMac::setSearchCellState(LayoutObject* o, const IntRect&) |
| 1415 { | 1415 { |
| 1416 NSSearchFieldCell* search = this->search(); | 1416 NSSearchFieldCell* search = this->search(); |
| 1417 | 1417 |
| 1418 // Update the various states we respond to. | 1418 // Update the various states we respond to. |
| 1419 updateActiveState(search, o); | 1419 updateActiveState(search, o); |
| 1420 updateEnabledState(search, o); | 1420 updateEnabledState(search, o); |
| 1421 updateFocusedState(search, o); | 1421 updateFocusedState(search, o); |
| 1422 } | 1422 } |
| 1423 | 1423 |
| 1424 const IntSize* LayoutThemeChromiumMac::searchFieldSizes() const | 1424 const IntSize* LayoutThemeChromiumMac::searchFieldSizes() const |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 style->setPaddingLeft(Length(horizontalPadding, Fixed)); | 1470 style->setPaddingLeft(Length(horizontalPadding, Fixed)); |
| 1471 style->setPaddingRight(Length(horizontalPadding, Fixed)); | 1471 style->setPaddingRight(Length(horizontalPadding, Fixed)); |
| 1472 style->setPaddingTop(Length(verticalPadding, Fixed)); | 1472 style->setPaddingTop(Length(verticalPadding, Fixed)); |
| 1473 style->setPaddingBottom(Length(verticalPadding, Fixed)); | 1473 style->setPaddingBottom(Length(verticalPadding, Fixed)); |
| 1474 | 1474 |
| 1475 setFontFromControlSize(style, controlSize); | 1475 setFontFromControlSize(style, controlSize); |
| 1476 | 1476 |
| 1477 style->setBoxShadow(nullptr); | 1477 style->setBoxShadow(nullptr); |
| 1478 } | 1478 } |
| 1479 | 1479 |
| 1480 bool LayoutThemeChromiumMac::paintSearchFieldCancelButton(RenderObject* o, const
PaintInfo& paintInfo, const IntRect& r) | 1480 bool LayoutThemeChromiumMac::paintSearchFieldCancelButton(LayoutObject* o, const
PaintInfo& paintInfo, const IntRect& r) |
| 1481 { | 1481 { |
| 1482 if (!o->node()) | 1482 if (!o->node()) |
| 1483 return false; | 1483 return false; |
| 1484 Element* input = o->node()->shadowHost(); | 1484 Element* input = o->node()->shadowHost(); |
| 1485 if (!input) | 1485 if (!input) |
| 1486 input = toElement(o->node()); | 1486 input = toElement(o->node()); |
| 1487 | 1487 |
| 1488 if (!input->renderer()->isBox()) | 1488 if (!input->renderer()->isBox()) |
| 1489 return false; | 1489 return false; |
| 1490 | 1490 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 void LayoutThemeChromiumMac::adjustSearchFieldDecorationStyle(RenderStyle* style
, Element*) const | 1557 void LayoutThemeChromiumMac::adjustSearchFieldDecorationStyle(RenderStyle* style
, Element*) const |
| 1558 { | 1558 { |
| 1559 NSControlSize controlSize = controlSizeForSystemFont(style); | 1559 NSControlSize controlSize = controlSizeForSystemFont(style); |
| 1560 IntSize searchFieldSize = searchFieldSizes()[controlSize]; | 1560 IntSize searchFieldSize = searchFieldSizes()[controlSize]; |
| 1561 int width = searchFieldSize.height() / 2 - searchFieldBorderWidth - searchFi
eldHorizontalPaddings()[controlSize]; | 1561 int width = searchFieldSize.height() / 2 - searchFieldBorderWidth - searchFi
eldHorizontalPaddings()[controlSize]; |
| 1562 style->setWidth(Length(width, Fixed)); | 1562 style->setWidth(Length(width, Fixed)); |
| 1563 style->setHeight(Length(0, Fixed)); | 1563 style->setHeight(Length(0, Fixed)); |
| 1564 style->setBoxShadow(nullptr); | 1564 style->setBoxShadow(nullptr); |
| 1565 } | 1565 } |
| 1566 | 1566 |
| 1567 bool LayoutThemeChromiumMac::paintSearchFieldDecoration(RenderObject*, const Pai
ntInfo&, const IntRect&) | 1567 bool LayoutThemeChromiumMac::paintSearchFieldDecoration(LayoutObject*, const Pai
ntInfo&, const IntRect&) |
| 1568 { | 1568 { |
| 1569 return false; | 1569 return false; |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 void LayoutThemeChromiumMac::adjustSearchFieldResultsDecorationStyle(RenderStyle
* style, Element*) const | 1572 void LayoutThemeChromiumMac::adjustSearchFieldResultsDecorationStyle(RenderStyle
* style, Element*) const |
| 1573 { | 1573 { |
| 1574 IntSize size = sizeForSystemFont(style, resultsButtonSizes()); | 1574 IntSize size = sizeForSystemFont(style, resultsButtonSizes()); |
| 1575 style->setWidth(Length(size.width(), Fixed)); | 1575 style->setWidth(Length(size.width(), Fixed)); |
| 1576 style->setHeight(Length(size.height(), Fixed)); | 1576 style->setHeight(Length(size.height(), Fixed)); |
| 1577 style->setBoxShadow(nullptr); | 1577 style->setBoxShadow(nullptr); |
| 1578 } | 1578 } |
| 1579 | 1579 |
| 1580 bool LayoutThemeChromiumMac::paintSearchFieldResultsDecoration(RenderObject* o,
const PaintInfo& paintInfo, const IntRect& r) | 1580 bool LayoutThemeChromiumMac::paintSearchFieldResultsDecoration(LayoutObject* o,
const PaintInfo& paintInfo, const IntRect& r) |
| 1581 { | 1581 { |
| 1582 if (!o->node()) | 1582 if (!o->node()) |
| 1583 return false; | 1583 return false; |
| 1584 Node* input = o->node()->shadowHost(); | 1584 Node* input = o->node()->shadowHost(); |
| 1585 if (!input) | 1585 if (!input) |
| 1586 input = o->node(); | 1586 input = o->node(); |
| 1587 if (!input->renderer()->isBox()) | 1587 if (!input->renderer()->isBox()) |
| 1588 return false; | 1588 return false; |
| 1589 | 1589 |
| 1590 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1590 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 PassRefPtr<LayoutTheme> LayoutThemeChromiumMac::create() | 1727 PassRefPtr<LayoutTheme> LayoutThemeChromiumMac::create() |
| 1728 { | 1728 { |
| 1729 return adoptRef(new LayoutThemeChromiumMac); | 1729 return adoptRef(new LayoutThemeChromiumMac); |
| 1730 } | 1730 } |
| 1731 | 1731 |
| 1732 bool LayoutThemeChromiumMac::usesTestModeFocusRingColor() const | 1732 bool LayoutThemeChromiumMac::usesTestModeFocusRingColor() const |
| 1733 { | 1733 { |
| 1734 return LayoutTestSupport::isRunningLayoutTest(); | 1734 return LayoutTestSupport::isRunningLayoutTest(); |
| 1735 } | 1735 } |
| 1736 | 1736 |
| 1737 NSView* LayoutThemeChromiumMac::documentViewFor(RenderObject*) const | 1737 NSView* LayoutThemeChromiumMac::documentViewFor(LayoutObject*) const |
| 1738 { | 1738 { |
| 1739 return FlippedView(); | 1739 return FlippedView(); |
| 1740 } | 1740 } |
| 1741 | 1741 |
| 1742 // Updates the control tint (a.k.a. active state) of |cell| (from |o|). In the | 1742 // Updates the control tint (a.k.a. active state) of |cell| (from |o|). In the |
| 1743 // Chromium port, the renderer runs as a background process and controls' | 1743 // Chromium port, the renderer runs as a background process and controls' |
| 1744 // NSCell(s) lack a parent NSView. Therefore controls don't have their tint | 1744 // NSCell(s) lack a parent NSView. Therefore controls don't have their tint |
| 1745 // color updated correctly when the application is activated/deactivated. | 1745 // color updated correctly when the application is activated/deactivated. |
| 1746 // FocusController's setActive() is called when the application is | 1746 // FocusController's setActive() is called when the application is |
| 1747 // activated/deactivated, which causes a paint invalidation at which time this | 1747 // activated/deactivated, which causes a paint invalidation at which time this |
| 1748 // code is called. | 1748 // code is called. |
| 1749 // This function should be called before drawing any NSCell-derived controls, | 1749 // This function should be called before drawing any NSCell-derived controls, |
| 1750 // unless you're sure it isn't needed. | 1750 // unless you're sure it isn't needed. |
| 1751 void LayoutThemeChromiumMac::updateActiveState(NSCell* cell, const RenderObject*
o) | 1751 void LayoutThemeChromiumMac::updateActiveState(NSCell* cell, const LayoutObject*
o) |
| 1752 { | 1752 { |
| 1753 NSControlTint oldTint = [cell controlTint]; | 1753 NSControlTint oldTint = [cell controlTint]; |
| 1754 NSControlTint tint = isActive(o) ? [NSColor currentControlTint] : | 1754 NSControlTint tint = isActive(o) ? [NSColor currentControlTint] : |
| 1755 static_cast<NSControlTint>(NSClearControl
Tint); | 1755 static_cast<NSControlTint>(NSClearControl
Tint); |
| 1756 | 1756 |
| 1757 if (tint != oldTint) | 1757 if (tint != oldTint) |
| 1758 [cell setControlTint:tint]; | 1758 [cell setControlTint:tint]; |
| 1759 } | 1759 } |
| 1760 | 1760 |
| 1761 bool LayoutThemeChromiumMac::shouldShowPlaceholderWhenFocused() const | 1761 bool LayoutThemeChromiumMac::shouldShowPlaceholderWhenFocused() const |
| 1762 { | 1762 { |
| 1763 return true; | 1763 return true; |
| 1764 } | 1764 } |
| 1765 | 1765 |
| 1766 void LayoutThemeChromiumMac::adjustMediaSliderThumbSize(RenderStyle* style) cons
t | 1766 void LayoutThemeChromiumMac::adjustMediaSliderThumbSize(RenderStyle* style) cons
t |
| 1767 { | 1767 { |
| 1768 RenderMediaControls::adjustMediaSliderThumbSize(style); | 1768 RenderMediaControls::adjustMediaSliderThumbSize(style); |
| 1769 } | 1769 } |
| 1770 | 1770 |
| 1771 bool LayoutThemeChromiumMac::paintMediaPlayButton(RenderObject* object, const Pa
intInfo& paintInfo, const IntRect& rect) | 1771 bool LayoutThemeChromiumMac::paintMediaPlayButton(LayoutObject* object, const Pa
intInfo& paintInfo, const IntRect& rect) |
| 1772 { | 1772 { |
| 1773 return RenderMediaControls::paintMediaControlsPart(MediaPlayButton, object,
paintInfo, rect); | 1773 return RenderMediaControls::paintMediaControlsPart(MediaPlayButton, object,
paintInfo, rect); |
| 1774 } | 1774 } |
| 1775 | 1775 |
| 1776 bool LayoutThemeChromiumMac::paintMediaOverlayPlayButton(RenderObject* object, c
onst PaintInfo& paintInfo, const IntRect& rect) | 1776 bool LayoutThemeChromiumMac::paintMediaOverlayPlayButton(LayoutObject* object, c
onst PaintInfo& paintInfo, const IntRect& rect) |
| 1777 { | 1777 { |
| 1778 return RenderMediaControls::paintMediaControlsPart(MediaOverlayPlayButton, o
bject, paintInfo, rect); | 1778 return RenderMediaControls::paintMediaControlsPart(MediaOverlayPlayButton, o
bject, paintInfo, rect); |
| 1779 } | 1779 } |
| 1780 | 1780 |
| 1781 bool LayoutThemeChromiumMac::paintMediaMuteButton(RenderObject* object, const Pa
intInfo& paintInfo, const IntRect& rect) | 1781 bool LayoutThemeChromiumMac::paintMediaMuteButton(LayoutObject* object, const Pa
intInfo& paintInfo, const IntRect& rect) |
| 1782 { | 1782 { |
| 1783 return RenderMediaControls::paintMediaControlsPart(MediaMuteButton, object,
paintInfo, rect); | 1783 return RenderMediaControls::paintMediaControlsPart(MediaMuteButton, object,
paintInfo, rect); |
| 1784 } | 1784 } |
| 1785 | 1785 |
| 1786 bool LayoutThemeChromiumMac::paintMediaSliderTrack(RenderObject* object, const P
aintInfo& paintInfo, const IntRect& rect) | 1786 bool LayoutThemeChromiumMac::paintMediaSliderTrack(LayoutObject* object, const P
aintInfo& paintInfo, const IntRect& rect) |
| 1787 { | 1787 { |
| 1788 return RenderMediaControls::paintMediaControlsPart(MediaSlider, object, pain
tInfo, rect); | 1788 return RenderMediaControls::paintMediaControlsPart(MediaSlider, object, pain
tInfo, rect); |
| 1789 } | 1789 } |
| 1790 | 1790 |
| 1791 String LayoutThemeChromiumMac::extraFullScreenStyleSheet() | 1791 String LayoutThemeChromiumMac::extraFullScreenStyleSheet() |
| 1792 { | 1792 { |
| 1793 // FIXME: Chromium may wish to style its default media controls differently
in fullscreen. | 1793 // FIXME: Chromium may wish to style its default media controls differently
in fullscreen. |
| 1794 return String(); | 1794 return String(); |
| 1795 } | 1795 } |
| 1796 | 1796 |
| 1797 String LayoutThemeChromiumMac::extraDefaultStyleSheet() | 1797 String LayoutThemeChromiumMac::extraDefaultStyleSheet() |
| 1798 { | 1798 { |
| 1799 return LayoutTheme::extraDefaultStyleSheet() + | 1799 return LayoutTheme::extraDefaultStyleSheet() + |
| 1800 loadResourceAsASCIIString("themeChromium.css") + | 1800 loadResourceAsASCIIString("themeChromium.css") + |
| 1801 loadResourceAsASCIIString("themeInputMultipleFields.css") + | 1801 loadResourceAsASCIIString("themeInputMultipleFields.css") + |
| 1802 loadResourceAsASCIIString("themeMac.css"); | 1802 loadResourceAsASCIIString("themeMac.css"); |
| 1803 } | 1803 } |
| 1804 | 1804 |
| 1805 bool LayoutThemeChromiumMac::paintMediaVolumeSliderContainer(RenderObject* objec
t, const PaintInfo& paintInfo, const IntRect& rect) | 1805 bool LayoutThemeChromiumMac::paintMediaVolumeSliderContainer(LayoutObject* objec
t, const PaintInfo& paintInfo, const IntRect& rect) |
| 1806 { | 1806 { |
| 1807 return true; | 1807 return true; |
| 1808 } | 1808 } |
| 1809 | 1809 |
| 1810 bool LayoutThemeChromiumMac::paintMediaVolumeSliderTrack(RenderObject* object, c
onst PaintInfo& paintInfo, const IntRect& rect) | 1810 bool LayoutThemeChromiumMac::paintMediaVolumeSliderTrack(LayoutObject* object, c
onst PaintInfo& paintInfo, const IntRect& rect) |
| 1811 { | 1811 { |
| 1812 return RenderMediaControls::paintMediaControlsPart(MediaVolumeSlider, object
, paintInfo, rect); | 1812 return RenderMediaControls::paintMediaControlsPart(MediaVolumeSlider, object
, paintInfo, rect); |
| 1813 } | 1813 } |
| 1814 | 1814 |
| 1815 bool LayoutThemeChromiumMac::paintMediaVolumeSliderThumb(RenderObject* object, c
onst PaintInfo& paintInfo, const IntRect& rect) | 1815 bool LayoutThemeChromiumMac::paintMediaVolumeSliderThumb(LayoutObject* object, c
onst PaintInfo& paintInfo, const IntRect& rect) |
| 1816 { | 1816 { |
| 1817 return RenderMediaControls::paintMediaControlsPart(MediaVolumeSliderThumb, o
bject, paintInfo, rect); | 1817 return RenderMediaControls::paintMediaControlsPart(MediaVolumeSliderThumb, o
bject, paintInfo, rect); |
| 1818 } | 1818 } |
| 1819 | 1819 |
| 1820 bool LayoutThemeChromiumMac::paintMediaSliderThumb(RenderObject* object, const P
aintInfo& paintInfo, const IntRect& rect) | 1820 bool LayoutThemeChromiumMac::paintMediaSliderThumb(LayoutObject* object, const P
aintInfo& paintInfo, const IntRect& rect) |
| 1821 { | 1821 { |
| 1822 return RenderMediaControls::paintMediaControlsPart(MediaSliderThumb, object,
paintInfo, rect); | 1822 return RenderMediaControls::paintMediaControlsPart(MediaSliderThumb, object,
paintInfo, rect); |
| 1823 } | 1823 } |
| 1824 | 1824 |
| 1825 String LayoutThemeChromiumMac::formatMediaControlsTime(float time) const | 1825 String LayoutThemeChromiumMac::formatMediaControlsTime(float time) const |
| 1826 { | 1826 { |
| 1827 return RenderMediaControls::formatMediaControlsTime(time); | 1827 return RenderMediaControls::formatMediaControlsTime(time); |
| 1828 } | 1828 } |
| 1829 | 1829 |
| 1830 String LayoutThemeChromiumMac::formatMediaControlsCurrentTime(float currentTime,
float duration) const | 1830 String LayoutThemeChromiumMac::formatMediaControlsCurrentTime(float currentTime,
float duration) const |
| 1831 { | 1831 { |
| 1832 return RenderMediaControls::formatMediaControlsCurrentTime(currentTime, dura
tion); | 1832 return RenderMediaControls::formatMediaControlsCurrentTime(currentTime, dura
tion); |
| 1833 } | 1833 } |
| 1834 | 1834 |
| 1835 bool LayoutThemeChromiumMac::paintMediaFullscreenButton(RenderObject* object, co
nst PaintInfo& paintInfo, const IntRect& rect) | 1835 bool LayoutThemeChromiumMac::paintMediaFullscreenButton(LayoutObject* object, co
nst PaintInfo& paintInfo, const IntRect& rect) |
| 1836 { | 1836 { |
| 1837 return RenderMediaControls::paintMediaControlsPart(MediaEnterFullscreenButto
n, object, paintInfo, rect); | 1837 return RenderMediaControls::paintMediaControlsPart(MediaEnterFullscreenButto
n, object, paintInfo, rect); |
| 1838 } | 1838 } |
| 1839 | 1839 |
| 1840 bool LayoutThemeChromiumMac::paintMediaToggleClosedCaptionsButton(RenderObject*
object, const PaintInfo& paintInfo, const IntRect& rect) | 1840 bool LayoutThemeChromiumMac::paintMediaToggleClosedCaptionsButton(LayoutObject*
object, const PaintInfo& paintInfo, const IntRect& rect) |
| 1841 { | 1841 { |
| 1842 return RenderMediaControls::paintMediaControlsPart(MediaShowClosedCaptionsBu
tton, object, paintInfo, rect); | 1842 return RenderMediaControls::paintMediaControlsPart(MediaShowClosedCaptionsBu
tton, object, paintInfo, rect); |
| 1843 } | 1843 } |
| 1844 | 1844 |
| 1845 bool LayoutThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* style) const | 1845 bool LayoutThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* 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 |