Changeset 284626 in webkit
- Timestamp:
- Oct 21, 2021 11:05:21 AM (9 months ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
PAL/ChangeLog (modified) (1 diff)
-
PAL/pal/spi/mac/CoreUISPI.h (modified) (1 diff)
-
rendering/RenderThemeMac.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r284624 r284626 1 2021-10-21 Aditya Keerthi <akeerthi@apple.com> 2 3 [macOS] Update appearance of <datalist> indicator 4 https://bugs.webkit.org/show_bug.cgi?id=232031 5 rdar://84474135 6 7 Reviewed by Wenson Hsieh. 8 9 * rendering/RenderThemeMac.mm: 10 (WebCore::RenderThemeMac::paintListButtonForInput): 11 12 Use CoreUI to paint the indicator on Big Sur and Monterey. 13 1 14 2021-10-21 Devin Rousso <drousso@apple.com> 2 15 -
trunk/Source/WebCore/PAL/ChangeLog
r284544 r284626 1 2021-10-21 Aditya Keerthi <akeerthi@apple.com> 2 3 [macOS] Update appearance of <datalist> indicator 4 https://bugs.webkit.org/show_bug.cgi?id=232031 5 rdar://84474135 6 7 Reviewed by Wenson Hsieh. 8 9 * pal/spi/mac/CoreUISPI.h: 10 1 11 2021-10-20 Ross Kirsling <ross.kirsling@sony.com> 2 12 -
trunk/Source/WebCore/PAL/pal/spi/mac/CoreUISPI.h
r265860 r284626 69 69 extern const CFStringRef kCUIWidgetProgressBar; 70 70 extern const CFStringRef kCUIWidgetScrollBarTrackCorner; 71 #if HAVE(LARGE_CONTROL_SIZE) 72 extern const CFStringRef kCUIWidgetButtonComboBox; 73 #endif 71 74 72 75 #endif -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r284453 r284626 989 989 // We can't paint an NSComboBoxCell since they are not height-resizable. 990 990 const auto& input = downcast<HTMLInputElement>(*(o.generatingNode())); 991 992 #if HAVE(LARGE_CONTROL_SIZE) 993 LocalDefaultSystemAppearance localAppearance(o.useDarkAppearance(), o.style().effectiveAccentColor()); 994 995 const FloatSize comboBoxSize { 40, 19 }; 996 const FloatSize comboBoxButtonSize { 16, 16 }; 997 const FloatPoint comboBoxButtonInset { 5, 1 }; 998 constexpr auto comboBoxButtonCornerRadii = 4; 999 1000 const FloatSize desiredComboBoxButtonSize { 12, 12 }; 1001 constexpr auto desiredComboBoxInset = 2; 1002 1003 float deviceScaleFactor = o.document().deviceScaleFactor(); 1004 1005 auto comboBoxImageBuffer = ImageBuffer::createCompatibleBuffer(comboBoxSize, deviceScaleFactor, DestinationColorSpace::SRGB(), context); 1006 if (!comboBoxImageBuffer) 1007 return; 1008 1009 ContextContainer cgContextContainer(comboBoxImageBuffer->context()); 1010 CGContextRef cgContext = cgContextContainer.context(); 1011 1012 NSString *coreUIState; 1013 if (input.isPresentingAttachedView()) 1014 coreUIState = (__bridge NSString *)kCUIStatePressed; 1015 else if (auto* buttonElement = input.dataListButtonElement()) 1016 coreUIState = (__bridge NSString *)(buttonElement->active() ? kCUIStatePressed : kCUIStateActive); 1017 else 1018 coreUIState = (__bridge NSString *)kCUIStateActive; 1019 1020 ALLOW_DEPRECATED_DECLARATIONS_BEGIN 1021 [[NSAppearance currentAppearance] _drawInRect:NSMakeRect(0, 0, comboBoxSize.width(), comboBoxSize.height()) context:cgContext options:@{ 1022 ALLOW_DEPRECATED_DECLARATIONS_END 1023 (__bridge NSString *)kCUIWidgetKey : (__bridge NSString *)kCUIWidgetButtonComboBox, 1024 (__bridge NSString *)kCUISizeKey : (__bridge NSString *)kCUISizeRegular, 1025 (__bridge NSString *)kCUIStateKey : coreUIState, 1026 (__bridge NSString *)kCUIUserInterfaceLayoutDirectionKey : (__bridge NSString *)kCUIUserInterfaceLayoutDirectionLeftToRight, 1027 }]; 1028 1029 auto comboBoxButtonImageBuffer = ImageBuffer::createCompatibleBuffer(desiredComboBoxButtonSize, deviceScaleFactor, DestinationColorSpace::SRGB(), context); 1030 if (!comboBoxButtonImageBuffer) 1031 return; 1032 1033 auto& comboBoxButtonContext = comboBoxButtonImageBuffer->context(); 1034 1035 comboBoxButtonContext.scale(desiredComboBoxButtonSize.width() / comboBoxButtonSize.width()); 1036 comboBoxButtonContext.clipRoundedRect(FloatRoundedRect(FloatRect(FloatPoint::zero(), comboBoxButtonSize), FloatRoundedRect::Radii(comboBoxButtonCornerRadii))); 1037 comboBoxButtonContext.translate(comboBoxButtonInset.scaled(-1)); 1038 comboBoxButtonContext.drawConsumingImageBuffer(WTFMove(comboBoxImageBuffer), FloatPoint::zero(), ImagePaintingOptions { ImageOrientation::OriginBottomRight }); 1039 1040 FloatPoint listButtonLocation; 1041 float listButtonY = r.center().y() - desiredComboBoxButtonSize.height() / 2; 1042 if (o.style().isLeftToRightDirection()) 1043 listButtonLocation = { r.maxX() - desiredComboBoxButtonSize.width() - desiredComboBoxInset, listButtonY }; 1044 else 1045 listButtonLocation = { r.x() + desiredComboBoxInset, listButtonY }; 1046 1047 GraphicsContextStateSaver stateSaver(context); 1048 context.drawConsumingImageBuffer(WTFMove(comboBoxButtonImageBuffer), listButtonLocation); 1049 #else 991 1050 NSCell *listButton = this->listButton(); 992 1051 … … 1021 1080 1022 1081 context.drawImage(*image, imageRect); 1082 #endif // HAVE(LARGE_CONTROL_SIZE) 1023 1083 } 1024 1084
Note: See TracChangeset
for help on using the changeset viewer.