Changeset 230462 in webkit
- Timestamp:
- Apr 9, 2018 6:36:29 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r230461 r230462 1 2018-04-09 Timothy Hatcher <timothy@apple.com> 2 3 Add support for setting a background color on WKWebView and WKView 4 https://bugs.webkit.org/show_bug.cgi?id=184426 5 6 Reviewed by Wenson Hsieh. 7 8 * UIProcess/API/Cocoa/WKViewPrivate.h: Added _backgroundColor property. 9 * UIProcess/API/Cocoa/WKWebView.mm: 10 (-[WKWebView _backgroundColor]): Added. Call through to WebViewImpl. 11 (-[WKWebView _setBackgroundColor:]): Added. Call through to WebViewImpl. 12 * UIProcess/API/Cocoa/WKWebViewPrivate.h: Added _backgroundColor property. 13 * UIProcess/API/mac/WKView.mm: 14 (-[WKView _backgroundColor]): Added. Call through to WebViewImpl. 15 (-[WKView _setBackgroundColor:]): Added. Call through to WebViewImpl. 16 * UIProcess/Cocoa/WebViewImpl.h: 17 * UIProcess/Cocoa/WebViewImpl.mm: 18 (WebKit::WebViewImpl::setBackgroundColor): Added. 19 (WebKit::WebViewImpl::backgroundColor const): Added. 20 (WebKit::WebViewImpl::updateLayer): Use m_backgroundColor when set. 21 1 22 2018-04-09 Yousuke Kimoto <yousuke.kimoto@sony.com> and Fujii Hironori <Hironori.Fujii@sony.com> 2 23 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKViewPrivate.h
r230121 r230462 83 83 @property (copy, nonatomic) NSColor *underlayColor; 84 84 85 @property (nonatomic, setter=_setBackgroundColor:) NSColor *_backgroundColor; 86 85 87 #if WK_API_ENABLED 86 88 @property (strong, nonatomic, setter=_setInspectorAttachmentView:) NSView *_inspectorAttachmentView WK_API_AVAILABLE(macosx(10.11)); -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r230440 r230462 5527 5527 } 5528 5528 5529 - (NSColor *)_backgroundColor 5530 { 5531 return _impl->backgroundColor(); 5532 } 5533 5534 - (void)_setBackgroundColor:(NSColor *)backgroundColor 5535 { 5536 _impl->setBackgroundColor(backgroundColor); 5537 } 5538 5529 5539 - (void)_setDrawsTransparentBackground:(BOOL)drawsTransparentBackground 5530 5540 { -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
r230121 r230462 261 261 262 262 @property (readonly) NSColor *_pageExtendedBackgroundColor; 263 @property (nonatomic, setter=_setBackgroundColor:) NSColor *_backgroundColor; 263 264 @property (nonatomic, setter=_setDrawsBackground:) BOOL _drawsBackground; 264 265 @property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset; -
trunk/Source/WebKit/UIProcess/API/mac/WKView.mm
r229684 r230462 109 109 { 110 110 return _data->_impl->drawsBackground(); 111 } 112 113 - (NSColor *)_backgroundColor 114 { 115 return _data->_impl->backgroundColor(); 116 } 117 118 - (void)_setBackgroundColor:(NSColor *)backgroundColor 119 { 120 _data->_impl->setBackgroundColor(backgroundColor); 111 121 } 112 122 -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h
r229684 r230462 143 143 void setDrawsBackground(bool); 144 144 bool drawsBackground() const; 145 void setBackgroundColor(NSColor *); 146 NSColor *backgroundColor() const; 145 147 bool isOpaque() const; 146 148 … … 666 668 RetainPtr<NSColorSpace> m_colorSpace; 667 669 670 RetainPtr<NSColor> m_backgroundColor; 671 668 672 RetainPtr<NSEvent> m_lastMouseDownEvent; 669 673 RetainPtr<NSEvent> m_lastPressureEvent; -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
r230221 r230462 1392 1392 } 1393 1393 1394 void WebViewImpl::setBackgroundColor(NSColor *backgroundColor) 1395 { 1396 m_backgroundColor = backgroundColor; 1397 } 1398 1399 NSColor *WebViewImpl::backgroundColor() const 1400 { 1401 if (!m_backgroundColor) 1402 return [NSColor whiteColor]; 1403 return m_backgroundColor.get(); 1404 } 1405 1394 1406 bool WebViewImpl::isOpaque() const 1395 1407 { … … 1608 1620 void WebViewImpl::updateLayer() 1609 1621 { 1610 [m_view layer].backgroundColor = CGColorGetConstantColor(drawsBackground() ? kCGColorWhite : kCGColorClear); 1622 bool draws = drawsBackground(); 1623 if (!draws || !m_backgroundColor) 1624 [m_view layer].backgroundColor = CGColorGetConstantColor(draws ? kCGColorWhite : kCGColorClear); 1625 else 1626 [m_view layer].backgroundColor = [m_backgroundColor CGColor]; 1611 1627 1612 1628 // If asynchronous geometry updates have been sent by forceAsyncDrawingAreaSizeUpdate, -
trunk/Tools/ChangeLog
r230460 r230462 1 2018-04-09 Timothy Hatcher <timothy@apple.com> 2 3 Add support for setting a background color on WKWebView and WKView 4 https://bugs.webkit.org/show_bug.cgi?id=184426 5 6 Reviewed by Wenson Hsieh. 7 8 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 9 * TestWebKitAPI/Tests/mac/BackgroundColor.mm: Added. 10 1 11 2018-04-09 Charlie Turner <cturner@igalia.com> 2 12 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r230368 r230462 64 64 1C2B81871C8925A000A5529F /* Ahem.ttf in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1C2B81851C89252300A5529F /* Ahem.ttf */; }; 65 65 1C734B5320788C4800F430EA /* SystemColors.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C734B5220788C4800F430EA /* SystemColors.mm */; }; 66 1C7FEB20207C0F2E00D23278 /* BackgroundColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C7FEB1F207C0F2D00D23278 /* BackgroundColor.mm */; }; 66 67 1C9EB8411E380DA1005C6442 /* ComplexTextController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C9EB8401E380DA1005C6442 /* ComplexTextController.cpp */; }; 67 68 1CAD1F861E5CE7DA00AF2C2C /* FontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CAD1F851E5CE7DA00AF2C2C /* FontCache.cpp */; }; … … 1187 1188 1C2B81851C89252300A5529F /* Ahem.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Ahem.ttf; sourceTree = "<group>"; }; 1188 1189 1C734B5220788C4800F430EA /* SystemColors.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SystemColors.mm; sourceTree = "<group>"; }; 1190 1C7FEB1F207C0F2D00D23278 /* BackgroundColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BackgroundColor.mm; sourceTree = "<group>"; }; 1189 1191 1C9EB8401E380DA1005C6442 /* ComplexTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComplexTextController.cpp; sourceTree = "<group>"; }; 1190 1192 1CAD1F851E5CE7DA00AF2C2C /* FontCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontCache.cpp; sourceTree = "<group>"; }; … … 2967 2969 B55F119F1516834F00915916 /* AttributedString.mm */, 2968 2970 00CD9F6215BE312C002DA2CE /* BackForwardList.mm */, 2971 1C7FEB1F207C0F2D00D23278 /* BackgroundColor.mm */, 2969 2972 26DF5A5D15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm */, 2970 2973 93CFA8681CEBCFED000565A8 /* CandidateTests.mm */, … … 3445 3448 07CD32F62065B5430064A4BE /* AVFoundationPreference.mm in Sources */, 3446 3449 7CCE7EB51A411A7E00447C4C /* BackForwardList.mm in Sources */, 3450 1C7FEB20207C0F2E00D23278 /* BackgroundColor.mm in Sources */, 3447 3451 374B7A601DF36EEE00ACCB6C /* BundleEditingDelegate.mm in Sources */, 3448 3452 A13EBBB11B87438000097110 /* BundleParameters.mm in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.