Changeset 230182 in webkit


Ignore:
Timestamp:
Apr 2, 2018 2:06:07 PM (5 years ago)
Author:
jmarcell@apple.com
Message:

Cherry-pick r229448. rdar://problem/36975642

Allow WebViews to disable system appearance
https://bugs.webkit.org/show_bug.cgi?id=183418
<rdar://problem/36975642>

Reviewed by Tim Horton.
Source/WebCore:

Not currently testable, tests will be added in a later patch.

Allow webviews to choose whether or not to follow the default system appearance.

  • css/StyleColor.cpp: (WebCore::StyleColor::colorFromKeyword):
  • css/StyleColor.h:
  • css/StyleResolver.cpp: (WebCore::StyleResolver::colorFromPrimitiveValue const):
  • css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSystemColor):
  • css/parser/CSSParser.h:
  • css/parser/CSSParserMode.h:
  • html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal):
  • html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::setStrokeColor): (WebCore::CanvasRenderingContext2DBase::setFillColor):
  • html/canvas/CanvasStyle.cpp: (WebCore::parseColor): (WebCore::parseColorOrCurrentColor): (WebCore::CanvasStyle::createFromString): (WebCore::CanvasStyle::createFromStringWithOverrideAlpha):
  • html/canvas/CanvasStyle.h:
  • page/Page.h: (WebCore::Page::useSystemAppearance const): (WebCore::Page::setUseSystemAppearance):
  • platform/Theme.cpp: (WebCore::Theme::paint):
  • platform/Theme.h:
  • platform/mac/LocalDefaultSystemAppearance.h:
  • platform/mac/LocalDefaultSystemAppearance.mm: (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
  • platform/mac/ThemeMac.h:
  • platform/mac/ThemeMac.mm: (-[WebCoreThemeView initWithUseSystemAppearance:]): (WebCore::paintToggleButton): (WebCore::paintButton): (WebCore::ThemeMac::ensuredView): (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext): (WebCore::ThemeMac::paint): (-[WebCoreThemeView init]): Deleted.
  • rendering/RenderTheme.cpp: (WebCore::RenderTheme::paint): (WebCore::RenderTheme::systemColor const): (WebCore::RenderTheme::focusRingColor):
  • rendering/RenderTheme.h: (WebCore::RenderTheme::platformFocusRingColor const):
  • rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::systemColor const):
  • rendering/RenderThemeMac.h:
  • rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::documentViewFor const): (WebCore::RenderThemeMac::platformFocusRingColor const): (WebCore::RenderThemeMac::systemColor const): (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary): (WebCore::RenderThemeMac::paintSliderThumb):
  • rendering/TextPaintStyle.cpp: (WebCore::computeTextPaintStyle):

Source/WebKit:

Allow webviews to choose whether or not to follow the default system appearance.

  • Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode):
  • Shared/WebPageCreationParameters.h:
  • UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _useSystemAppearance]): (-[WKWebView _setUseSystemAppearance:]):
  • UIProcess/API/Cocoa/WKWebViewPrivate.h:
  • UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::creationParameters): (WebKit::WebPageProxy::setUseSystemAppearance):
  • UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::useSystemAppearance const):
  • WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setUseSystemAppearance):
  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:

Source/WebKitLegacy/mac:

Allow webviews to choose whether or not to follow the default system appearance.

  • WebView/WebView.mm: (-[WebView _setUseSystemAppearance:]): (-[WebView _useSystemAppearance]):
  • WebView/WebViewPrivate.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229448 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
tags/Safari-606.1.7.4/Source
Files:
45 edited

Legend:

Unmodified
Added
Removed
  • tags/Safari-606.1.7.4/Source/WebCore/ChangeLog

    r230181 r230182  
     12018-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
    11802018-04-02  Jason Marcell  <jmarcell@apple.com>
    2181
  • tags/Safari-606.1.7.4/Source/WebCore/css/StyleColor.cpp

    r216902 r230182  
    3838namespace WebCore {
    3939
    40 Color StyleColor::colorFromKeyword(CSSValueID keyword)
     40Color StyleColor::colorFromKeyword(CSSValueID keyword, bool useSystemAppearance)
    4141{
    4242    if (const char* valueName = getValueName(keyword)) {
     
    4444            return Color(namedColor->ARGBValue);
    4545    }
    46     return RenderTheme::singleton().systemColor(keyword);
     46    return RenderTheme::singleton().systemColor(keyword, useSystemAppearance);
    4747}
    4848
  • tags/Safari-606.1.7.4/Source/WebCore/css/StyleColor.h

    r206538 r230182  
    5151    const Color& resolve(const Color& currentColor) const { return m_currentColor ? currentColor : m_color; }
    5252
    53     static Color colorFromKeyword(CSSValueID);
     53    static Color colorFromKeyword(CSSValueID, bool useSystemAppearance);
    5454    static bool isColorKeyword(CSSValueID);
    5555    static bool isSystemColor(CSSValueID);
  • tags/Safari-606.1.7.4/Source/WebCore/css/StyleResolver.cpp

    r228319 r230182  
    18231823        return document().activeLinkColor();
    18241824    case CSSValueWebkitFocusRingColor:
    1825         return RenderTheme::focusRingColor();
     1825        return RenderTheme::focusRingColor(document().useSystemAppearance());
    18261826    case CSSValueCurrentcolor:
    18271827        // Color is an inherited property so depending on it effectively makes the property inherited.
     
    18301830        return m_state.style()->color();
    18311831    default:
    1832         return StyleColor::colorFromKeyword(identifier);
     1832        return StyleColor::colorFromKeyword(identifier, document().useSystemAppearance());
    18331833    }
    18341834}
  • tags/Safari-606.1.7.4/Source/WebCore/css/parser/CSSParser.cpp

    r228249 r230182  
    177177}
    178178
    179 Color CSSParser::parseSystemColor(const String& string)
     179Color CSSParser::parseSystemColor(const String& string, std::optional<const CSSParserContext&> context)
    180180{
    181181    CSSValueID id = cssValueKeywordID(string);
    182182    if (!StyleColor::isSystemColor(id))
    183183        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);
    186187}
    187188
  • tags/Safari-606.1.7.4/Source/WebCore/css/parser/CSSParser.h

    r228249 r230182  
    7979
    8080    static Color parseColor(const String&, bool strict = false);
    81     static Color parseSystemColor(const String&);
     81    static Color parseSystemColor(const String&, std::optional<const CSSParserContext&>);
    8282
    8383private:
  • tags/Safari-606.1.7.4/Source/WebCore/css/parser/CSSParserMode.h

    r227577 r230182  
    112112    // This is only needed to support getMatchedCSSRules.
    113113    bool hasDocumentSecurityOrigin { false };
     114   
     115    bool useSystemAppearance { false };
    114116
    115117    URL completeURL(const String& url) const
  • tags/Safari-606.1.7.4/Source/WebCore/dom/Document.cpp

    r229183 r230182  
    70307030    return deviceScaleFactor;
    70317031}
     7032   
     7033bool Document::useSystemAppearance() const
     7034{
     7035    bool useSystemAppearance = false;
     7036    if (Page* documentPage = page())
     7037        useSystemAppearance = documentPage->useSystemAppearance();
     7038    return useSystemAppearance;
     7039}
     7040   
    70327041void Document::didAssociateFormControl(Element* element)
    70337042{
  • tags/Safari-606.1.7.4/Source/WebCore/dom/Document.h

    r228949 r230182  
    545545
    546546    float deviceScaleFactor() const;
     547       
     548    bool useSystemAppearance() const;
    547549
    548550    WEBCORE_EXPORT Ref<Range> createRange();
  • tags/Safari-606.1.7.4/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r228974 r230182  
    8585    if (!element.focused() || !state().hasInvertibleTransform || path.isEmpty() || !element.isDescendantOf(canvas()) || !context)
    8686        return;
    87     context->drawFocusRing(path, 1, 1, RenderTheme::focusRingColor());
     87    context->drawFocusRing(path, 1, 1, RenderTheme::focusRingColor(element.document().useSystemAppearance()));
    8888}
    8989
  • tags/Safari-606.1.7.4/Source/WebCore/html/canvas/CanvasStyle.cpp

    r216902 r230182  
    5454    if (color.isValid())
    5555        return color;
    56     return CSSParser::parseSystemColor(colorString);
     56    return CSSParser::parseSystemColor(colorString, std::nullopt);
    5757}
    5858
  • tags/Safari-606.1.7.4/Source/WebCore/page/Page.h

    r227280 r230182  
    325325    void setEnclosedInScrollableAncestorView(bool f) { m_enclosedInScrollableAncestorView = f; }
    326326#endif
     327   
     328    bool useSystemAppearance() const { return m_useSystemAppearance; }
     329    void setUseSystemAppearance(bool a) { m_useSystemAppearance = a; }
    327330
    328331#if ENABLE(TEXT_AUTOSIZING)
     
    700703    bool m_enclosedInScrollableAncestorView { false };
    701704#endif
     705   
     706    bool m_useSystemAppearance { false };
    702707
    703708#if ENABLE(TEXT_AUTOSIZING)
  • tags/Safari-606.1.7.4/Source/WebCore/platform/Theme.cpp

    r222253 r230182  
    5858}
    5959
    60 void Theme::paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float)
     60void Theme::paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float, bool)
    6161{
    6262}
  • tags/Safari-606.1.7.4/Source/WebCore/platform/Theme.h

    r223728 r230182  
    6868
    6969    // 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);
    7171
    7272    // 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  
    3131#if USE(APPKIT)
    3232
    33 OBJC_CLASS NSAppearence;
     33OBJC_CLASS NSAppearance;
    3434
    3535namespace WebCore {
     
    4040    WTF_MAKE_NONCOPYABLE(LocalDefaultSystemAppearance);
    4141public:
    42     LocalDefaultSystemAppearance();
     42    LocalDefaultSystemAppearance(bool useSystemAppearance);
    4343    ~LocalDefaultSystemAppearance();
    4444private:
  • tags/Safari-606.1.7.4/Source/WebCore/platform/mac/LocalDefaultSystemAppearance.mm

    r230179 r230182  
    3232namespace WebCore {
    3333   
    34 LocalDefaultSystemAppearance::LocalDefaultSystemAppearance()
     34LocalDefaultSystemAppearance::LocalDefaultSystemAppearance(bool useSystemAppearance)
    3535    : m_savedSystemAppearance()
    3636{
    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    }
    4041}
    4142
    4243LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance()
    4344{
    44     [NSAppearance setCurrentAppearance:m_savedSystemAppearance.get()];
     45    if (m_savedSystemAppearance)
     46        [NSAppearance setCurrentAppearance:m_savedSystemAppearance.get()];
    4547}
    4648   
  • tags/Safari-606.1.7.4/Source/WebCore/platform/mac/ThemeMac.h

    r228531 r230182  
    3434class ThemeMac final : public ThemeCocoa {
    3535public:
    36     static NSView *ensuredView(ScrollView*, const ControlStates&, bool useUnparentedView = false);
     36    static NSView *ensuredView(ScrollView*, const ControlStates&, bool useSystemAppearance, bool useUnparentedView = false);
    3737    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);
    3939
    4040private:
     
    5454    bool controlRequiresPreWhiteSpace(ControlPart part) const final { return part == PushButtonPart; }
    5555
    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;
    5757    void inflateControlPaintRect(ControlPart, const ControlStates&, FloatRect&, float zoomFactor) const final;
    5858
  • tags/Safari-606.1.7.4/Source/WebCore/platform/mac/ThemeMac.mm

    r230180 r230182  
    6969@implementation WebCoreThemeView
    7070
    71 - (instancetype)init
     71- (instancetype)initWithUseSystemAppearance:(BOOL)useSystemAppearance
    7272{
    7373    if (!(self = [super init]))
    7474        return nil;
    7575   
    76     WebCore::LocalDefaultSystemAppearance localAppearence;
     76    WebCore::LocalDefaultSystemAppearance localAppearance(useSystemAppearance);
    7777    [self setAppearance:[NSAppearance currentAppearance]];
    7878    return self;
     
    395395}
    396396
    397 static void paintToggleButton(ControlPart buttonType, ControlStates& controlStates, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor)
     397static void paintToggleButton(ControlPart buttonType, ControlStates& controlStates, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance)
    398398{
    399399    BEGIN_BLOCK_OBJC_EXCEPTIONS
     
    435435        context.translate(-inflatedRect.location());
    436436    }
    437 
    438437    LocalCurrentGraphicsContext localContext(context);
    439438
    440     NSView *view = ThemeMac::ensuredView(scrollView, controlStates, true /* useUnparentedView */);
     439    NSView *view = ThemeMac::ensuredView(scrollView, controlStates, useSystemAppearance, true /* useUnparentedView */);
    441440
    442441    bool needsRepaint = false;
     
    451450        [toggleButtonCell _renderCurrentAnimationFrameInContext:context.platformContext() atLocation:NSMakePoint(0, 0)];
    452451        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);
    454453    } 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);
    456455
    457456    [toggleButtonCell setControlView:nil];
     
    529528}
    530529   
    531 static void paintButton(ControlPart part, ControlStates& controlStates, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor)
     530static void paintButton(ControlPart part, ControlStates& controlStates, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance)
    532531{
    533532    BEGIN_BLOCK_OBJC_EXCEPTIONS
     
    564563    LocalCurrentGraphicsContext localContext(context);
    565564   
    566     NSView *view = ThemeMac::ensuredView(scrollView, controlStates);
     565    NSView *view = ThemeMac::ensuredView(scrollView, controlStates, useSystemAppearance);
    567566    NSWindow *window = [view window];
    568     LocalDefaultSystemAppearance localAppearence;
     567    LocalDefaultSystemAppearance localAppearance(useSystemAppearance);
    569568    [window setAppearance:[NSAppearance currentAppearance]];
    570569    NSButtonCell *previousDefaultButtonCell = [window defaultButtonCell];
    571570
    572571    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);
    574573    if (states & ControlStates::DefaultState)
    575574        [window setDefaultButtonCell:buttonCell];
     
    649648// This will ensure that we always return a valid NSView, even if ScrollView doesn't have an associated document NSView.
    650649// 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 useUnparentedView)
     650NSView *ThemeMac::ensuredView(ScrollView* scrollView, const ControlStates& controlStates, bool useSystemAppearance, bool useUnparentedView)
    652651{
    653652    if (!useUnparentedView) {
     
    657656
    658657    // Use a fake view.
    659     static WebCoreThemeView *themeView = [[WebCoreThemeView alloc] init];
     658    static WebCoreThemeView *themeView = [[WebCoreThemeView alloc] initWithUseSystemAppearance:useSystemAppearance];
    660659    [themeView setFrameSize:NSSizeFromCGSize(scrollView->totalContentsSize())];
    661660
     
    687686}
    688687
    689 bool ThemeMac::drawCellOrFocusRingWithViewIntoContext(NSCell *cell, GraphicsContext& context, const FloatRect& rect, NSView *view, bool drawButtonCell, bool drawFocusRing, bool useImageBuffer, float deviceScaleFactor)
     688bool ThemeMac::drawCellOrFocusRingWithViewIntoContext(NSCell *cell, GraphicsContext& context, const FloatRect& rect, NSView *view, bool drawButtonCell, bool drawFocusRing, bool useImageBuffer, float deviceScaleFactor, bool useSystemAppearance)
    690689{
    691690    ASSERT(drawButtonCell || drawFocusRing);
    692     LocalDefaultSystemAppearance localAppearence;
     691    LocalDefaultSystemAppearance localAppearance(useSystemAppearance);
    693692    bool needsRepaint = false;
    694693    if (useImageBuffer) {
     
    859858}
    860859
    861 void ThemeMac::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor)
     860void ThemeMac::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance)
    862861{
    863862    switch (part) {
    864863        case CheckboxPart:
    865             paintToggleButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor);
     864            paintToggleButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor, useSystemAppearance);
    866865            break;
    867866        case RadioPart:
    868             paintToggleButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor);
     867            paintToggleButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor, useSystemAppearance);
    869868            break;
    870869        case PushButtonPart:
     
    872871        case ButtonPart:
    873872        case SquareButtonPart:
    874             paintButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor);
     873            paintButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor, useSystemAppearance);
    875874            break;
    876875        case InnerSpinButtonPart:
  • tags/Safari-606.1.7.4/Source/WebCore/platform/wpe/ThemeWPE.cpp

    r219858 r230182  
    5858}
    5959
    60 void ThemeWPE::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float, float)
     60void ThemeWPE::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float, float, bool)
    6161{
    6262    switch (part) {
  • tags/Safari-606.1.7.4/Source/WebCore/platform/wpe/ThemeWPE.h

    r219858 r230182  
    3434    LengthSize controlSize(ControlPart, const FontCascade&, const LengthSize&, float) const final;
    3535
    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;
    3737
    3838    void paintCheckbox(ControlStates&, GraphicsContext&, const FloatRect&, float);
  • tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderListBox.cpp

    r228908 r230182  
    461461            backColor = theme().activeListBoxSelectionBackgroundColor();
    462462        else
    463             backColor = theme().inactiveListBoxSelectionBackgroundColor();
     463            backColor = theme().inactiveListBoxSelectionBackgroundColor(document().useSystemAppearance());
    464464    } else
    465465        backColor = itemStyle.visitedDependentColor(CSSPropertyBackgroundColor);
  • tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderTheme.cpp

    r229174 r230182  
    291291    float deviceScaleFactor = box.document().deviceScaleFactor();
    292292    FloatRect devicePixelSnappedRect = snapRectToDevicePixels(rect, deviceScaleFactor);
    293 
     293   
    294294#if USE(NEW_THEME)
    295295    float pageScaleFactor = box.page().pageScaleFactor();
    296    
     296
    297297    switch (part) {
    298298    case CheckboxPart:
     
    304304    case InnerSpinButtonPart:
    305305        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());
    307307        return false;
    308308    default:
     
    615615}
    616616
    617 Color RenderTheme::inactiveListBoxSelectionBackgroundColor() const
     617Color RenderTheme::inactiveListBoxSelectionBackgroundColor(bool useSystemAppearance) const
    618618{
    619619    if (!m_inactiveListBoxSelectionBackgroundColor.isValid())
    620         m_inactiveListBoxSelectionBackgroundColor = platformInactiveListBoxSelectionBackgroundColor();
     620        m_inactiveListBoxSelectionBackgroundColor = platformInactiveListBoxSelectionBackgroundColor(useSystemAppearance);
    621621    return m_inactiveListBoxSelectionBackgroundColor;
    622622}
     
    671671}
    672672
    673 Color RenderTheme::platformInactiveListBoxSelectionBackgroundColor() const
     673Color RenderTheme::platformInactiveListBoxSelectionBackgroundColor(bool) const
    674674{
    675675    return platformInactiveSelectionBackgroundColor();
     
    12091209}
    12101210
    1211 Color RenderTheme::systemColor(CSSValueID cssValueId) const
    1212 {
     1211Color RenderTheme::systemColor(CSSValueID cssValueId, bool useSystemAppearance) const
     1212{
     1213    UNUSED_PARAM(useSystemAppearance);
     1214   
    12131215    switch (cssValueId) {
    12141216    case CSSValueActiveborder:
     
    13261328}
    13271329
    1328 Color RenderTheme::focusRingColor()
    1329 {
    1330     return customFocusRingColor().isValid() ? customFocusRingColor() : RenderTheme::singleton().platformFocusRingColor();
     1330Color RenderTheme::focusRingColor(bool useSystemAppearance)
     1331{
     1332    return customFocusRingColor().isValid() ? customFocusRingColor() : RenderTheme::singleton().platformFocusRingColor(useSystemAppearance);
    13311333}
    13321334
  • tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderTheme.h

    r229174 r230182  
    141141    Color activeListBoxSelectionBackgroundColor() const;
    142142    Color activeListBoxSelectionForegroundColor() const;
    143     Color inactiveListBoxSelectionBackgroundColor() const;
     143    Color inactiveListBoxSelectionBackgroundColor(bool) const;
    144144    Color inactiveListBoxSelectionForegroundColor() const;
    145145
     
    150150    virtual Color disabledTextColor(const Color& textColor, const Color& backgroundColor) const;
    151151
    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); }
    154154    static void setCustomFocusRingColor(const Color&);
    155155    static float platformFocusRingWidth() { return 3; }
     
    165165    // System fonts and colors for CSS.
    166166    void systemFont(CSSValueID, FontCascadeDescription&) const;
    167     virtual Color systemColor(CSSValueID) const;
     167    virtual Color systemColor(CSSValueID, bool useSystemAppearance) const;
    168168
    169169    virtual int minimumMenuListSize(const RenderStyle&) const { return 0; }
     
    257257
    258258    virtual Color platformActiveListBoxSelectionBackgroundColor() const;
    259     virtual Color platformInactiveListBoxSelectionBackgroundColor() const;
     259    virtual Color platformInactiveListBoxSelectionBackgroundColor(bool) const;
    260260    virtual Color platformActiveListBoxSelectionForegroundColor() const;
    261261    virtual Color platformInactiveListBoxSelectionForegroundColor() const;
  • tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeGtk.cpp

    r229174 r230182  
    17421742}
    17431743
    1744 Color RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor() const
     1744Color RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor(bool) const
    17451745{
    17461746    return styleColor(ListBox, GTK_STATE_FLAG_SELECTED, StyleColorBackground);
     
    17571757}
    17581758
    1759 Color RenderThemeGtk::systemColor(CSSValueID cssValueId) const
     1759Color RenderThemeGtk::systemColor(CSSValueID cssValueId, bool) const
    17601760{
    17611761    switch (cssValueId) {
     
    17651765        return styleColor(Entry, GTK_STATE_FLAG_ACTIVE, StyleColorForeground);
    17661766    default:
    1767         return RenderTheme::systemColor(cssValueId);
     1767        return RenderTheme::systemColor(cssValueId, false);
    17681768    }
    17691769}
  • tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeGtk.h

    r229174 r230182  
    7979    Color platformActiveListBoxSelectionBackgroundColor() const override;
    8080    Color platformActiveListBoxSelectionForegroundColor() const override;
    81     Color platformInactiveListBoxSelectionBackgroundColor() const override;
     81    Color platformInactiveListBoxSelectionBackgroundColor(bool) const override;
    8282    Color platformInactiveListBoxSelectionForegroundColor() const override;
    8383
     
    8787
    8888    // System colors.
    89     Color systemColor(CSSValueID) const override;
     89    Color systemColor(CSSValueID, bool) const override;
    9090
    9191    bool popsMenuBySpaceOrReturn() const override { return true; }
  • tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeIOS.h

    r229174 r230182  
    136136    FloatRect addRoundedBorderClip(const RenderObject& box, GraphicsContext&, const IntRect&);
    137137
    138     Color systemColor(CSSValueID) const override;
     138    Color systemColor(CSSValueID, bool) const override;
    139139
    140140    String m_legacyMediaControlsScript;
  • tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeIOS.mm

    r229174 r230182  
    13981398#endif // ENABLE(VIDEO)
    13991399
    1400 Color RenderThemeIOS::systemColor(CSSValueID cssValueID) const
     1400Color RenderThemeIOS::systemColor(CSSValueID cssValueID, bool) const
    14011401{
    14021402    auto addResult = m_systemColorCache.add(cssValueID, Color());
     
    14351435
    14361436    if (!color.isValid())
    1437         color = RenderTheme::systemColor(cssValueID);
     1437        color = RenderTheme::systemColor(cssValueID, false);
    14381438
    14391439    addResult.iterator->value = color;
  • tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeMac.h

    r229174 r230182  
    5858    Color platformActiveListBoxSelectionBackgroundColor() const final;
    5959    Color platformActiveListBoxSelectionForegroundColor() const final;
    60     Color platformInactiveListBoxSelectionBackgroundColor() const final;
     60    Color platformInactiveListBoxSelectionBackgroundColor(bool) const final;
    6161    Color platformInactiveListBoxSelectionForegroundColor() const final;
    62     Color platformFocusRingColor() const final;
     62    Color platformFocusRingColor(bool useSystemAppearance) const final;
    6363
    6464    ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) final { return SmallScrollbar; }
     
    170170    String fileListNameForWidth(const FileList*, const FontCascade&, int width, bool multipleFilesAllowed) const final;
    171171
    172     Color systemColor(CSSValueID) const final;
     172    Color systemColor(CSSValueID, bool useSystemAppearance) const final;
    173173
    174174    void purgeCaches() final;
  • tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeMac.mm

    r230181 r230182  
    203203{
    204204    ControlStates states(extractControlStatesForRenderer(o));
    205     return ThemeMac::ensuredView(&o.view().frameView(), states);
     205    return ThemeMac::ensuredView(&o.view().frameView(), states, o.page().useSystemAppearance());
    206206}
    207207
     
    328328}
    329329
    330 Color RenderThemeMac::platformFocusRingColor() const
     330Color RenderThemeMac::platformFocusRingColor(bool useSystemAppearance) const
    331331{
    332332    if (usesTestModeFocusRingColor())
    333333        return oldAquaFocusRingColor();
    334334
    335     return systemColor(CSSValueWebkitFocusRingColor);
    336 }
    337 
    338 Color RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor() const
    339 {
    340     LocalDefaultSystemAppearance localAppearance;
     335    return systemColor(CSSValueWebkitFocusRingColor, useSystemAppearance);
     336}
     337
     338Color RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor(bool useSystemAppearance) const
     339{
     340    LocalDefaultSystemAppearance localAppearance(useSystemAppearance);
    341341    return platformInactiveSelectionBackgroundColor();
    342342}
     
    495495}
    496496
    497 Color RenderThemeMac::systemColor(CSSValueID cssValueID) const
    498 {
    499     LocalDefaultSystemAppearance localAppearence;
    500     return m_systemColorCache.ensure(cssValueID, [this, cssValueID] () -> Color {
     497Color RenderThemeMac::systemColor(CSSValueID cssValueID, bool useSystemAppearance) const
     498{
     499    LocalDefaultSystemAppearance localAppearance(useSystemAppearance);
     500    return m_systemColorCache.ensure(cssValueID, [this, cssValueID, useSystemAppearance] () -> Color {
    501501        auto selectCocoaColor = [cssValueID] () -> SEL {
    502502            switch (cssValueID) {
     
    597597            FALLTHROUGH;
    598598        default:
    599             return RenderTheme::systemColor(cssValueID);
     599            return RenderTheme::systemColor(cssValueID, useSystemAppearance);
    600600        }
    601601    }).iterator->value;
     
    14341434    bool shouldUseImageBuffer = renderer.style().effectiveZoom() != 1 || renderer.page().pageScaleFactor() != 1;
    14351435    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()))
    14371437        renderer.page().focusController().setFocusedElementNeedsRepaint();
    14381438}
     
    15631563    float deviceScaleFactor = o.page().deviceScaleFactor();
    15641564    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());
    15661566    [sliderThumbCell setControlView:nil];
    15671567
  • tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeWin.cpp

    r226205 r230182  
    10131013}
    10141014
    1015 Color RenderThemeWin::systemColor(CSSValueID cssValueId) const
     1015Color RenderThemeWin::systemColor(CSSValueID cssValueId, bool) const
    10161016{
    10171017    int sysColorIndex = cssValueIdToSysColorIndex(cssValueId);
    10181018    if (sysColorIndex == -1)
    1019         return RenderTheme::systemColor(cssValueId);
     1019        return RenderTheme::systemColor(cssValueId, false);
    10201020
    10211021    COLORREF color = GetSysColor(sysColorIndex);
  • tags/Safari-606.1.7.4/Source/WebCore/rendering/RenderThemeWin.h

    r219595 r230182  
    6060    Color platformInactiveSelectionForegroundColor() const override;
    6161
    62     Color systemColor(CSSValueID) const override;
     62    Color systemColor(CSSValueID, bool) const override;
    6363
    6464    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  
    9999        Page* page = frame.page();
    100100        if (page && page->focusController().isActive()) {
    101             paintStyle.fillColor = RenderTheme::singleton().systemColor(CSSValueActivebuttontext);
     101            paintStyle.fillColor = RenderTheme::singleton().systemColor(CSSValueActivebuttontext, page->useSystemAppearance());
    102102            return paintStyle;
    103103        }
  • tags/Safari-606.1.7.4/Source/WebKit/ChangeLog

    r229902 r230182  
     12018-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
    11392018-03-23  Jason Marcell  <jmarcell@apple.com>
    2140
  • tags/Safari-606.1.7.4/Source/WebKit/Shared/WebPageCreationParameters.cpp

    r229063 r230182  
    8282#if PLATFORM(MAC)
    8383    encoder << colorSpace;
     84    encoder << useSystemAppearance;
    8485#endif
    8586#if PLATFORM(IOS)
     
    233234    if (!decoder.decode(parameters.colorSpace))
    234235        return std::nullopt;
     236    if (!decoder.decode(parameters.useSystemAppearance))
     237        return std::nullopt;
    235238#endif
    236239
  • tags/Safari-606.1.7.4/Source/WebKit/Shared/WebPageCreationParameters.h

    r229063 r230182  
    139139#if PLATFORM(MAC)
    140140    ColorSpaceData colorSpace;
     141    bool useSystemAppearance;
    141142#endif
    142143#if PLATFORM(IOS)
  • tags/Safari-606.1.7.4/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r229182 r230182  
    61406140}
    61416141
     6142- (BOOL)_useSystemAppearance
     6143{
     6144    return _page->useSystemAppearance();
     6145}
     6146
     6147- (void)_setUseSystemAppearance:(BOOL)useSystemAppearance
     6148{
     6149    _page->setUseSystemAppearance(useSystemAppearance);
     6150}
     6151
    61426152- (void)_setHeaderBannerHeight:(int)height
    61436153{
  • tags/Safari-606.1.7.4/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r229063 r230182  
    440440- (void)_insertText:(id)string replacementRange:(NSRange)replacementRange WK_API_AVAILABLE(macosx(10.12.3));
    441441- (NSRect)_candidateRect WK_API_AVAILABLE(macosx(10.13));
     442@property (nonatomic, readwrite, setter=_setUseSystemAppearance:) BOOL _useSystemAppearance WK_API_AVAILABLE(macosx(WK_MAC_TBA));
    442443
    443444- (void)_setHeaderBannerHeight:(int)height WK_API_AVAILABLE(macosx(10.12.3));
  • tags/Safari-606.1.7.4/Source/WebKit/UIProcess/WebPageProxy.cpp

    r229201 r230182  
    58495849#if PLATFORM(MAC)
    58505850    parameters.colorSpace = m_pageClient.colorSpace();
     5851    parameters.useSystemAppearance = m_useSystemAppearance;
    58515852#endif
    58525853#if PLATFORM(IOS)
     
    69466947    m_pageClient.didHandleAcceptedCandidate();
    69476948}
     6949   
     6950void 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}
    69486961
    69496962void WebPageProxy::setHeaderBannerHeightForTesting(int height)
  • tags/Safari-606.1.7.4/Source/WebKit/UIProcess/WebPageProxy.h

    r229063 r230182  
    799799    bool paginationLineGridEnabled() const { return m_paginationLineGridEnabled; }
    800800    unsigned pageCount() const { return m_pageCount; }
     801       
     802#if PLATFORM(MAC)
     803    void setUseSystemAppearance(bool);
     804    bool useSystemAppearance() const { return m_useSystemAppearance; }
     805#endif
    801806
    802807#if PLATFORM(COCOA)
     
    17871792    bool m_isScrollingOrZooming { false };
    17881793#endif
     1794       
     1795#if PLATFORM(MAC)
     1796    bool m_useSystemAppearance { false };
     1797#endif
    17891798
    17901799#if ENABLE(APPLE_PAY)
  • tags/Safari-606.1.7.4/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r229063 r230182  
    41204120}
    41214121
     4122void WebPage::setUseSystemAppearance(bool useSystemAppearance)
     4123{
     4124    corePage()->setUseSystemAppearance(useSystemAppearance);
     4125}
    41224126#endif
    41234127
  • tags/Safari-606.1.7.4/Source/WebKit/WebProcess/WebPage/WebPage.h

    r229063 r230182  
    489489    void setTopOverhangImage(WebImage*);
    490490    void setBottomOverhangImage(WebImage*);
     491   
     492    void setUseSystemAppearance(bool);
    491493#endif
    492494
  • tags/Safari-606.1.7.4/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r229063 r230182  
    443443    HandleAcceptedCandidate(struct WebCore::TextCheckingResult acceptedCandidate)
    444444
     445    SetUseSystemAppearance(bool useSystemAppearance);
     446
    445447    SetHeaderBannerHeightForTesting(int height);
    446448    SetFooterBannerHeightForTesting(int height);
  • tags/Safari-606.1.7.4/Source/WebKitLegacy/mac/ChangeLog

    r229205 r230182  
     12018-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
    11262018-03-04  Tim Horton  <timothy_horton@apple.com>
    2127
  • tags/Safari-606.1.7.4/Source/WebKitLegacy/mac/WebView/WebView.mm

    r228486 r230182  
    51915191}
    51925192
     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
    51935206- (void)_setSourceApplicationAuditData:(NSData *)sourceApplicationAuditData
    51945207{
  • tags/Safari-606.1.7.4/Source/WebKitLegacy/mac/WebView/WebViewPrivate.h

    r227205 r230182  
    928928@property (nonatomic, assign, setter=_setUnobscuredSafeAreaInsets:) WebEdgeInsets _unobscuredSafeAreaInsets;
    929929
     930@property (nonatomic, assign, setter=_setUseSystemAppearance:) BOOL _useSystemAppearance;
     931
    930932@end
    931933
Note: See TracChangeset for help on using the changeset viewer.