Chromium Code Reviews| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 } | 462 } |
| 463 | 463 |
| 464 if (needsFallback) | 464 if (needsFallback) |
| 465 color = LayoutTheme::systemColor(cssValueId); | 465 color = LayoutTheme::systemColor(cssValueId); |
| 466 | 466 |
| 467 m_systemColorCache.set(cssValueId, color.rgb()); | 467 m_systemColorCache.set(cssValueId, color.rgb()); |
| 468 | 468 |
| 469 return color; | 469 return color; |
| 470 } | 470 } |
| 471 | 471 |
| 472 bool LayoutThemeChromiumMac::isControlStyled(const RenderStyle* style, const Cac hedUAStyle* uaStyle) const | 472 bool LayoutThemeChromiumMac::isControlStyled(const RenderStyle& style, const Cac hedUAStyle* uaStyle) const |
|
dsinclair
2015/02/04 21:59:29
Reference for uaStyle?
| |
| 473 { | 473 { |
| 474 ASSERT(uaStyle); | 474 ASSERT(uaStyle); |
| 475 if (style->appearance() == TextFieldPart || style->appearance() == TextAreaP art) | 475 if (style.appearance() == TextFieldPart || style.appearance() == TextAreaPar t) |
| 476 return style->border() != uaStyle->border || style->boxShadow(); | 476 return style.border() != uastyle.border || style.boxShadow(); |
|
dsinclair
2015/02/04 21:59:29
uastyle should be uaStyle and this should still be
| |
| 477 | 477 |
| 478 // FIXME: This is horrible, but there is not much else that can be done. | 478 // FIXME: This is horrible, but there is not much else that can be done. |
| 479 // Menu lists cannot draw properly when scaled. They can't really draw | 479 // Menu lists cannot draw properly when scaled. They can't really draw |
| 480 // properly when transformed either. We can't detect the transform case at | 480 // properly when transformed either. We can't detect the transform case at |
| 481 // style adjustment time so that will just have to stay broken. We can | 481 // style adjustment time so that will just have to stay broken. We can |
| 482 // however detect that we're zooming. If zooming is in effect we treat it | 482 // however detect that we're zooming. If zooming is in effect we treat it |
| 483 // like the control is styled. | 483 // like the control is styled. |
| 484 if (style->appearance() == MenulistPart && style->effectiveZoom() != 1.0f) | 484 if (style.appearance() == MenulistPart && style.effectiveZoom() != 1.0f) |
| 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 RenderObject* o, IntRect& r) |
| 496 { | 496 { |
| 497 ControlPart part = o->style()->appearance(); | 497 ControlPart part = o->style()->appearance(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 } | 578 } |
| 579 | 579 |
| 580 void LayoutThemeChromiumMac::updatePressedState(NSCell* cell, const RenderObject * o) | 580 void LayoutThemeChromiumMac::updatePressedState(NSCell* cell, const RenderObject * 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 |
|
dsinclair
2015/02/04 21:59:29
Looks like RenderStyle can be const here?
Julien - ping for review
2015/02/04 22:32:18
Done.
| |
| 589 { | 589 { |
| 590 int fontSize = style->fontSize(); | 590 int fontSize = style.fontSize(); |
| 591 if (fontSize >= 16) | 591 if (fontSize >= 16) |
| 592 return NSRegularControlSize; | 592 return NSRegularControlSize; |
| 593 if (fontSize >= 11) | 593 if (fontSize >= 11) |
| 594 return NSSmallControlSize; | 594 return NSSmallControlSize; |
| 595 return NSMiniControlSize; | 595 return NSMiniControlSize; |
| 596 } | 596 } |
| 597 | 597 |
| 598 // We don't use controlSizeForFont() for search field decorations because it | 598 // We don't use controlSizeForFont() for search field decorations because it |
| 599 // needs to fit into the search field. The font size will already be modified by | 599 // needs to fit into the search field. The font size will already be modified by |
| 600 // setFontFromControlSize() called on the search field. | 600 // setFontFromControlSize() called on the search field. |
| 601 static NSControlSize searchFieldControlSizeForFont(RenderStyle* style) | 601 static NSControlSize searchFieldControlSizeForFont(RenderStyle& style) |
|
dsinclair
2015/02/04 21:59:29
const RenderStyle?
Julien - ping for review
2015/02/04 22:32:18
Done.
| |
| 602 { | 602 { |
| 603 int fontSize = style->fontSize(); | 603 int fontSize = style.fontSize(); |
| 604 if (fontSize >= 13) | 604 if (fontSize >= 13) |
| 605 return NSRegularControlSize; | 605 return NSRegularControlSize; |
| 606 if (fontSize >= 11) | 606 if (fontSize >= 11) |
| 607 return NSSmallControlSize; | 607 return NSSmallControlSize; |
| 608 return NSMiniControlSize; | 608 return NSMiniControlSize; |
| 609 } | 609 } |
| 610 | 610 |
| 611 void LayoutThemeChromiumMac::setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minSize, float zoomLevel) | 611 void LayoutThemeChromiumMac::setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minSize, float zoomLevel) |
| 612 { | 612 { |
| 613 NSControlSize size; | 613 NSControlSize size; |
| 614 if (minSize.width() >= static_cast<int>(sizes[NSRegularControlSize].width() * zoomLevel) && | 614 if (minSize.width() >= static_cast<int>(sizes[NSRegularControlSize].width() * zoomLevel) && |
| 615 minSize.height() >= static_cast<int>(sizes[NSRegularControlSize].height( ) * zoomLevel)) | 615 minSize.height() >= static_cast<int>(sizes[NSRegularControlSize].height( ) * zoomLevel)) |
| 616 size = NSRegularControlSize; | 616 size = NSRegularControlSize; |
| 617 else if (minSize.width() >= static_cast<int>(sizes[NSSmallControlSize].width () * zoomLevel) && | 617 else if (minSize.width() >= static_cast<int>(sizes[NSSmallControlSize].width () * zoomLevel) && |
| 618 minSize.height() >= static_cast<int>(sizes[NSSmallControlSize].heig ht() * zoomLevel)) | 618 minSize.height() >= static_cast<int>(sizes[NSSmallControlSize].heig ht() * zoomLevel)) |
| 619 size = NSSmallControlSize; | 619 size = NSSmallControlSize; |
| 620 else | 620 else |
| 621 size = NSMiniControlSize; | 621 size = NSMiniControlSize; |
| 622 // Only update if we have to, since AppKit does work even if the size is the | 622 // Only update if we have to, since AppKit does work even if the size is the |
| 623 // same. | 623 // same. |
| 624 if (size != [cell controlSize]) | 624 if (size != [cell controlSize]) |
| 625 [cell setControlSize:size]; | 625 [cell setControlSize:size]; |
| 626 } | 626 } |
| 627 | 627 |
| 628 IntSize LayoutThemeChromiumMac::sizeForFont(RenderStyle* style, const IntSize* s izes) const | 628 IntSize LayoutThemeChromiumMac::sizeForFont(const RenderStyle& style, const IntS ize* sizes) const |
|
dsinclair
2015/02/04 21:59:29
Can sizes be a ref? We access without checking if
Julien - ping for review
2015/02/04 22:32:18
|sizes| is an array of IntSize so we can't remove
| |
| 629 { | 629 { |
| 630 if (style->effectiveZoom() != 1.0f) { | 630 if (style.effectiveZoom() != 1.0f) { |
| 631 IntSize result = sizes[controlSizeForFont(style)]; | 631 IntSize result = sizes[controlSizeForFont(style)]; |
| 632 return IntSize(result.width() * style->effectiveZoom(), result.height() * style->effectiveZoom()); | 632 return IntSize(result.width() * style.effectiveZoom(), result.height() * style.effectiveZoom()); |
| 633 } | 633 } |
| 634 return sizes[controlSizeForFont(style)]; | 634 return sizes[controlSizeForFont(style)]; |
| 635 } | 635 } |
| 636 | 636 |
| 637 IntSize LayoutThemeChromiumMac::sizeForSystemFont(RenderStyle* style, const IntS ize* sizes) const | 637 IntSize LayoutThemeChromiumMac::sizeForSystemFont(const RenderStyle& style, cons t IntSize* sizes) const |
|
dsinclair
2015/02/04 21:59:29
sizes as ref?
Julien - ping for review
2015/02/04 22:32:18
Ditto.
| |
| 638 { | 638 { |
| 639 if (style->effectiveZoom() != 1.0f) { | 639 if (style.effectiveZoom() != 1.0f) { |
| 640 IntSize result = sizes[controlSizeForSystemFont(style)]; | 640 IntSize result = sizes[controlSizeForSystemFont(style)]; |
| 641 return IntSize(result.width() * style->effectiveZoom(), result.height() * style->effectiveZoom()); | 641 return IntSize(result.width() * style.effectiveZoom(), result.height() * style.effectiveZoom()); |
| 642 } | 642 } |
| 643 return sizes[controlSizeForSystemFont(style)]; | 643 return sizes[controlSizeForSystemFont(style)]; |
| 644 } | 644 } |
| 645 | 645 |
| 646 void LayoutThemeChromiumMac::setSizeFromFont(RenderStyle* style, const IntSize* sizes) const | 646 void LayoutThemeChromiumMac::setSizeFromFont(RenderStyle& style, const IntSize* sizes) const |
| 647 { | 647 { |
| 648 // FIXME: Check is flawed, since it doesn't take min-width/max-width into | 648 // FIXME: Check is flawed, since it doesn't take min-width/max-width into |
| 649 // account. | 649 // account. |
| 650 IntSize size = sizeForFont(style, sizes); | 650 IntSize size = sizeForFont(style, sizes); |
| 651 if (style->width().isIntrinsicOrAuto() && size.width() > 0) | 651 if (style.width().isIntrinsicOrAuto() && size.width() > 0) |
| 652 style->setWidth(Length(size.width(), Fixed)); | 652 style.setWidth(Length(size.width(), Fixed)); |
| 653 if (style->height().isAuto() && size.height() > 0) | 653 if (style.height().isAuto() && size.height() > 0) |
| 654 style->setHeight(Length(size.height(), Fixed)); | 654 style.setHeight(Length(size.height(), Fixed)); |
| 655 } | 655 } |
| 656 | 656 |
| 657 void LayoutThemeChromiumMac::setFontFromControlSize(RenderStyle* style, NSContro lSize controlSize) const | 657 void LayoutThemeChromiumMac::setFontFromControlSize(RenderStyle& style, NSContro lSize controlSize) const |
| 658 { | 658 { |
| 659 FontDescription fontDescription; | 659 FontDescription fontDescription; |
| 660 fontDescription.setIsAbsoluteSize(true); | 660 fontDescription.setIsAbsoluteSize(true); |
| 661 fontDescription.setGenericFamily(FontDescription::SerifFamily); | 661 fontDescription.setGenericFamily(FontDescription::SerifFamily); |
| 662 | 662 |
| 663 NSFont* font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize :controlSize]]; | 663 NSFont* font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize :controlSize]]; |
| 664 fontDescription.firstFamily().setFamily([font webCoreFamilyName]); | 664 fontDescription.firstFamily().setFamily([font webCoreFamilyName]); |
| 665 fontDescription.setComputedSize([font pointSize] * style->effectiveZoom()); | 665 fontDescription.setComputedSize([font pointSize] * style.effectiveZoom()); |
| 666 fontDescription.setSpecifiedSize([font pointSize] * style->effectiveZoom()); | 666 fontDescription.setSpecifiedSize([font pointSize] * style.effectiveZoom()); |
| 667 | 667 |
| 668 // Reset line height. | 668 // Reset line height. |
| 669 style->setLineHeight(RenderStyle::initialLineHeight()); | 669 style.setLineHeight(RenderStyle::initialLineHeight()); |
| 670 | 670 |
| 671 if (style->setFontDescription(fontDescription)) | 671 if (style.setFontDescription(fontDescription)) |
| 672 style->font().update(nullptr); | 672 style.font().update(nullptr); |
| 673 } | 673 } |
| 674 | 674 |
| 675 NSControlSize LayoutThemeChromiumMac::controlSizeForSystemFont(RenderStyle* styl e) const | 675 NSControlSize LayoutThemeChromiumMac::controlSizeForSystemFont(RenderStyle& styl e) const |
|
dsinclair
2015/02/04 21:59:29
const?
Julien - ping for review
2015/02/04 22:32:18
Done.
| |
| 676 { | 676 { |
| 677 float fontSize = style->fontSize(); | 677 float fontSize = style.fontSize(); |
| 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(RenderObject* o, const PaintInfo& pa intInfo, const IntRect& r) |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |
| 827 // Now inflate it to account for the shadow. | 827 // Now inflate it to account for the shadow. |
| 828 IntRect inflatedRect = r; | 828 IntRect inflatedRect = r; |
| 829 if (r.width() >= minimumMenuListSize(o->style())) | 829 if (r.width() >= minimumMenuListSize(o->styleRef())) |
| 830 inflatedRect = ThemeMac::inflateRect(inflatedRect, size, popupButtonMarg ins(), zoomLevel); | 830 inflatedRect = ThemeMac::inflateRect(inflatedRect, size, popupButtonMarg ins(), zoomLevel); |
| 831 | 831 |
| 832 LocalCurrentGraphicsContext localContext(paintInfo.context, ThemeMac::inflat eRectForFocusRing(inflatedRect)); | 832 LocalCurrentGraphicsContext localContext(paintInfo.context, ThemeMac::inflat eRectForFocusRing(inflatedRect)); |
| 833 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 833 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 834 | 834 |
| 835 // On Leopard, the cell will draw outside of the given rect, so we have to | 835 // On Leopard, the cell will draw outside of the given rect, so we have to |
| 836 // clip to the rect. | 836 // clip to the rect. |
| 837 paintInfo.context->clip(inflatedRect); | 837 paintInfo.context->clip(inflatedRect); |
| 838 | 838 |
| 839 if (zoomLevel != 1.0f) { | 839 if (zoomLevel != 1.0f) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 907 return NSRatingLevelIndicatorStyle; | 907 return NSRatingLevelIndicatorStyle; |
| 908 case MeterPart: | 908 case MeterPart: |
| 909 case ContinuousCapacityLevelIndicatorPart: | 909 case ContinuousCapacityLevelIndicatorPart: |
| 910 default: | 910 default: |
| 911 return NSContinuousCapacityLevelIndicatorStyle; | 911 return NSContinuousCapacityLevelIndicatorStyle; |
| 912 } | 912 } |
| 913 } | 913 } |
| 914 | 914 |
| 915 NSLevelIndicatorCell* LayoutThemeChromiumMac::levelIndicatorFor(const RenderMete r* renderMeter) const | 915 NSLevelIndicatorCell* LayoutThemeChromiumMac::levelIndicatorFor(const RenderMete r* renderMeter) const |
| 916 { | 916 { |
| 917 RenderStyle* style = renderMeter->style(); | 917 RenderStyle& style = renderMeter->style(); |
|
dsinclair
2015/02/04 21:59:29
const?
Julien - ping for review
2015/02/04 22:32:18
Done.
| |
| 918 ASSERT(style->appearance() != NoControlPart); | 918 ASSERT(style.appearance() != NoControlPart); |
| 919 | 919 |
| 920 if (!m_levelIndicator) | 920 if (!m_levelIndicator) |
| 921 m_levelIndicator.adoptNS([[NSLevelIndicatorCell alloc] initWithLevelIndi catorStyle:NSContinuousCapacityLevelIndicatorStyle]); | 921 m_levelIndicator.adoptNS([[NSLevelIndicatorCell alloc] initWithLevelIndi catorStyle:NSContinuousCapacityLevelIndicatorStyle]); |
| 922 NSLevelIndicatorCell* cell = m_levelIndicator.get(); | 922 NSLevelIndicatorCell* cell = m_levelIndicator.get(); |
| 923 | 923 |
| 924 HTMLMeterElement* element = renderMeter->meterElement(); | 924 HTMLMeterElement* element = renderMeter->meterElement(); |
| 925 double value = element->value(); | 925 double value = element->value(); |
| 926 | 926 |
| 927 // Because NSLevelIndicatorCell does not support optimum-in-the-middle type | 927 // Because NSLevelIndicatorCell does not support optimum-in-the-middle type |
| 928 // coloring, we explicitly control the color instead giving low and high | 928 // coloring, we explicitly control the color instead giving low and high |
| 929 // value to NSLevelIndicatorCell as is. | 929 // value to NSLevelIndicatorCell as is. |
| 930 switch (element->gaugeRegion()) { | 930 switch (element->gaugeRegion()) { |
| 931 case HTMLMeterElement::GaugeRegionOptimum: | 931 case HTMLMeterElement::GaugeRegionOptimum: |
| 932 // Make meter the green. | 932 // Make meter the green. |
| 933 [cell setWarningValue:value + 1]; | 933 [cell setWarningValue:value + 1]; |
| 934 [cell setCriticalValue:value + 2]; | 934 [cell setCriticalValue:value + 2]; |
| 935 break; | 935 break; |
| 936 case HTMLMeterElement::GaugeRegionSuboptimal: | 936 case HTMLMeterElement::GaugeRegionSuboptimal: |
| 937 // Make the meter yellow. | 937 // Make the meter yellow. |
| 938 [cell setWarningValue:value - 1]; | 938 [cell setWarningValue:value - 1]; |
| 939 [cell setCriticalValue:value + 1]; | 939 [cell setCriticalValue:value + 1]; |
| 940 break; | 940 break; |
| 941 case HTMLMeterElement::GaugeRegionEvenLessGood: | 941 case HTMLMeterElement::GaugeRegionEvenLessGood: |
| 942 // Make the meter red. | 942 // Make the meter red. |
| 943 [cell setWarningValue:value - 2]; | 943 [cell setWarningValue:value - 2]; |
| 944 [cell setCriticalValue:value - 1]; | 944 [cell setCriticalValue:value - 1]; |
| 945 break; | 945 break; |
| 946 } | 946 } |
| 947 | 947 |
| 948 [cell setLevelIndicatorStyle:levelIndicatorStyleFor(style->appearance())]; | 948 [cell setLevelIndicatorStyle:levelIndicatorStyleFor(style.appearance())]; |
| 949 [cell setBaseWritingDirection:style->isLeftToRightDirection() ? NSWritingDir ectionLeftToRight : NSWritingDirectionRightToLeft]; | 949 [cell setBaseWritingDirection:style.isLeftToRightDirection() ? NSWritingDire ctionLeftToRight : NSWritingDirectionRightToLeft]; |
| 950 [cell setMinValue:element->min()]; | 950 [cell setMinValue:element->min()]; |
| 951 [cell setMaxValue:element->max()]; | 951 [cell setMaxValue:element->max()]; |
| 952 RetainPtr<NSNumber> valueObject = [NSNumber numberWithDouble:value]; | 952 RetainPtr<NSNumber> valueObject = [NSNumber numberWithDouble:value]; |
| 953 [cell setObjectValue:valueObject.get()]; | 953 [cell setObjectValue:valueObject.get()]; |
| 954 | 954 |
| 955 return cell; | 955 return cell; |
| 956 } | 956 } |
| 957 | 957 |
| 958 const IntSize* LayoutThemeChromiumMac::progressBarSizes() const | 958 const IntSize* LayoutThemeChromiumMac::progressBarSizes() const |
| 959 { | 959 { |
| 960 static const IntSize sizes[3] = { IntSize(0, 20), IntSize(0, 12), IntSize(0, 12) }; | 960 static const IntSize sizes[3] = { IntSize(0, 20), IntSize(0, 12), IntSize(0, 12) }; |
| 961 return sizes; | 961 return sizes; |
| 962 } | 962 } |
| 963 | 963 |
| 964 const int* LayoutThemeChromiumMac::progressBarMargins(NSControlSize controlSize) const | 964 const int* LayoutThemeChromiumMac::progressBarMargins(NSControlSize controlSize) const |
| 965 { | 965 { |
| 966 static const int margins[3][4] = | 966 static const int margins[3][4] = |
| 967 { | 967 { |
| 968 { 0, 0, 1, 0 }, | 968 { 0, 0, 1, 0 }, |
| 969 { 0, 0, 1, 0 }, | 969 { 0, 0, 1, 0 }, |
| 970 { 0, 0, 1, 0 }, | 970 { 0, 0, 1, 0 }, |
| 971 }; | 971 }; |
| 972 return margins[controlSize]; | 972 return margins[controlSize]; |
| 973 } | 973 } |
| 974 | 974 |
| 975 int LayoutThemeChromiumMac::minimumProgressBarHeight(RenderStyle* style) const | 975 int LayoutThemeChromiumMac::minimumProgressBarHeight(RenderStyle& style) const |
|
dsinclair
2015/02/04 21:59:29
Can't tell from the code below, can this be const?
Julien - ping for review
2015/02/04 22:32:18
It can. Done.
| |
| 976 { | 976 { |
| 977 return sizeForSystemFont(style, progressBarSizes()).height(); | 977 return sizeForSystemFont(style, progressBarSizes()).height(); |
| 978 } | 978 } |
| 979 | 979 |
| 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 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1090 paintInfo.context->fillPolygon(3, arrow2, color, true); | 1090 paintInfo.context->fillPolygon(3, arrow2, color, true); |
| 1091 return false; | 1091 return false; |
| 1092 } | 1092 } |
| 1093 | 1093 |
| 1094 static const IntSize* menuListButtonSizes() | 1094 static const IntSize* menuListButtonSizes() |
| 1095 { | 1095 { |
| 1096 static const IntSize sizes[3] = { IntSize(0, 21), IntSize(0, 18), IntSize(0, 15) }; | 1096 static const IntSize sizes[3] = { IntSize(0, 21), IntSize(0, 18), IntSize(0, 15) }; |
| 1097 return sizes; | 1097 return sizes; |
| 1098 } | 1098 } |
| 1099 | 1099 |
| 1100 void LayoutThemeChromiumMac::adjustMenuListStyle(RenderStyle* style, Element* e) const | 1100 void LayoutThemeChromiumMac::adjustMenuListStyle(RenderStyle& style, Element* e) const |
| 1101 { | 1101 { |
| 1102 NSControlSize controlSize = controlSizeForFont(style); | 1102 NSControlSize controlSize = controlSizeForFont(style); |
| 1103 | 1103 |
| 1104 style->resetBorder(); | 1104 style.resetBorder(); |
| 1105 style->resetPadding(); | 1105 style.resetPadding(); |
| 1106 | 1106 |
| 1107 // Height is locked to auto. | 1107 // Height is locked to auto. |
| 1108 style->setHeight(Length(Auto)); | 1108 style.setHeight(Length(Auto)); |
| 1109 | 1109 |
| 1110 // White-space is locked to pre. | 1110 // White-space is locked to pre. |
| 1111 style->setWhiteSpace(PRE); | 1111 style.setWhiteSpace(PRE); |
| 1112 | 1112 |
| 1113 // Set the foreground color to black or gray when we have the aqua look. | 1113 // Set the foreground color to black or gray when we have the aqua look. |
| 1114 // Cast to RGB32 is to work around a compiler bug. | 1114 // Cast to RGB32 is to work around a compiler bug. |
| 1115 style->setColor(e && !e->isDisabledFormControl() ? static_cast<RGBA32>(Color ::black) : Color::darkGray); | 1115 style.setColor(e && !e->isDisabledFormControl() ? static_cast<RGBA32>(Color: :black) : Color::darkGray); |
| 1116 | 1116 |
| 1117 // Set the button's vertical size. | 1117 // Set the button's vertical size. |
| 1118 setSizeFromFont(style, menuListButtonSizes()); | 1118 setSizeFromFont(style, menuListButtonSizes()); |
| 1119 | 1119 |
| 1120 // Our font is locked to the appropriate system font size for the | 1120 // Our font is locked to the appropriate system font size for the |
| 1121 // control. To clarify, we first use the CSS-specified font to figure out a | 1121 // control. To clarify, we first use the CSS-specified font to figure out a |
| 1122 // reasonable control size, but once that control size is determined, we | 1122 // reasonable control size, but once that control size is determined, we |
| 1123 // throw that font away and use the appropriate system font for the control | 1123 // throw that font away and use the appropriate system font for the control |
| 1124 // size instead. | 1124 // size instead. |
| 1125 setFontFromControlSize(style, controlSize); | 1125 setFontFromControlSize(style, controlSize); |
| 1126 } | 1126 } |
| 1127 | 1127 |
| 1128 const int autofillPopupHorizontalPadding = 4; | 1128 const int autofillPopupHorizontalPadding = 4; |
| 1129 | 1129 |
| 1130 // These functions are called with MenuListPart or MenulistButtonPart appearance | 1130 // These functions are called with MenuListPart or MenulistButtonPart appearance |
| 1131 // by RenderMenuList, or with TextFieldPart appearance by | 1131 // by RenderMenuList, or with TextFieldPart appearance by |
| 1132 // AutofillPopupMenuClient. We assume only AutofillPopupMenuClient gives | 1132 // AutofillPopupMenuClient. We assume only AutofillPopupMenuClient gives |
| 1133 // TexfieldPart appearance here. We want to change only Autofill padding. In | 1133 // TexfieldPart appearance here. We want to change only Autofill padding. In |
| 1134 // the future, we have to separate Autofill popup window logic from WebKit to | 1134 // the future, we have to separate Autofill popup window logic from WebKit to |
| 1135 // Chromium. | 1135 // Chromium. |
| 1136 int LayoutThemeChromiumMac::popupInternalPaddingLeft(RenderStyle* style) const | 1136 int LayoutThemeChromiumMac::popupInternalPaddingLeft(const RenderStyle& style) c onst |
| 1137 { | 1137 { |
| 1138 if (style->appearance() == TextFieldPart) | 1138 if (style.appearance() == TextFieldPart) |
| 1139 return autofillPopupHorizontalPadding; | 1139 return autofillPopupHorizontalPadding; |
| 1140 | 1140 |
| 1141 if (style->appearance() == MenulistPart) | 1141 if (style.appearance() == MenulistPart) |
| 1142 return popupButtonPadding(controlSizeForFont(style))[ThemeMac::LeftMargi n] * style->effectiveZoom(); | 1142 return popupButtonPadding(controlSizeForFont(style))[ThemeMac::LeftMargi n] * style.effectiveZoom(); |
| 1143 if (style->appearance() == MenulistButtonPart) | 1143 if (style.appearance() == MenulistButtonPart) |
| 1144 return styledPopupPaddingLeft * style->effectiveZoom(); | 1144 return styledPopupPaddingLeft * style.effectiveZoom(); |
| 1145 return 0; | 1145 return 0; |
| 1146 } | 1146 } |
| 1147 | 1147 |
| 1148 int LayoutThemeChromiumMac::popupInternalPaddingRight(RenderStyle* style) const | 1148 int LayoutThemeChromiumMac::popupInternalPaddingRight(const RenderStyle& style) const |
| 1149 { | 1149 { |
| 1150 if (style->appearance() == TextFieldPart) | 1150 if (style.appearance() == TextFieldPart) |
| 1151 return autofillPopupHorizontalPadding; | 1151 return autofillPopupHorizontalPadding; |
| 1152 | 1152 |
| 1153 if (style->appearance() == MenulistPart) | 1153 if (style.appearance() == MenulistPart) |
| 1154 return popupButtonPadding(controlSizeForFont(style))[ThemeMac::RightMarg in] * style->effectiveZoom(); | 1154 return popupButtonPadding(controlSizeForFont(style))[ThemeMac::RightMarg in] * style.effectiveZoom(); |
| 1155 if (style->appearance() == MenulistButtonPart) { | 1155 if (style.appearance() == MenulistButtonPart) { |
| 1156 float fontScale = style->fontSize() / baseFontSize; | 1156 float fontScale = style.fontSize() / baseFontSize; |
| 1157 float arrowWidth = baseArrowWidth * fontScale; | 1157 float arrowWidth = baseArrowWidth * fontScale; |
| 1158 return static_cast<int>(ceilf(arrowWidth + (arrowPaddingLeft + arrowPadd ingRight + paddingBeforeSeparator) * style->effectiveZoom())); | 1158 return static_cast<int>(ceilf(arrowWidth + (arrowPaddingLeft + arrowPadd ingRight + paddingBeforeSeparator) * style.effectiveZoom())); |
| 1159 } | 1159 } |
| 1160 return 0; | 1160 return 0; |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 int LayoutThemeChromiumMac::popupInternalPaddingTop(RenderStyle* style) const | 1163 int LayoutThemeChromiumMac::popupInternalPaddingTop(const RenderStyle& style) co nst |
| 1164 { | 1164 { |
| 1165 if (style->appearance() == MenulistPart) | 1165 if (style.appearance() == MenulistPart) |
| 1166 return popupButtonPadding(controlSizeForFont(style))[ThemeMac::TopMargin ] * style->effectiveZoom(); | 1166 return popupButtonPadding(controlSizeForFont(style))[ThemeMac::TopMargin ] * style.effectiveZoom(); |
| 1167 if (style->appearance() == MenulistButtonPart) | 1167 if (style.appearance() == MenulistButtonPart) |
| 1168 return styledPopupPaddingTop * style->effectiveZoom(); | 1168 return styledPopupPaddingTop * style.effectiveZoom(); |
| 1169 return 0; | 1169 return 0; |
| 1170 } | 1170 } |
| 1171 | 1171 |
| 1172 int LayoutThemeChromiumMac::popupInternalPaddingBottom(RenderStyle* style) const | 1172 int LayoutThemeChromiumMac::popupInternalPaddingBottom(const RenderStyle& style) const |
| 1173 { | 1173 { |
| 1174 if (style->appearance() == MenulistPart) | 1174 if (style.appearance() == MenulistPart) |
| 1175 return popupButtonPadding(controlSizeForFont(style))[ThemeMac::BottomMar gin] * style->effectiveZoom(); | 1175 return popupButtonPadding(controlSizeForFont(style))[ThemeMac::BottomMar gin] * style.effectiveZoom(); |
| 1176 if (style->appearance() == MenulistButtonPart) | 1176 if (style.appearance() == MenulistButtonPart) |
| 1177 return styledPopupPaddingBottom * style->effectiveZoom(); | 1177 return styledPopupPaddingBottom * style.effectiveZoom(); |
| 1178 return 0; | 1178 return 0; |
| 1179 } | 1179 } |
| 1180 | 1180 |
| 1181 void LayoutThemeChromiumMac::adjustMenuListButtonStyle(RenderStyle* style, Eleme nt*) const | 1181 void LayoutThemeChromiumMac::adjustMenuListButtonStyle(RenderStyle& style, Eleme nt*) const |
| 1182 { | 1182 { |
| 1183 float fontScale = style->fontSize() / baseFontSize; | 1183 float fontScale = style.fontSize() / baseFontSize; |
| 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(bas eBorderRadius + 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 RenderObject* 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); |
| 1205 updatePressedState(popupButton, o); | 1205 updatePressedState(popupButton, o); |
| 1206 #if BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING | 1206 #if BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING |
| 1207 updateFocusedState(popupButton, o); | 1207 updateFocusedState(popupButton, o); |
| 1208 #endif | 1208 #endif |
| 1209 } | 1209 } |
| 1210 | 1210 |
| 1211 const IntSize* LayoutThemeChromiumMac::menuListSizes() const | 1211 const IntSize* LayoutThemeChromiumMac::menuListSizes() const |
| 1212 { | 1212 { |
| 1213 static const IntSize sizes[3] = { IntSize(9, 0), IntSize(5, 0), IntSize(0, 0 ) }; | 1213 static const IntSize sizes[3] = { IntSize(9, 0), IntSize(5, 0), IntSize(0, 0 ) }; |
| 1214 return sizes; | 1214 return sizes; |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 int LayoutThemeChromiumMac::minimumMenuListSize(RenderStyle* style) const | 1217 int LayoutThemeChromiumMac::minimumMenuListSize(const 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(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) |
| 1226 { | 1226 { |
| 1227 paintSliderTicks(o, paintInfo, r); | 1227 paintSliderTicks(o, paintInfo, r); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1426 static const IntSize sizes[3] = { IntSize(0, 22), IntSize(0, 19), IntSize(0, 15) }; | 1426 static const IntSize sizes[3] = { IntSize(0, 22), IntSize(0, 19), IntSize(0, 15) }; |
| 1427 return sizes; | 1427 return sizes; |
| 1428 } | 1428 } |
| 1429 | 1429 |
| 1430 static const int* searchFieldHorizontalPaddings() | 1430 static const int* searchFieldHorizontalPaddings() |
| 1431 { | 1431 { |
| 1432 static const int sizes[3] = { 3, 2, 1 }; | 1432 static const int sizes[3] = { 3, 2, 1 }; |
| 1433 return sizes; | 1433 return sizes; |
| 1434 } | 1434 } |
| 1435 | 1435 |
| 1436 void LayoutThemeChromiumMac::setSearchFieldSize(RenderStyle* style) const | 1436 void LayoutThemeChromiumMac::setSearchFieldSize(RenderStyle& style) const |
| 1437 { | 1437 { |
| 1438 // If the width and height are both specified, then we have nothing to do. | 1438 // If the width and height are both specified, then we have nothing to do. |
| 1439 if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) | 1439 if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto()) |
| 1440 return; | 1440 return; |
| 1441 | 1441 |
| 1442 // Use the font size to determine the intrinsic width of the control. | 1442 // Use the font size to determine the intrinsic width of the control. |
| 1443 setSizeFromFont(style, searchFieldSizes()); | 1443 setSizeFromFont(style, searchFieldSizes()); |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 const int searchFieldBorderWidth = 2; | 1446 const int searchFieldBorderWidth = 2; |
| 1447 void LayoutThemeChromiumMac::adjustSearchFieldStyle(RenderStyle* style, Element* ) const | 1447 void LayoutThemeChromiumMac::adjustSearchFieldStyle(RenderStyle& style, Element* ) const |
| 1448 { | 1448 { |
| 1449 // Override border. | 1449 // Override border. |
| 1450 style->resetBorder(); | 1450 style.resetBorder(); |
| 1451 const short borderWidth = searchFieldBorderWidth * style->effectiveZoom(); | 1451 const short borderWidth = searchFieldBorderWidth * style.effectiveZoom(); |
| 1452 style->setBorderLeftWidth(borderWidth); | 1452 style.setBorderLeftWidth(borderWidth); |
| 1453 style->setBorderLeftStyle(INSET); | 1453 style.setBorderLeftStyle(INSET); |
| 1454 style->setBorderRightWidth(borderWidth); | 1454 style.setBorderRightWidth(borderWidth); |
| 1455 style->setBorderRightStyle(INSET); | 1455 style.setBorderRightStyle(INSET); |
| 1456 style->setBorderBottomWidth(borderWidth); | 1456 style.setBorderBottomWidth(borderWidth); |
| 1457 style->setBorderBottomStyle(INSET); | 1457 style.setBorderBottomStyle(INSET); |
| 1458 style->setBorderTopWidth(borderWidth); | 1458 style.setBorderTopWidth(borderWidth); |
| 1459 style->setBorderTopStyle(INSET); | 1459 style.setBorderTopStyle(INSET); |
| 1460 | 1460 |
| 1461 // Override height. | 1461 // Override height. |
| 1462 style->setHeight(Length(Auto)); | 1462 style.setHeight(Length(Auto)); |
| 1463 setSearchFieldSize(style); | 1463 setSearchFieldSize(style); |
| 1464 | 1464 |
| 1465 NSControlSize controlSize = controlSizeForFont(style); | 1465 NSControlSize controlSize = controlSizeForFont(style); |
| 1466 | 1466 |
| 1467 // Override padding size to match AppKit text positioning. | 1467 // Override padding size to match AppKit text positioning. |
| 1468 const int verticalPadding = 1 * style->effectiveZoom(); | 1468 const int verticalPadding = 1 * style.effectiveZoom(); |
| 1469 const int horizontalPadding = searchFieldHorizontalPaddings()[controlSize] * style->effectiveZoom(); | 1469 const int horizontalPadding = searchFieldHorizontalPaddings()[controlSize] * style.effectiveZoom(); |
| 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(RenderObject* 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 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1533 | 1533 |
| 1534 return false; | 1534 return false; |
| 1535 } | 1535 } |
| 1536 | 1536 |
| 1537 const IntSize* LayoutThemeChromiumMac::cancelButtonSizes() const | 1537 const IntSize* LayoutThemeChromiumMac::cancelButtonSizes() const |
| 1538 { | 1538 { |
| 1539 static const IntSize sizes[3] = { IntSize(14, 14), IntSize(11, 11), IntSize( 9, 9) }; | 1539 static const IntSize sizes[3] = { IntSize(14, 14), IntSize(11, 11), IntSize( 9, 9) }; |
| 1540 return sizes; | 1540 return sizes; |
| 1541 } | 1541 } |
| 1542 | 1542 |
| 1543 void LayoutThemeChromiumMac::adjustSearchFieldCancelButtonStyle(RenderStyle* sty le, Element*) const | 1543 void LayoutThemeChromiumMac::adjustSearchFieldCancelButtonStyle(RenderStyle& sty le, Element*) const |
| 1544 { | 1544 { |
| 1545 IntSize size = sizeForSystemFont(style, cancelButtonSizes()); | 1545 IntSize size = sizeForSystemFont(style, cancelButtonSizes()); |
| 1546 style->setWidth(Length(size.width(), Fixed)); | 1546 style.setWidth(Length(size.width(), Fixed)); |
| 1547 style->setHeight(Length(size.height(), Fixed)); | 1547 style.setHeight(Length(size.height(), Fixed)); |
| 1548 style->setBoxShadow(nullptr); | 1548 style.setBoxShadow(nullptr); |
| 1549 } | 1549 } |
| 1550 | 1550 |
| 1551 const IntSize* LayoutThemeChromiumMac::resultsButtonSizes() const | 1551 const IntSize* LayoutThemeChromiumMac::resultsButtonSizes() const |
| 1552 { | 1552 { |
| 1553 static const IntSize sizes[3] = { IntSize(15, 14), IntSize(16, 13), IntSize( 14, 11) }; | 1553 static const IntSize sizes[3] = { IntSize(15, 14), IntSize(16, 13), IntSize( 14, 11) }; |
| 1554 return sizes; | 1554 return sizes; |
| 1555 } | 1555 } |
| 1556 | 1556 |
| 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(RenderObject*, 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(RenderObject* 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()) |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1617 IntSize LayoutThemeChromiumMac::sliderTickSize() const | 1617 IntSize LayoutThemeChromiumMac::sliderTickSize() const |
| 1618 { | 1618 { |
| 1619 return IntSize(1, 3); | 1619 return IntSize(1, 3); |
| 1620 } | 1620 } |
| 1621 | 1621 |
| 1622 int LayoutThemeChromiumMac::sliderTickOffsetFromTrackCenter() const | 1622 int LayoutThemeChromiumMac::sliderTickOffsetFromTrackCenter() const |
| 1623 { | 1623 { |
| 1624 return -9; | 1624 return -9; |
| 1625 } | 1625 } |
| 1626 | 1626 |
| 1627 void LayoutThemeChromiumMac::adjustSliderThumbSize(RenderStyle* style, Element*) const | 1627 void LayoutThemeChromiumMac::adjustSliderThumbSize(RenderStyle& style, Element*) const |
| 1628 { | 1628 { |
| 1629 float zoomLevel = style->effectiveZoom(); | 1629 float zoomLevel = style.effectiveZoom(); |
| 1630 if (style->appearance() == SliderThumbHorizontalPart || style->appearance() == SliderThumbVerticalPart) { | 1630 if (style.appearance() == SliderThumbHorizontalPart || style.appearance() == SliderThumbVerticalPart) { |
| 1631 style->setWidth(Length(static_cast<int>(sliderThumbWidth * zoomLevel), F ixed)); | 1631 style.setWidth(Length(static_cast<int>(sliderThumbWidth * zoomLevel), Fi xed)); |
| 1632 style->setHeight(Length(static_cast<int>(sliderThumbHeight * zoomLevel), Fixed)); | 1632 style.setHeight(Length(static_cast<int>(sliderThumbHeight * zoomLevel), Fixed)); |
| 1633 } | 1633 } |
| 1634 | 1634 |
| 1635 adjustMediaSliderThumbSize(style); | 1635 adjustMediaSliderThumbSize(style); |
| 1636 } | 1636 } |
| 1637 | 1637 |
| 1638 NSPopUpButtonCell* LayoutThemeChromiumMac::popupButton() const | 1638 NSPopUpButtonCell* LayoutThemeChromiumMac::popupButton() const |
| 1639 { | 1639 { |
| 1640 if (!m_popupButton) { | 1640 if (!m_popupButton) { |
| 1641 m_popupButton.adoptNS([[NSPopUpButtonCell alloc] initTextCell:@"" pullsD own:NO]); | 1641 m_popupButton.adoptNS([[NSPopUpButtonCell alloc] initTextCell:@"" pullsD own:NO]); |
| 1642 [m_popupButton.get() setUsesItemFromMenu:NO]; | 1642 [m_popupButton.get() setUsesItemFromMenu:NO]; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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(RenderObject* 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(RenderObject* object, c onst PaintInfo& paintInfo, const IntRect& rect) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1835 bool LayoutThemeChromiumMac::paintMediaFullscreenButton(RenderObject* object, co nst PaintInfo& paintInfo, const IntRect& rect) | 1835 bool LayoutThemeChromiumMac::paintMediaFullscreenButton(RenderObject* 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(RenderObject* 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(const RenderStyle& style) co nst |
| 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 |