Changeset 230182 in webkit
- Timestamp:
- Apr 2, 2018 2:06:07 PM (5 years ago)
- Location:
- tags/Safari-606.1.7.4/Source
- Files:
-
- 45 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/css/StyleColor.cpp (modified) (2 diffs)
-
WebCore/css/StyleColor.h (modified) (1 diff)
-
WebCore/css/StyleResolver.cpp (modified) (2 diffs)
-
WebCore/css/parser/CSSParser.cpp (modified) (1 diff)
-
WebCore/css/parser/CSSParser.h (modified) (1 diff)
-
WebCore/css/parser/CSSParserMode.h (modified) (1 diff)
-
WebCore/dom/Document.cpp (modified) (1 diff)
-
WebCore/dom/Document.h (modified) (1 diff)
-
WebCore/html/canvas/CanvasRenderingContext2D.cpp (modified) (1 diff)
-
WebCore/html/canvas/CanvasStyle.cpp (modified) (1 diff)
-
WebCore/page/Page.h (modified) (2 diffs)
-
WebCore/platform/Theme.cpp (modified) (1 diff)
-
WebCore/platform/Theme.h (modified) (1 diff)
-
WebCore/platform/mac/LocalDefaultSystemAppearance.h (modified) (2 diffs)
-
WebCore/platform/mac/LocalDefaultSystemAppearance.mm (modified) (1 diff)
-
WebCore/platform/mac/ThemeMac.h (modified) (2 diffs)
-
WebCore/platform/mac/ThemeMac.mm (modified) (11 diffs)
-
WebCore/platform/wpe/ThemeWPE.cpp (modified) (1 diff)
-
WebCore/platform/wpe/ThemeWPE.h (modified) (1 diff)
-
WebCore/rendering/RenderListBox.cpp (modified) (1 diff)
-
WebCore/rendering/RenderTheme.cpp (modified) (6 diffs)
-
WebCore/rendering/RenderTheme.h (modified) (4 diffs)
-
WebCore/rendering/RenderThemeGtk.cpp (modified) (3 diffs)
-
WebCore/rendering/RenderThemeGtk.h (modified) (2 diffs)
-
WebCore/rendering/RenderThemeIOS.h (modified) (1 diff)
-
WebCore/rendering/RenderThemeIOS.mm (modified) (2 diffs)
-
WebCore/rendering/RenderThemeMac.h (modified) (2 diffs)
-
WebCore/rendering/RenderThemeMac.mm (modified) (6 diffs)
-
WebCore/rendering/RenderThemeWin.cpp (modified) (1 diff)
-
WebCore/rendering/RenderThemeWin.h (modified) (1 diff)
-
WebCore/rendering/TextPaintStyle.cpp (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Shared/WebPageCreationParameters.cpp (modified) (2 diffs)
-
WebKit/Shared/WebPageCreationParameters.h (modified) (1 diff)
-
WebKit/UIProcess/API/Cocoa/WKWebView.mm (modified) (1 diff)
-
WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (modified) (1 diff)
-
WebKit/UIProcess/WebPageProxy.cpp (modified) (2 diffs)
-
WebKit/UIProcess/WebPageProxy.h (modified) (2 diffs)
-
WebKit/WebProcess/WebPage/WebPage.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebPage/WebPage.h (modified) (1 diff)
-
WebKit/WebProcess/WebPage/WebPage.messages.in (modified) (1 diff)
-
WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
WebKitLegacy/mac/WebView/WebView.mm (modified) (1 diff)
-
WebKitLegacy/mac/WebView/WebViewPrivate.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tags/Safari-606.1.7.4/Source/WebCore/ChangeLog
r230181 r230182 1 2018-04-02 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r229448. rdar://problem/36975642 4 5 Allow WebViews to disable system appearance 6 https://bugs.webkit.org/show_bug.cgi?id=183418 7 <rdar://problem/36975642> 8 9 Reviewed by Tim Horton. 10 Source/WebCore: 11 12 13 Not currently testable, tests will be added in a later patch. 14 15 Allow webviews to choose whether or not to follow the default system appearance. 16 17 * css/StyleColor.cpp: 18 (WebCore::StyleColor::colorFromKeyword): 19 * css/StyleColor.h: 20 * css/StyleResolver.cpp: 21 (WebCore::StyleResolver::colorFromPrimitiveValue const): 22 * css/parser/CSSParser.cpp: 23 (WebCore::CSSParser::parseSystemColor): 24 * css/parser/CSSParser.h: 25 * css/parser/CSSParserMode.h: 26 * html/canvas/CanvasRenderingContext2D.cpp: 27 (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): 28 * html/canvas/CanvasRenderingContext2DBase.cpp: 29 (WebCore::CanvasRenderingContext2DBase::setStrokeColor): 30 (WebCore::CanvasRenderingContext2DBase::setFillColor): 31 * html/canvas/CanvasStyle.cpp: 32 (WebCore::parseColor): 33 (WebCore::parseColorOrCurrentColor): 34 (WebCore::CanvasStyle::createFromString): 35 (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): 36 * html/canvas/CanvasStyle.h: 37 * page/Page.h: 38 (WebCore::Page::useSystemAppearance const): 39 (WebCore::Page::setUseSystemAppearance): 40 * platform/Theme.cpp: 41 (WebCore::Theme::paint): 42 * platform/Theme.h: 43 * platform/mac/LocalDefaultSystemAppearance.h: 44 * platform/mac/LocalDefaultSystemAppearance.mm: 45 (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): 46 (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): 47 * platform/mac/ThemeMac.h: 48 * platform/mac/ThemeMac.mm: 49 (-[WebCoreThemeView initWithUseSystemAppearance:]): 50 (WebCore::paintToggleButton): 51 (WebCore::paintButton): 52 (WebCore::ThemeMac::ensuredView): 53 (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext): 54 (WebCore::ThemeMac::paint): 55 (-[WebCoreThemeView init]): Deleted. 56 * rendering/RenderTheme.cpp: 57 (WebCore::RenderTheme::paint): 58 (WebCore::RenderTheme::systemColor const): 59 (WebCore::RenderTheme::focusRingColor): 60 * rendering/RenderTheme.h: 61 (WebCore::RenderTheme::platformFocusRingColor const): 62 * rendering/RenderThemeIOS.mm: 63 (WebCore::RenderThemeIOS::systemColor const): 64 * rendering/RenderThemeMac.h: 65 * rendering/RenderThemeMac.mm: 66 (WebCore::RenderThemeMac::documentViewFor const): 67 (WebCore::RenderThemeMac::platformFocusRingColor const): 68 (WebCore::RenderThemeMac::systemColor const): 69 (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary): 70 (WebCore::RenderThemeMac::paintSliderThumb): 71 * rendering/TextPaintStyle.cpp: 72 (WebCore::computeTextPaintStyle): 73 74 Source/WebKit: 75 76 77 Allow webviews to choose whether or not to follow the default system appearance. 78 79 * Shared/WebPageCreationParameters.cpp: 80 (WebKit::WebPageCreationParameters::encode const): 81 (WebKit::WebPageCreationParameters::decode): 82 * Shared/WebPageCreationParameters.h: 83 * UIProcess/API/Cocoa/WKWebView.mm: 84 (-[WKWebView _useSystemAppearance]): 85 (-[WKWebView _setUseSystemAppearance:]): 86 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 87 * UIProcess/WebPageProxy.cpp: 88 (WebKit::WebPageProxy::creationParameters): 89 (WebKit::WebPageProxy::setUseSystemAppearance): 90 * UIProcess/WebPageProxy.h: 91 (WebKit::WebPageProxy::useSystemAppearance const): 92 * WebProcess/WebPage/WebPage.cpp: 93 (WebKit::WebPage::setUseSystemAppearance): 94 * WebProcess/WebPage/WebPage.h: 95 * WebProcess/WebPage/WebPage.messages.in: 96 97 Source/WebKitLegacy/mac: 98 99 100 Allow webviews to choose whether or not to follow the default system appearance. 101 102 * WebView/WebView.mm: 103 (-[WebView _setUseSystemAppearance:]): 104 (-[WebView _useSystemAppearance]): 105 * WebView/WebViewPrivate.h: 106 107 108 109 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229448 268f45cc-cd09-0410-ab3c-d52691b4dbfc 110 111 2018-03-08 Megan Gardner <megan_gardner@apple.com> 112 113 Allow WebViews to disable system appearance 114 https://bugs.webkit.org/show_bug.cgi?id=183418 115 <rdar://problem/36975642> 116 117 Reviewed by Tim Horton. 118 119 Not currently testable, tests will be added in a later patch. 120 121 Allow webviews to choose whether or not to follow the default system appearance. 122 123 * css/StyleColor.cpp: 124 (WebCore::StyleColor::colorFromKeyword): 125 * css/StyleColor.h: 126 * css/StyleResolver.cpp: 127 (WebCore::StyleResolver::colorFromPrimitiveValue const): 128 * css/parser/CSSParser.cpp: 129 (WebCore::CSSParser::parseSystemColor): 130 * css/parser/CSSParser.h: 131 * css/parser/CSSParserMode.h: 132 * html/canvas/CanvasRenderingContext2D.cpp: 133 (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): 134 * html/canvas/CanvasRenderingContext2DBase.cpp: 135 (WebCore::CanvasRenderingContext2DBase::setStrokeColor): 136 (WebCore::CanvasRenderingContext2DBase::setFillColor): 137 * html/canvas/CanvasStyle.cpp: 138 (WebCore::parseColor): 139 (WebCore::parseColorOrCurrentColor): 140 (WebCore::CanvasStyle::createFromString): 141 (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): 142 * html/canvas/CanvasStyle.h: 143 * page/Page.h: 144 (WebCore::Page::useSystemAppearance const): 145 (WebCore::Page::setUseSystemAppearance): 146 * platform/Theme.cpp: 147 (WebCore::Theme::paint): 148 * platform/Theme.h: 149 * platform/mac/LocalDefaultSystemAppearance.h: 150 * platform/mac/LocalDefaultSystemAppearance.mm: 151 (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): 152 (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): 153 * platform/mac/ThemeMac.h: 154 * platform/mac/ThemeMac.mm: 155 (-[WebCoreThemeView initWithUseSystemAppearance:]): 156 (WebCore::paintToggleButton): 157 (WebCore::paintButton): 158 (WebCore::ThemeMac::ensuredView): 159 (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext): 160 (WebCore::ThemeMac::paint): 161 (-[WebCoreThemeView init]): Deleted. 162 * rendering/RenderTheme.cpp: 163 (WebCore::RenderTheme::paint): 164 (WebCore::RenderTheme::systemColor const): 165 (WebCore::RenderTheme::focusRingColor): 166 * rendering/RenderTheme.h: 167 (WebCore::RenderTheme::platformFocusRingColor const): 168 * rendering/RenderThemeIOS.mm: 169 (WebCore::RenderThemeIOS::systemColor const): 170 * rendering/RenderThemeMac.h: 171 * rendering/RenderThemeMac.mm: 172 (WebCore::RenderThemeMac::documentViewFor const): 173 (WebCore::RenderThemeMac::platformFocusRingColor const): 174 (WebCore::RenderThemeMac::systemColor const): 175 (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary): 176 (WebCore::RenderThemeMac::paintSliderThumb): 177 * rendering/TextPaintStyle.cpp: 178 (WebCore::computeTextPaintStyle): 179 1 180 2018-04-02 Jason Marcell <jmarcell@apple.com> 2 181 -
tags/Safari-606.1.7.4/Source/WebCore/css/StyleColor.cpp
r216902 r230182 38 38 namespace WebCore { 39 39 40 Color StyleColor::colorFromKeyword(CSSValueID keyword )40 Color StyleColor::colorFromKeyword(CSSValueID keyword, bool useSystemAppearance) 41 41 { 42 42 if (const char* valueName = getValueName(keyword)) { … … 44 44 return Color(namedColor->ARGBValue); 45 45 } 46 return RenderTheme::singleton().systemColor(keyword );46 return RenderTheme::singleton().systemColor(keyword, useSystemAppearance); 47 47 } 48 48 -
tags/Safari-606.1.7.4/Source/WebCore/css/StyleColor.h
r206538 r230182 51 51 const Color& resolve(const Color& currentColor) const { return m_currentColor ? currentColor : m_color; } 52 52 53 static Color colorFromKeyword(CSSValueID );53 static Color colorFromKeyword(CSSValueID, bool useSystemAppearance); 54 54 static bool isColorKeyword(CSSValueID); 55 55 static bool isSystemColor(CSSValueID); -
tags/Safari-606.1.7.4/Source/WebCore/css/StyleResolver.cpp
r228319 r230182 1823 1823 return document().activeLinkColor(); 1824 1824 case CSSValueWebkitFocusRingColor: 1825 return RenderTheme::focusRingColor( );1825 return RenderTheme::focusRingColor(document().useSystemAppearance()); 1826 1826 case CSSValueCurrentcolor: 1827 1827 // Color is an inherited property so depending on it effectively makes the property inherited. … … 1830 1830 return m_state.style()->color(); 1831 1831 default: 1832 return StyleColor::colorFromKeyword(identifier );1832 return StyleColor::colorFromKeyword(identifier, document().useSystemAppearance()); 1833 1833 } 1834 1834 } -
tags/Safari-606.1.7.4/Source/WebCore/css/parser/CSSParser.cpp
r228249 r230182 177 177 } 178 178 179 Color CSSParser::parseSystemColor(const String& string )179 Color CSSParser::parseSystemColor(const String& string, std::optional<const CSSParserContext&> context) 180 180 { 181 181 CSSValueID id = cssValueKeywordID(string); 182 182 if (!StyleColor::isSystemColor(id)) 183 183 return Color(); 184 185 return RenderTheme::singleton().systemColor(id); 184 if (context) 185 return RenderTheme::singleton().systemColor(id, context.value().useSystemAppearance); 186 return RenderTheme::singleton().systemColor(id, false); 186 187 } 187 188 -
tags/Safari-606.1.7.4/Source/WebCore/css/parser/CSSParser.h
r228249 r230182 79 79 80 80 static Color parseColor(const String&, bool strict = false); 81 static Color parseSystemColor(const String& );81 static Color parseSystemColor(const String&, std::optional<const CSSParserContext&>); 82 82 83 83 private: -
tags/Safari-606.1.7.4/Source/WebCore/css/parser/CSSParserMode.h
r227577 r230182 112 112 // This is only needed to support getMatchedCSSRules. 113 113 bool hasDocumentSecurityOrigin { false }; 114 115 bool useSystemAppearance { false }; 114 116 115 117 URL completeURL(const String& url) const -
tags/Safari-606.1.7.4/Source/WebCore/dom/Document.cpp
r229183 r230182 7030 7030 return deviceScaleFactor; 7031 7031 } 7032 7033 bool Document::useSystemAppearance() const 7034 { 7035 bool useSystemAppearance = false; 7036 if (Page* documentPage = page()) 7037 useSystemAppearance = documentPage->useSystemAppearance(); 7038 return useSystemAppearance; 7039 } 7040 7032 7041 void Document::didAssociateFormControl(Element* element) 7033 7042 { -
tags/Safari-606.1.7.4/Source/WebCore/dom/Document.h
r228949 r230182 545 545 546 546 float deviceScaleFactor() const; 547 548 bool useSystemAppearance() const; 547 549 548 550 WEBCORE_EXPORT Ref<Range> createRange(); -
tags/Safari-606.1.7.4/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r228974 r230182 85 85 if (!element.focused() || !state().hasInvertibleTransform || path.isEmpty() || !element.isDescendantOf(canvas()) || !context) 86 86 return; 87 context->drawFocusRing(path, 1, 1, RenderTheme::focusRingColor( ));87 context->drawFocusRing(path, 1, 1, RenderTheme::focusRingColor(element.document().useSystemAppearance())); 88 88 } 89 89 -
tags/Safari-606.1.7.4/Source/WebCore/html/canvas/CanvasStyle.cpp
r216902 r230182 54 54 if (color.isValid()) 55 55 return color; 56 return CSSParser::parseSystemColor(colorString );56 return CSSParser::parseSystemColor(colorString, std::nullopt); 57 57 } 58 58 -
tags/Safari-606.1.7.4/Source/WebCore/page/Page.h
r227280 r230182 325 325 void setEnclosedInScrollableAncestorView(bool f) { m_enclosedInScrollableAncestorView = f; } 326 326 #endif 327 328 bool useSystemAppearance() const { return m_useSystemAppearance; } 329 void setUseSystemAppearance(bool a) { m_useSystemAppearance = a; } 327 330 328 331 #if ENABLE(TEXT_AUTOSIZING) … … 700 703 bool m_enclosedInScrollableAncestorView { false }; 701 704 #endif 705 706 bool m_useSystemAppearance { false }; 702 707 703 708 #if ENABLE(TEXT_AUTOSIZING) -
tags/Safari-606.1.7.4/Source/WebCore/platform/Theme.cpp
r222253 r230182 58 58 } 59 59 60 void Theme::paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float )60 void Theme::paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float, bool) 61 61 { 62 62 } -
tags/Safari-606.1.7.4/Source/WebCore/platform/Theme.h
r223728 r230182 68 68 69 69 // Method for painting a control. The rect is in zoomed coordinates. 70 virtual void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor );70 virtual void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance); 71 71 72 72 // Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls repaint, -
tags/Safari-606.1.7.4/Source/WebCore/platform/mac/LocalDefaultSystemAppearance.h
r230179 r230182 31 31 #if USE(APPKIT) 32 32 33 OBJC_CLASS NSAppear ence;33 OBJC_CLASS NSAppearance; 34 34 35 35 namespace WebCore { … … 40 40 WTF_MAKE_NONCOPYABLE(LocalDefaultSystemAppearance); 41 41 public: 42 LocalDefaultSystemAppearance( );42 LocalDefaultSystemAppearance(bool useSystemAppearance); 43 43 ~LocalDefaultSystemAppearance(); 44 44 private: -
tags/Safari-606.1.7.4/Source/WebCore/platform/mac/LocalDefaultSystemAppearance.mm
r230179 r230182 32 32 namespace WebCore { 33 33 34 LocalDefaultSystemAppearance::LocalDefaultSystemAppearance( )34 LocalDefaultSystemAppearance::LocalDefaultSystemAppearance(bool useSystemAppearance) 35 35 : m_savedSystemAppearance() 36 36 { 37 m_savedSystemAppearance = [NSAppearance currentAppearance]; 38 NSAppearance *newAppearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; 39 [NSAppearance setCurrentAppearance:newAppearance]; 37 if (!useSystemAppearance) { 38 m_savedSystemAppearance = [NSAppearance currentAppearance]; 39 [NSAppearance setCurrentAppearance:[NSAppearance appearanceNamed:NSAppearanceNameAqua]]; 40 } 40 41 } 41 42 42 43 LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance() 43 44 { 44 [NSAppearance setCurrentAppearance:m_savedSystemAppearance.get()]; 45 if (m_savedSystemAppearance) 46 [NSAppearance setCurrentAppearance:m_savedSystemAppearance.get()]; 45 47 } 46 48 -
tags/Safari-606.1.7.4/Source/WebCore/platform/mac/ThemeMac.h
r228531 r230182 34 34 class ThemeMac final : public ThemeCocoa { 35 35 public: 36 static NSView *ensuredView(ScrollView*, const ControlStates&, bool use UnparentedView = false);36 static NSView *ensuredView(ScrollView*, const ControlStates&, bool useSystemAppearance, bool useUnparentedView = false); 37 37 static void setFocusRingClipRect(const FloatRect&); 38 static bool drawCellOrFocusRingWithViewIntoContext(NSCell *, GraphicsContext&, const FloatRect&, NSView *, bool drawButtonCell, bool drawFocusRing, bool useImageBuffer, float deviceScaleFactor );38 static bool drawCellOrFocusRingWithViewIntoContext(NSCell *, GraphicsContext&, const FloatRect&, NSView *, bool drawButtonCell, bool drawFocusRing, bool useImageBuffer, float deviceScaleFactor, bool useSystemAppearance); 39 39 40 40 private: … … 54 54 bool controlRequiresPreWhiteSpace(ControlPart part) const final { return part == PushButtonPart; } 55 55 56 void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor ) final;56 void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance) final; 57 57 void inflateControlPaintRect(ControlPart, const ControlStates&, FloatRect&, float zoomFactor) const final; 58 58 -
tags/Safari-606.1.7.4/Source/WebCore/platform/mac/ThemeMac.mm
r230180 r230182 69 69 @implementation WebCoreThemeView 70 70 71 - (instancetype)init 71 - (instancetype)initWithUseSystemAppearance:(BOOL)useSystemAppearance 72 72 { 73 73 if (!(self = [super init])) 74 74 return nil; 75 75 76 WebCore::LocalDefaultSystemAppearance localAppear ence;76 WebCore::LocalDefaultSystemAppearance localAppearance(useSystemAppearance); 77 77 [self setAppearance:[NSAppearance currentAppearance]]; 78 78 return self; … … 395 395 } 396 396 397 static void paintToggleButton(ControlPart buttonType, ControlStates& controlStates, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor )397 static void paintToggleButton(ControlPart buttonType, ControlStates& controlStates, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance) 398 398 { 399 399 BEGIN_BLOCK_OBJC_EXCEPTIONS … … 435 435 context.translate(-inflatedRect.location()); 436 436 } 437 438 437 LocalCurrentGraphicsContext localContext(context); 439 438 440 NSView *view = ThemeMac::ensuredView(scrollView, controlStates, true /* useUnparentedView */);439 NSView *view = ThemeMac::ensuredView(scrollView, controlStates, useSystemAppearance, true /* useUnparentedView */); 441 440 442 441 bool needsRepaint = false; … … 451 450 [toggleButtonCell _renderCurrentAnimationFrameInContext:context.platformContext() atLocation:NSMakePoint(0, 0)]; 452 451 if (![toggleButtonCell _stateAnimationRunning] && isCellFocused) 453 needsRepaint = ThemeMac::drawCellOrFocusRingWithViewIntoContext(toggleButtonCell.get(), context, inflatedRect, view, false, true, useImageBuffer, deviceScaleFactor );452 needsRepaint = ThemeMac::drawCellOrFocusRingWithViewIntoContext(toggleButtonCell.get(), context, inflatedRect, view, false, true, useImageBuffer, deviceScaleFactor, useSystemAppearance); 454 453 } else 455 needsRepaint = ThemeMac::drawCellOrFocusRingWithViewIntoContext(toggleButtonCell.get(), context, inflatedRect, view, true, isCellFocused, useImageBuffer, deviceScaleFactor );454 needsRepaint = ThemeMac::drawCellOrFocusRingWithViewIntoContext(toggleButtonCell.get(), context, inflatedRect, view, true, isCellFocused, useImageBuffer, deviceScaleFactor, useSystemAppearance); 456 455 457 456 [toggleButtonCell setControlView:nil]; … … 529 528 } 530 529 531 static void paintButton(ControlPart part, ControlStates& controlStates, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor )530 static void paintButton(ControlPart part, ControlStates& controlStates, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance) 532 531 { 533 532 BEGIN_BLOCK_OBJC_EXCEPTIONS … … 564 563 LocalCurrentGraphicsContext localContext(context); 565 564 566 NSView *view = ThemeMac::ensuredView(scrollView, controlStates );565 NSView *view = ThemeMac::ensuredView(scrollView, controlStates, useSystemAppearance); 567 566 NSWindow *window = [view window]; 568 LocalDefaultSystemAppearance localAppear ence;567 LocalDefaultSystemAppearance localAppearance(useSystemAppearance); 569 568 [window setAppearance:[NSAppearance currentAppearance]]; 570 569 NSButtonCell *previousDefaultButtonCell = [window defaultButtonCell]; 571 570 572 571 bool useImageBuffer = pageScaleFactor != 1.0f || zoomFactor != 1.0f; 573 bool needsRepaint = ThemeMac::drawCellOrFocusRingWithViewIntoContext(buttonCell, context, inflatedRect, view, true, states & ControlStates::FocusState, useImageBuffer, deviceScaleFactor );572 bool needsRepaint = ThemeMac::drawCellOrFocusRingWithViewIntoContext(buttonCell, context, inflatedRect, view, true, states & ControlStates::FocusState, useImageBuffer, deviceScaleFactor, useSystemAppearance); 574 573 if (states & ControlStates::DefaultState) 575 574 [window setDefaultButtonCell:buttonCell]; … … 649 648 // This will ensure that we always return a valid NSView, even if ScrollView doesn't have an associated document NSView. 650 649 // If the ScrollView doesn't have an NSView, we will return a fake NSView set up in the way AppKit expects. 651 NSView *ThemeMac::ensuredView(ScrollView* scrollView, const ControlStates& controlStates, bool use UnparentedView)650 NSView *ThemeMac::ensuredView(ScrollView* scrollView, const ControlStates& controlStates, bool useSystemAppearance, bool useUnparentedView) 652 651 { 653 652 if (!useUnparentedView) { … … 657 656 658 657 // Use a fake view. 659 static WebCoreThemeView *themeView = [[WebCoreThemeView alloc] init ];658 static WebCoreThemeView *themeView = [[WebCoreThemeView alloc] initWithUseSystemAppearance:useSystemAppearance]; 660 659 [themeView setFrameSize:NSSizeFromCGSize(scrollView->totalContentsSize())]; 661 660 … … 687 686 } 688 687 689 bool ThemeMac::drawCellOrFocusRingWithViewIntoContext(NSCell *cell, GraphicsContext& context, const FloatRect& rect, NSView *view, bool drawButtonCell, bool drawFocusRing, bool useImageBuffer, float deviceScaleFactor )688 bool ThemeMac::drawCellOrFocusRingWithViewIntoContext(NSCell *cell, GraphicsContext& context, const FloatRect& rect, NSView *view, bool drawButtonCell, bool drawFocusRing, bool useImageBuffer, float deviceScaleFactor, bool useSystemAppearance) 690 689 { 691 690 ASSERT(drawButtonCell || drawFocusRing); 692 LocalDefaultSystemAppearance localAppear ence;691 LocalDefaultSystemAppearance localAppearance(useSystemAppearance); 693 692 bool needsRepaint = false; 694 693 if (useImageBuffer) { … … 859 858 } 860 859 861 void ThemeMac::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor )860 void ThemeMac::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance) 862 861 { 863 862 switch (part) { 864 863 case CheckboxPart: 865 paintToggleButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor );864 paintToggleButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor, useSystemAppearance); 866 865 break; 867 866 case RadioPart: 868 paintToggleButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor );867 paintToggleButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor, useSystemAppearance); 869 868 break; 870 869 case PushButtonPart: … … 872 871 case ButtonPart: 873 872 case SquareButtonPart: 874 paintButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor );873 paintButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor, useSystemAppearance); 875 874 break; 876 875 case InnerSpinButtonPart: -
tags/Safari-606.1.7.4/Source/WebCore/platform/wpe/ThemeWPE.cpp
r219858 r230182 58 58 } 59 59 60 void ThemeWPE::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float, float )60 void ThemeWPE::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float, float, bool) 61 61 { 62 62 switch (part) { -
tags/Safari-606.1.7.4/Source/WebCore/platform/wpe/ThemeWPE.h
r219858 r230182 34 34 LengthSize controlSize(ControlPart, const FontCascade&, const LengthSize&, float) const final; 35 35 36 void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float ) final;36 void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float, bool) final; 37 37 38 38 void paintCheckbox(ControlStates&, GraphicsContext&, const FloatRect&, float); -
tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderListBox.cpp
r228908 r230182 461 461 backColor = theme().activeListBoxSelectionBackgroundColor(); 462 462 else 463 backColor = theme().inactiveListBoxSelectionBackgroundColor( );463 backColor = theme().inactiveListBoxSelectionBackgroundColor(document().useSystemAppearance()); 464 464 } else 465 465 backColor = itemStyle.visitedDependentColor(CSSPropertyBackgroundColor); -
tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderTheme.cpp
r229174 r230182 291 291 float deviceScaleFactor = box.document().deviceScaleFactor(); 292 292 FloatRect devicePixelSnappedRect = snapRectToDevicePixels(rect, deviceScaleFactor); 293 293 294 294 #if USE(NEW_THEME) 295 295 float pageScaleFactor = box.page().pageScaleFactor(); 296 296 297 297 switch (part) { 298 298 case CheckboxPart: … … 304 304 case InnerSpinButtonPart: 305 305 updateControlStatesForRenderer(box, controlStates); 306 Theme::singleton().paint(part, controlStates, paintInfo.context(), devicePixelSnappedRect, box.style().effectiveZoom(), &box.view().frameView(), deviceScaleFactor, pageScaleFactor );306 Theme::singleton().paint(part, controlStates, paintInfo.context(), devicePixelSnappedRect, box.style().effectiveZoom(), &box.view().frameView(), deviceScaleFactor, pageScaleFactor, box.page().useSystemAppearance()); 307 307 return false; 308 308 default: … … 615 615 } 616 616 617 Color RenderTheme::inactiveListBoxSelectionBackgroundColor( ) const617 Color RenderTheme::inactiveListBoxSelectionBackgroundColor(bool useSystemAppearance) const 618 618 { 619 619 if (!m_inactiveListBoxSelectionBackgroundColor.isValid()) 620 m_inactiveListBoxSelectionBackgroundColor = platformInactiveListBoxSelectionBackgroundColor( );620 m_inactiveListBoxSelectionBackgroundColor = platformInactiveListBoxSelectionBackgroundColor(useSystemAppearance); 621 621 return m_inactiveListBoxSelectionBackgroundColor; 622 622 } … … 671 671 } 672 672 673 Color RenderTheme::platformInactiveListBoxSelectionBackgroundColor( ) const673 Color RenderTheme::platformInactiveListBoxSelectionBackgroundColor(bool) const 674 674 { 675 675 return platformInactiveSelectionBackgroundColor(); … … 1209 1209 } 1210 1210 1211 Color RenderTheme::systemColor(CSSValueID cssValueId) const 1212 { 1211 Color RenderTheme::systemColor(CSSValueID cssValueId, bool useSystemAppearance) const 1212 { 1213 UNUSED_PARAM(useSystemAppearance); 1214 1213 1215 switch (cssValueId) { 1214 1216 case CSSValueActiveborder: … … 1326 1328 } 1327 1329 1328 Color RenderTheme::focusRingColor( )1329 { 1330 return customFocusRingColor().isValid() ? customFocusRingColor() : RenderTheme::singleton().platformFocusRingColor( );1330 Color RenderTheme::focusRingColor(bool useSystemAppearance) 1331 { 1332 return customFocusRingColor().isValid() ? customFocusRingColor() : RenderTheme::singleton().platformFocusRingColor(useSystemAppearance); 1331 1333 } 1332 1334 -
tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderTheme.h
r229174 r230182 141 141 Color activeListBoxSelectionBackgroundColor() const; 142 142 Color activeListBoxSelectionForegroundColor() const; 143 Color inactiveListBoxSelectionBackgroundColor( ) const;143 Color inactiveListBoxSelectionBackgroundColor(bool) const; 144 144 Color inactiveListBoxSelectionForegroundColor() const; 145 145 … … 150 150 virtual Color disabledTextColor(const Color& textColor, const Color& backgroundColor) const; 151 151 152 static Color focusRingColor( );153 virtual Color platformFocusRingColor( ) const { return Color(0, 0, 0); }152 static Color focusRingColor(bool useSystemAppearance); 153 virtual Color platformFocusRingColor(bool) const { return Color(0, 0, 0); } 154 154 static void setCustomFocusRingColor(const Color&); 155 155 static float platformFocusRingWidth() { return 3; } … … 165 165 // System fonts and colors for CSS. 166 166 void systemFont(CSSValueID, FontCascadeDescription&) const; 167 virtual Color systemColor(CSSValueID ) const;167 virtual Color systemColor(CSSValueID, bool useSystemAppearance) const; 168 168 169 169 virtual int minimumMenuListSize(const RenderStyle&) const { return 0; } … … 257 257 258 258 virtual Color platformActiveListBoxSelectionBackgroundColor() const; 259 virtual Color platformInactiveListBoxSelectionBackgroundColor( ) const;259 virtual Color platformInactiveListBoxSelectionBackgroundColor(bool) const; 260 260 virtual Color platformActiveListBoxSelectionForegroundColor() const; 261 261 virtual Color platformInactiveListBoxSelectionForegroundColor() const; -
tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeGtk.cpp
r229174 r230182 1742 1742 } 1743 1743 1744 Color RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor( ) const1744 Color RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor(bool) const 1745 1745 { 1746 1746 return styleColor(ListBox, GTK_STATE_FLAG_SELECTED, StyleColorBackground); … … 1757 1757 } 1758 1758 1759 Color RenderThemeGtk::systemColor(CSSValueID cssValueId ) const1759 Color RenderThemeGtk::systemColor(CSSValueID cssValueId, bool) const 1760 1760 { 1761 1761 switch (cssValueId) { … … 1765 1765 return styleColor(Entry, GTK_STATE_FLAG_ACTIVE, StyleColorForeground); 1766 1766 default: 1767 return RenderTheme::systemColor(cssValueId );1767 return RenderTheme::systemColor(cssValueId, false); 1768 1768 } 1769 1769 } -
tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeGtk.h
r229174 r230182 79 79 Color platformActiveListBoxSelectionBackgroundColor() const override; 80 80 Color platformActiveListBoxSelectionForegroundColor() const override; 81 Color platformInactiveListBoxSelectionBackgroundColor( ) const override;81 Color platformInactiveListBoxSelectionBackgroundColor(bool) const override; 82 82 Color platformInactiveListBoxSelectionForegroundColor() const override; 83 83 … … 87 87 88 88 // System colors. 89 Color systemColor(CSSValueID ) const override;89 Color systemColor(CSSValueID, bool) const override; 90 90 91 91 bool popsMenuBySpaceOrReturn() const override { return true; } -
tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeIOS.h
r229174 r230182 136 136 FloatRect addRoundedBorderClip(const RenderObject& box, GraphicsContext&, const IntRect&); 137 137 138 Color systemColor(CSSValueID ) const override;138 Color systemColor(CSSValueID, bool) const override; 139 139 140 140 String m_legacyMediaControlsScript; -
tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeIOS.mm
r229174 r230182 1398 1398 #endif // ENABLE(VIDEO) 1399 1399 1400 Color RenderThemeIOS::systemColor(CSSValueID cssValueID ) const1400 Color RenderThemeIOS::systemColor(CSSValueID cssValueID, bool) const 1401 1401 { 1402 1402 auto addResult = m_systemColorCache.add(cssValueID, Color()); … … 1435 1435 1436 1436 if (!color.isValid()) 1437 color = RenderTheme::systemColor(cssValueID );1437 color = RenderTheme::systemColor(cssValueID, false); 1438 1438 1439 1439 addResult.iterator->value = color; -
tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeMac.h
r229174 r230182 58 58 Color platformActiveListBoxSelectionBackgroundColor() const final; 59 59 Color platformActiveListBoxSelectionForegroundColor() const final; 60 Color platformInactiveListBoxSelectionBackgroundColor( ) const final;60 Color platformInactiveListBoxSelectionBackgroundColor(bool) const final; 61 61 Color platformInactiveListBoxSelectionForegroundColor() const final; 62 Color platformFocusRingColor( ) const final;62 Color platformFocusRingColor(bool useSystemAppearance) const final; 63 63 64 64 ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) final { return SmallScrollbar; } … … 170 170 String fileListNameForWidth(const FileList*, const FontCascade&, int width, bool multipleFilesAllowed) const final; 171 171 172 Color systemColor(CSSValueID ) const final;172 Color systemColor(CSSValueID, bool useSystemAppearance) const final; 173 173 174 174 void purgeCaches() final; -
tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeMac.mm
r230181 r230182 203 203 { 204 204 ControlStates states(extractControlStatesForRenderer(o)); 205 return ThemeMac::ensuredView(&o.view().frameView(), states );205 return ThemeMac::ensuredView(&o.view().frameView(), states, o.page().useSystemAppearance()); 206 206 } 207 207 … … 328 328 } 329 329 330 Color RenderThemeMac::platformFocusRingColor( ) const330 Color RenderThemeMac::platformFocusRingColor(bool useSystemAppearance) const 331 331 { 332 332 if (usesTestModeFocusRingColor()) 333 333 return oldAquaFocusRingColor(); 334 334 335 return systemColor(CSSValueWebkitFocusRingColor );336 } 337 338 Color RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor( ) const339 { 340 LocalDefaultSystemAppearance localAppearance ;335 return systemColor(CSSValueWebkitFocusRingColor, useSystemAppearance); 336 } 337 338 Color RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor(bool useSystemAppearance) const 339 { 340 LocalDefaultSystemAppearance localAppearance(useSystemAppearance); 341 341 return platformInactiveSelectionBackgroundColor(); 342 342 } … … 495 495 } 496 496 497 Color RenderThemeMac::systemColor(CSSValueID cssValueID ) const498 { 499 LocalDefaultSystemAppearance localAppear ence;500 return m_systemColorCache.ensure(cssValueID, [this, cssValueID ] () -> Color {497 Color RenderThemeMac::systemColor(CSSValueID cssValueID, bool useSystemAppearance) const 498 { 499 LocalDefaultSystemAppearance localAppearance(useSystemAppearance); 500 return m_systemColorCache.ensure(cssValueID, [this, cssValueID, useSystemAppearance] () -> Color { 501 501 auto selectCocoaColor = [cssValueID] () -> SEL { 502 502 switch (cssValueID) { … … 597 597 FALLTHROUGH; 598 598 default: 599 return RenderTheme::systemColor(cssValueID );599 return RenderTheme::systemColor(cssValueID, useSystemAppearance); 600 600 } 601 601 }).iterator->value; … … 1434 1434 bool shouldUseImageBuffer = renderer.style().effectiveZoom() != 1 || renderer.page().pageScaleFactor() != 1; 1435 1435 bool shouldDrawCell = true; 1436 if (ThemeMac::drawCellOrFocusRingWithViewIntoContext(cell, paintInfo.context(), rect, documentViewFor(renderer), shouldDrawCell, shouldDrawFocusRing, shouldUseImageBuffer, renderer.page().deviceScaleFactor() ))1436 if (ThemeMac::drawCellOrFocusRingWithViewIntoContext(cell, paintInfo.context(), rect, documentViewFor(renderer), shouldDrawCell, shouldDrawFocusRing, shouldUseImageBuffer, renderer.page().deviceScaleFactor(), renderer.page().useSystemAppearance())) 1437 1437 renderer.page().focusController().setFocusedElementNeedsRepaint(); 1438 1438 } … … 1563 1563 float deviceScaleFactor = o.page().deviceScaleFactor(); 1564 1564 bool shouldUseImageBuffer = deviceScaleFactor != 1 || zoomLevel != 1; 1565 ThemeMac::drawCellOrFocusRingWithViewIntoContext(sliderThumbCell, paintInfo.context(), unzoomedRect, view, shouldDrawCell, shouldDrawFocusRing, shouldUseImageBuffer, deviceScaleFactor );1565 ThemeMac::drawCellOrFocusRingWithViewIntoContext(sliderThumbCell, paintInfo.context(), unzoomedRect, view, shouldDrawCell, shouldDrawFocusRing, shouldUseImageBuffer, deviceScaleFactor, o.page().useSystemAppearance()); 1566 1566 [sliderThumbCell setControlView:nil]; 1567 1567 -
tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeWin.cpp
r226205 r230182 1013 1013 } 1014 1014 1015 Color RenderThemeWin::systemColor(CSSValueID cssValueId ) const1015 Color RenderThemeWin::systemColor(CSSValueID cssValueId, bool) const 1016 1016 { 1017 1017 int sysColorIndex = cssValueIdToSysColorIndex(cssValueId); 1018 1018 if (sysColorIndex == -1) 1019 return RenderTheme::systemColor(cssValueId );1019 return RenderTheme::systemColor(cssValueId, false); 1020 1020 1021 1021 COLORREF color = GetSysColor(sysColorIndex); -
tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeWin.h
r219595 r230182 60 60 Color platformInactiveSelectionForegroundColor() const override; 61 61 62 Color systemColor(CSSValueID ) const override;62 Color systemColor(CSSValueID, bool) const override; 63 63 64 64 bool paintCheckbox(const RenderObject& o, const PaintInfo& i, const IntRect& r) override -
tags/Safari-606.1.7.4/Source/WebCore/rendering/TextPaintStyle.cpp
r229147 r230182 99 99 Page* page = frame.page(); 100 100 if (page && page->focusController().isActive()) { 101 paintStyle.fillColor = RenderTheme::singleton().systemColor(CSSValueActivebuttontext );101 paintStyle.fillColor = RenderTheme::singleton().systemColor(CSSValueActivebuttontext, page->useSystemAppearance()); 102 102 return paintStyle; 103 103 } -
tags/Safari-606.1.7.4/Source/WebKit/ChangeLog
r229902 r230182 1 2018-04-02 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r229448. rdar://problem/36975642 4 5 Allow WebViews to disable system appearance 6 https://bugs.webkit.org/show_bug.cgi?id=183418 7 <rdar://problem/36975642> 8 9 Reviewed by Tim Horton. 10 Source/WebCore: 11 12 13 Not currently testable, tests will be added in a later patch. 14 15 Allow webviews to choose whether or not to follow the default system appearance. 16 17 * css/StyleColor.cpp: 18 (WebCore::StyleColor::colorFromKeyword): 19 * css/StyleColor.h: 20 * css/StyleResolver.cpp: 21 (WebCore::StyleResolver::colorFromPrimitiveValue const): 22 * css/parser/CSSParser.cpp: 23 (WebCore::CSSParser::parseSystemColor): 24 * css/parser/CSSParser.h: 25 * css/parser/CSSParserMode.h: 26 * html/canvas/CanvasRenderingContext2D.cpp: 27 (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): 28 * html/canvas/CanvasRenderingContext2DBase.cpp: 29 (WebCore::CanvasRenderingContext2DBase::setStrokeColor): 30 (WebCore::CanvasRenderingContext2DBase::setFillColor): 31 * html/canvas/CanvasStyle.cpp: 32 (WebCore::parseColor): 33 (WebCore::parseColorOrCurrentColor): 34 (WebCore::CanvasStyle::createFromString): 35 (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): 36 * html/canvas/CanvasStyle.h: 37 * page/Page.h: 38 (WebCore::Page::useSystemAppearance const): 39 (WebCore::Page::setUseSystemAppearance): 40 * platform/Theme.cpp: 41 (WebCore::Theme::paint): 42 * platform/Theme.h: 43 * platform/mac/LocalDefaultSystemAppearance.h: 44 * platform/mac/LocalDefaultSystemAppearance.mm: 45 (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): 46 (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): 47 * platform/mac/ThemeMac.h: 48 * platform/mac/ThemeMac.mm: 49 (-[WebCoreThemeView initWithUseSystemAppearance:]): 50 (WebCore::paintToggleButton): 51 (WebCore::paintButton): 52 (WebCore::ThemeMac::ensuredView): 53 (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext): 54 (WebCore::ThemeMac::paint): 55 (-[WebCoreThemeView init]): Deleted. 56 * rendering/RenderTheme.cpp: 57 (WebCore::RenderTheme::paint): 58 (WebCore::RenderTheme::systemColor const): 59 (WebCore::RenderTheme::focusRingColor): 60 * rendering/RenderTheme.h: 61 (WebCore::RenderTheme::platformFocusRingColor const): 62 * rendering/RenderThemeIOS.mm: 63 (WebCore::RenderThemeIOS::systemColor const): 64 * rendering/RenderThemeMac.h: 65 * rendering/RenderThemeMac.mm: 66 (WebCore::RenderThemeMac::documentViewFor const): 67 (WebCore::RenderThemeMac::platformFocusRingColor const): 68 (WebCore::RenderThemeMac::systemColor const): 69 (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary): 70 (WebCore::RenderThemeMac::paintSliderThumb): 71 * rendering/TextPaintStyle.cpp: 72 (WebCore::computeTextPaintStyle): 73 74 Source/WebKit: 75 76 77 Allow webviews to choose whether or not to follow the default system appearance. 78 79 * Shared/WebPageCreationParameters.cpp: 80 (WebKit::WebPageCreationParameters::encode const): 81 (WebKit::WebPageCreationParameters::decode): 82 * Shared/WebPageCreationParameters.h: 83 * UIProcess/API/Cocoa/WKWebView.mm: 84 (-[WKWebView _useSystemAppearance]): 85 (-[WKWebView _setUseSystemAppearance:]): 86 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 87 * UIProcess/WebPageProxy.cpp: 88 (WebKit::WebPageProxy::creationParameters): 89 (WebKit::WebPageProxy::setUseSystemAppearance): 90 * UIProcess/WebPageProxy.h: 91 (WebKit::WebPageProxy::useSystemAppearance const): 92 * WebProcess/WebPage/WebPage.cpp: 93 (WebKit::WebPage::setUseSystemAppearance): 94 * WebProcess/WebPage/WebPage.h: 95 * WebProcess/WebPage/WebPage.messages.in: 96 97 Source/WebKitLegacy/mac: 98 99 100 Allow webviews to choose whether or not to follow the default system appearance. 101 102 * WebView/WebView.mm: 103 (-[WebView _setUseSystemAppearance:]): 104 (-[WebView _useSystemAppearance]): 105 * WebView/WebViewPrivate.h: 106 107 108 109 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229448 268f45cc-cd09-0410-ab3c-d52691b4dbfc 110 111 2018-03-08 Megan Gardner <megan_gardner@apple.com> 112 113 Allow WebViews to disable system appearance 114 https://bugs.webkit.org/show_bug.cgi?id=183418 115 <rdar://problem/36975642> 116 117 Reviewed by Tim Horton. 118 119 Allow webviews to choose whether or not to follow the default system appearance. 120 121 * Shared/WebPageCreationParameters.cpp: 122 (WebKit::WebPageCreationParameters::encode const): 123 (WebKit::WebPageCreationParameters::decode): 124 * Shared/WebPageCreationParameters.h: 125 * UIProcess/API/Cocoa/WKWebView.mm: 126 (-[WKWebView _useSystemAppearance]): 127 (-[WKWebView _setUseSystemAppearance:]): 128 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 129 * UIProcess/WebPageProxy.cpp: 130 (WebKit::WebPageProxy::creationParameters): 131 (WebKit::WebPageProxy::setUseSystemAppearance): 132 * UIProcess/WebPageProxy.h: 133 (WebKit::WebPageProxy::useSystemAppearance const): 134 * WebProcess/WebPage/WebPage.cpp: 135 (WebKit::WebPage::setUseSystemAppearance): 136 * WebProcess/WebPage/WebPage.h: 137 * WebProcess/WebPage/WebPage.messages.in: 138 1 139 2018-03-23 Jason Marcell <jmarcell@apple.com> 2 140 -
tags/Safari-606.1.7.4/Source/WebKit/Shared/WebPageCreationParameters.cpp
r229063 r230182 82 82 #if PLATFORM(MAC) 83 83 encoder << colorSpace; 84 encoder << useSystemAppearance; 84 85 #endif 85 86 #if PLATFORM(IOS) … … 233 234 if (!decoder.decode(parameters.colorSpace)) 234 235 return std::nullopt; 236 if (!decoder.decode(parameters.useSystemAppearance)) 237 return std::nullopt; 235 238 #endif 236 239 -
tags/Safari-606.1.7.4/Source/WebKit/Shared/WebPageCreationParameters.h
r229063 r230182 139 139 #if PLATFORM(MAC) 140 140 ColorSpaceData colorSpace; 141 bool useSystemAppearance; 141 142 #endif 142 143 #if PLATFORM(IOS) -
tags/Safari-606.1.7.4/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r229182 r230182 6140 6140 } 6141 6141 6142 - (BOOL)_useSystemAppearance 6143 { 6144 return _page->useSystemAppearance(); 6145 } 6146 6147 - (void)_setUseSystemAppearance:(BOOL)useSystemAppearance 6148 { 6149 _page->setUseSystemAppearance(useSystemAppearance); 6150 } 6151 6142 6152 - (void)_setHeaderBannerHeight:(int)height 6143 6153 { -
tags/Safari-606.1.7.4/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
r229063 r230182 440 440 - (void)_insertText:(id)string replacementRange:(NSRange)replacementRange WK_API_AVAILABLE(macosx(10.12.3)); 441 441 - (NSRect)_candidateRect WK_API_AVAILABLE(macosx(10.13)); 442 @property (nonatomic, readwrite, setter=_setUseSystemAppearance:) BOOL _useSystemAppearance WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 442 443 443 444 - (void)_setHeaderBannerHeight:(int)height WK_API_AVAILABLE(macosx(10.12.3)); -
tags/Safari-606.1.7.4/Source/WebKit/UIProcess/WebPageProxy.cpp
r229201 r230182 5849 5849 #if PLATFORM(MAC) 5850 5850 parameters.colorSpace = m_pageClient.colorSpace(); 5851 parameters.useSystemAppearance = m_useSystemAppearance; 5851 5852 #endif 5852 5853 #if PLATFORM(IOS) … … 6946 6947 m_pageClient.didHandleAcceptedCandidate(); 6947 6948 } 6949 6950 void WebPageProxy::setUseSystemAppearance(bool useSystemAppearance) 6951 { 6952 if (!isValid()) 6953 return; 6954 6955 if (useSystemAppearance == m_useSystemAppearance) 6956 return; 6957 6958 m_useSystemAppearance = useSystemAppearance; 6959 m_process->send(Messages::WebPage::SetUseSystemAppearance(useSystemAppearance), m_pageID); 6960 } 6948 6961 6949 6962 void WebPageProxy::setHeaderBannerHeightForTesting(int height) -
tags/Safari-606.1.7.4/Source/WebKit/UIProcess/WebPageProxy.h
r229063 r230182 799 799 bool paginationLineGridEnabled() const { return m_paginationLineGridEnabled; } 800 800 unsigned pageCount() const { return m_pageCount; } 801 802 #if PLATFORM(MAC) 803 void setUseSystemAppearance(bool); 804 bool useSystemAppearance() const { return m_useSystemAppearance; } 805 #endif 801 806 802 807 #if PLATFORM(COCOA) … … 1787 1792 bool m_isScrollingOrZooming { false }; 1788 1793 #endif 1794 1795 #if PLATFORM(MAC) 1796 bool m_useSystemAppearance { false }; 1797 #endif 1789 1798 1790 1799 #if ENABLE(APPLE_PAY) -
tags/Safari-606.1.7.4/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r229063 r230182 4120 4120 } 4121 4121 4122 void WebPage::setUseSystemAppearance(bool useSystemAppearance) 4123 { 4124 corePage()->setUseSystemAppearance(useSystemAppearance); 4125 } 4122 4126 #endif 4123 4127 -
tags/Safari-606.1.7.4/Source/WebKit/WebProcess/WebPage/WebPage.h
r229063 r230182 489 489 void setTopOverhangImage(WebImage*); 490 490 void setBottomOverhangImage(WebImage*); 491 492 void setUseSystemAppearance(bool); 491 493 #endif 492 494 -
tags/Safari-606.1.7.4/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r229063 r230182 443 443 HandleAcceptedCandidate(struct WebCore::TextCheckingResult acceptedCandidate) 444 444 445 SetUseSystemAppearance(bool useSystemAppearance); 446 445 447 SetHeaderBannerHeightForTesting(int height); 446 448 SetFooterBannerHeightForTesting(int height); -
tags/Safari-606.1.7.4/Source/WebKitLegacy/mac/ChangeLog
r229205 r230182 1 2018-04-02 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r229448. rdar://problem/36975642 4 5 Allow WebViews to disable system appearance 6 https://bugs.webkit.org/show_bug.cgi?id=183418 7 <rdar://problem/36975642> 8 9 Reviewed by Tim Horton. 10 Source/WebCore: 11 12 13 Not currently testable, tests will be added in a later patch. 14 15 Allow webviews to choose whether or not to follow the default system appearance. 16 17 * css/StyleColor.cpp: 18 (WebCore::StyleColor::colorFromKeyword): 19 * css/StyleColor.h: 20 * css/StyleResolver.cpp: 21 (WebCore::StyleResolver::colorFromPrimitiveValue const): 22 * css/parser/CSSParser.cpp: 23 (WebCore::CSSParser::parseSystemColor): 24 * css/parser/CSSParser.h: 25 * css/parser/CSSParserMode.h: 26 * html/canvas/CanvasRenderingContext2D.cpp: 27 (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): 28 * html/canvas/CanvasRenderingContext2DBase.cpp: 29 (WebCore::CanvasRenderingContext2DBase::setStrokeColor): 30 (WebCore::CanvasRenderingContext2DBase::setFillColor): 31 * html/canvas/CanvasStyle.cpp: 32 (WebCore::parseColor): 33 (WebCore::parseColorOrCurrentColor): 34 (WebCore::CanvasStyle::createFromString): 35 (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): 36 * html/canvas/CanvasStyle.h: 37 * page/Page.h: 38 (WebCore::Page::useSystemAppearance const): 39 (WebCore::Page::setUseSystemAppearance): 40 * platform/Theme.cpp: 41 (WebCore::Theme::paint): 42 * platform/Theme.h: 43 * platform/mac/LocalDefaultSystemAppearance.h: 44 * platform/mac/LocalDefaultSystemAppearance.mm: 45 (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): 46 (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): 47 * platform/mac/ThemeMac.h: 48 * platform/mac/ThemeMac.mm: 49 (-[WebCoreThemeView initWithUseSystemAppearance:]): 50 (WebCore::paintToggleButton): 51 (WebCore::paintButton): 52 (WebCore::ThemeMac::ensuredView): 53 (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext): 54 (WebCore::ThemeMac::paint): 55 (-[WebCoreThemeView init]): Deleted. 56 * rendering/RenderTheme.cpp: 57 (WebCore::RenderTheme::paint): 58 (WebCore::RenderTheme::systemColor const): 59 (WebCore::RenderTheme::focusRingColor): 60 * rendering/RenderTheme.h: 61 (WebCore::RenderTheme::platformFocusRingColor const): 62 * rendering/RenderThemeIOS.mm: 63 (WebCore::RenderThemeIOS::systemColor const): 64 * rendering/RenderThemeMac.h: 65 * rendering/RenderThemeMac.mm: 66 (WebCore::RenderThemeMac::documentViewFor const): 67 (WebCore::RenderThemeMac::platformFocusRingColor const): 68 (WebCore::RenderThemeMac::systemColor const): 69 (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary): 70 (WebCore::RenderThemeMac::paintSliderThumb): 71 * rendering/TextPaintStyle.cpp: 72 (WebCore::computeTextPaintStyle): 73 74 Source/WebKit: 75 76 77 Allow webviews to choose whether or not to follow the default system appearance. 78 79 * Shared/WebPageCreationParameters.cpp: 80 (WebKit::WebPageCreationParameters::encode const): 81 (WebKit::WebPageCreationParameters::decode): 82 * Shared/WebPageCreationParameters.h: 83 * UIProcess/API/Cocoa/WKWebView.mm: 84 (-[WKWebView _useSystemAppearance]): 85 (-[WKWebView _setUseSystemAppearance:]): 86 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 87 * UIProcess/WebPageProxy.cpp: 88 (WebKit::WebPageProxy::creationParameters): 89 (WebKit::WebPageProxy::setUseSystemAppearance): 90 * UIProcess/WebPageProxy.h: 91 (WebKit::WebPageProxy::useSystemAppearance const): 92 * WebProcess/WebPage/WebPage.cpp: 93 (WebKit::WebPage::setUseSystemAppearance): 94 * WebProcess/WebPage/WebPage.h: 95 * WebProcess/WebPage/WebPage.messages.in: 96 97 Source/WebKitLegacy/mac: 98 99 100 Allow webviews to choose whether or not to follow the default system appearance. 101 102 * WebView/WebView.mm: 103 (-[WebView _setUseSystemAppearance:]): 104 (-[WebView _useSystemAppearance]): 105 * WebView/WebViewPrivate.h: 106 107 108 109 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229448 268f45cc-cd09-0410-ab3c-d52691b4dbfc 110 111 2018-03-08 Megan Gardner <megan_gardner@apple.com> 112 113 Allow WebViews to disable system appearance 114 https://bugs.webkit.org/show_bug.cgi?id=183418 115 <rdar://problem/36975642> 116 117 Reviewed by Tim Horton. 118 119 Allow webviews to choose whether or not to follow the default system appearance. 120 121 * WebView/WebView.mm: 122 (-[WebView _setUseSystemAppearance:]): 123 (-[WebView _useSystemAppearance]): 124 * WebView/WebViewPrivate.h: 125 1 126 2018-03-04 Tim Horton <timothy_horton@apple.com> 2 127 -
tags/Safari-606.1.7.4/Source/WebKitLegacy/mac/WebView/WebView.mm
r228486 r230182 5191 5191 } 5192 5192 5193 - (void)_setUseSystemAppearance:(BOOL)useSystemAppearance 5194 { 5195 if (auto page = _private->page) 5196 page->setUseSystemAppearance(useSystemAppearance); 5197 } 5198 5199 - (BOOL)_useSystemAppearance 5200 { 5201 if (auto page = _private->page) 5202 return page->useSystemAppearance(); 5203 return NO; 5204 } 5205 5193 5206 - (void)_setSourceApplicationAuditData:(NSData *)sourceApplicationAuditData 5194 5207 { -
tags/Safari-606.1.7.4/Source/WebKitLegacy/mac/WebView/WebViewPrivate.h
r227205 r230182 928 928 @property (nonatomic, assign, setter=_setUnobscuredSafeAreaInsets:) WebEdgeInsets _unobscuredSafeAreaInsets; 929 929 930 @property (nonatomic, assign, setter=_setUseSystemAppearance:) BOOL _useSystemAppearance; 931 930 932 @end 931 933
Note: See TracChangeset
for help on using the changeset viewer.