Changeset 252308 in webkit


Ignore:
Timestamp:
Nov 9, 2019 9:09:02 AM (4 years ago)
Author:
Antti Koivisto
Message:

Move style adjustment code out of StyleResolver and into a class of its own
https://bugs.webkit.org/show_bug.cgi?id=204041

Reviewed by Zalan Bujtas.

Introduce Style::Adjuster.

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • css/StyleResolver.cpp:

(WebCore::StyleResolver::styleForElement):
(WebCore::StyleResolver::styleForKeyframe):
(WebCore::StyleResolver::pseudoStyleForElement):
(WebCore::addIntrinsicMargins): Deleted.
(WebCore::equivalentBlockDisplay): Deleted.
(WebCore::doesNotInheritTextDecoration): Deleted.
(WebCore::isScrollableOverflow): Deleted.
(WebCore::hasEffectiveDisplayNoneForDisplayContents): Deleted.
(WebCore::adjustDisplayContentsStyle): Deleted.
(WebCore::StyleResolver::adjustSVGElementStyle): Deleted.
(WebCore::computeEffectiveTouchActions): Deleted.
(WebCore::hasTextChild): Deleted.
(WebCore::StyleResolver::adjustRenderStyleForTextAutosizing): Deleted.
(WebCore::StyleResolver::adjustRenderStyle): Deleted.
(WebCore::StyleResolver::adjustRenderStyleForSiteSpecificQuirks): Deleted.

  • css/StyleResolver.h:
  • page/Page.cpp:

(WebCore::Page::recomputeTextAutoSizingInAllFrames):

  • rendering/RenderTheme.cpp:

(WebCore::RenderTheme::adjustStyle):

None of this code uses the StyleResolver argument so remove it.

(WebCore::RenderTheme::adjustCheckboxStyle const):
(WebCore::RenderTheme::adjustRadioStyle const):
(WebCore::RenderTheme::adjustButtonStyle const):
(WebCore::RenderTheme::adjustInnerSpinButtonStyle const):
(WebCore::RenderTheme::adjustTextFieldStyle const):
(WebCore::RenderTheme::adjustTextAreaStyle const):
(WebCore::RenderTheme::adjustMenuListStyle const):
(WebCore::RenderTheme::adjustMeterStyle const):
(WebCore::RenderTheme::adjustCapsLockIndicatorStyle const):
(WebCore::RenderTheme::adjustAttachmentStyle const):
(WebCore::RenderTheme::adjustListButtonStyle const):
(WebCore::RenderTheme::adjustProgressBarStyle const):
(WebCore::RenderTheme::adjustMenuListButtonStyle const):
(WebCore::RenderTheme::adjustMediaControlStyle const):
(WebCore::RenderTheme::adjustSliderTrackStyle const):
(WebCore::RenderTheme::adjustSliderThumbStyle const):
(WebCore::RenderTheme::adjustSearchFieldStyle const):
(WebCore::RenderTheme::adjustSearchFieldCancelButtonStyle const):
(WebCore::RenderTheme::adjustSearchFieldDecorationPartStyle const):
(WebCore::RenderTheme::adjustSearchFieldResultsDecorationPartStyle const):
(WebCore::RenderTheme::adjustSearchFieldResultsButtonStyle const):

  • rendering/RenderTheme.h:

(WebCore::RenderTheme::adjustApplePayButtonStyle const):

  • rendering/RenderThemeCocoa.h:
  • rendering/RenderThemeCocoa.mm:

(WebCore::RenderThemeCocoa::adjustApplePayButtonStyle const):

  • rendering/RenderThemeGtk.cpp:

(WebCore::RenderThemeGtk::adjustButtonStyle const):
(WebCore::RenderThemeGtk::adjustMenuListStyle const):
(WebCore::RenderThemeGtk::adjustMenuListButtonStyle const):
(WebCore::RenderThemeGtk::adjustTextFieldStyle const):
(WebCore::RenderThemeGtk::adjustSearchFieldResultsButtonStyle const):
(WebCore::RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle const):
(WebCore::RenderThemeGtk::adjustSearchFieldCancelButtonStyle const):
(WebCore::RenderThemeGtk::adjustListButtonStyle const):
(WebCore::RenderThemeGtk::adjustSearchFieldStyle const):
(WebCore::RenderThemeGtk::adjustSliderTrackStyle const):
(WebCore::RenderThemeGtk::adjustSliderThumbStyle const):
(WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle const):
(WebCore::RenderThemeGtk::adjustProgressBarStyle const):

  • rendering/RenderThemeGtk.h:
  • rendering/RenderThemeIOS.h:
  • rendering/RenderThemeIOS.mm:

(WebCore::RenderThemeIOS::adjustCheckboxStyle const):
(WebCore::RenderThemeIOS::adjustRadioStyle const):
(WebCore::RenderThemeIOS::adjustMenuListButtonStyle const):
(WebCore::RenderThemeIOS::adjustSliderTrackStyle const):
(WebCore::RenderThemeIOS::adjustSearchFieldStyle const):
(WebCore::RenderThemeIOS::adjustButtonStyle const):

  • rendering/RenderThemeMac.h:
  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::setFontFromControlSize const):
(WebCore::RenderThemeMac::adjustListButtonStyle const):
(WebCore::RenderThemeMac::adjustTextFieldStyle const):
(WebCore::RenderThemeMac::adjustTextAreaStyle const):
(WebCore::RenderThemeMac::adjustProgressBarStyle const):
(WebCore::RenderThemeMac::adjustMenuListStyle const):
(WebCore::RenderThemeMac::adjustMenuListButtonStyle const):
(WebCore::RenderThemeMac::adjustSliderTrackStyle const):
(WebCore::RenderThemeMac::adjustSliderThumbStyle const):
(WebCore::RenderThemeMac::adjustSearchFieldStyle const):
(WebCore::RenderThemeMac::adjustSearchFieldCancelButtonStyle const):
(WebCore::RenderThemeMac::adjustSearchFieldDecorationPartStyle const):
(WebCore::RenderThemeMac::adjustSearchFieldResultsDecorationPartStyle const):
(WebCore::RenderThemeMac::adjustSearchFieldResultsButtonStyle const):

  • style/StyleAdjuster.cpp: Added.

(WebCore::Style::Adjuster::Adjuster):
(WebCore::Style::addIntrinsicMargins):
(WebCore::Style::equivalentBlockDisplay):
(WebCore::Style::isAtShadowBoundary):
(WebCore::Style::doesNotInheritTextDecoration):
(WebCore::Style::isScrollableOverflow):
(WebCore::Style::computeEffectiveTouchActions):
(WebCore::Style::Adjuster::adjust const):
(WebCore::Style::hasEffectiveDisplayNoneForDisplayContents):
(WebCore::Style::Adjuster::adjustDisplayContentsStyle const):
(WebCore::Style::Adjuster::adjustSVGElementStyle):
(WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const):
(WebCore::Style::hasTextChild):
(WebCore::Style::Adjuster::adjustForTextAutosizing):

  • style/StyleAdjuster.h: Added.
  • svg/SVGElement.cpp:

(WebCore::SVGElement::resolveCustomStyle):

Location:
trunk/Source/WebCore
Files:
1 added
19 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252307 r252308  
     12019-11-09  Antti Koivisto  <antti@apple.com>
     2
     3        Move style adjustment code out of StyleResolver and into a class of its own
     4        https://bugs.webkit.org/show_bug.cgi?id=204041
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Introduce Style::Adjuster.
     9
     10        * Sources.txt:
     11        * WebCore.xcodeproj/project.pbxproj:
     12        * css/StyleResolver.cpp:
     13        (WebCore::StyleResolver::styleForElement):
     14        (WebCore::StyleResolver::styleForKeyframe):
     15        (WebCore::StyleResolver::pseudoStyleForElement):
     16        (WebCore::addIntrinsicMargins): Deleted.
     17        (WebCore::equivalentBlockDisplay): Deleted.
     18        (WebCore::doesNotInheritTextDecoration): Deleted.
     19        (WebCore::isScrollableOverflow): Deleted.
     20        (WebCore::hasEffectiveDisplayNoneForDisplayContents): Deleted.
     21        (WebCore::adjustDisplayContentsStyle): Deleted.
     22        (WebCore::StyleResolver::adjustSVGElementStyle): Deleted.
     23        (WebCore::computeEffectiveTouchActions): Deleted.
     24        (WebCore::hasTextChild): Deleted.
     25        (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing): Deleted.
     26        (WebCore::StyleResolver::adjustRenderStyle): Deleted.
     27        (WebCore::StyleResolver::adjustRenderStyleForSiteSpecificQuirks): Deleted.
     28        * css/StyleResolver.h:
     29        * page/Page.cpp:
     30        (WebCore::Page::recomputeTextAutoSizingInAllFrames):
     31        * rendering/RenderTheme.cpp:
     32        (WebCore::RenderTheme::adjustStyle):
     33
     34        None of this code uses the StyleResolver argument so remove it.
     35
     36        (WebCore::RenderTheme::adjustCheckboxStyle const):
     37        (WebCore::RenderTheme::adjustRadioStyle const):
     38        (WebCore::RenderTheme::adjustButtonStyle const):
     39        (WebCore::RenderTheme::adjustInnerSpinButtonStyle const):
     40        (WebCore::RenderTheme::adjustTextFieldStyle const):
     41        (WebCore::RenderTheme::adjustTextAreaStyle const):
     42        (WebCore::RenderTheme::adjustMenuListStyle const):
     43        (WebCore::RenderTheme::adjustMeterStyle const):
     44        (WebCore::RenderTheme::adjustCapsLockIndicatorStyle const):
     45        (WebCore::RenderTheme::adjustAttachmentStyle const):
     46        (WebCore::RenderTheme::adjustListButtonStyle const):
     47        (WebCore::RenderTheme::adjustProgressBarStyle const):
     48        (WebCore::RenderTheme::adjustMenuListButtonStyle const):
     49        (WebCore::RenderTheme::adjustMediaControlStyle const):
     50        (WebCore::RenderTheme::adjustSliderTrackStyle const):
     51        (WebCore::RenderTheme::adjustSliderThumbStyle const):
     52        (WebCore::RenderTheme::adjustSearchFieldStyle const):
     53        (WebCore::RenderTheme::adjustSearchFieldCancelButtonStyle const):
     54        (WebCore::RenderTheme::adjustSearchFieldDecorationPartStyle const):
     55        (WebCore::RenderTheme::adjustSearchFieldResultsDecorationPartStyle const):
     56        (WebCore::RenderTheme::adjustSearchFieldResultsButtonStyle const):
     57        * rendering/RenderTheme.h:
     58        (WebCore::RenderTheme::adjustApplePayButtonStyle const):
     59        * rendering/RenderThemeCocoa.h:
     60        * rendering/RenderThemeCocoa.mm:
     61        (WebCore::RenderThemeCocoa::adjustApplePayButtonStyle const):
     62        * rendering/RenderThemeGtk.cpp:
     63        (WebCore::RenderThemeGtk::adjustButtonStyle const):
     64        (WebCore::RenderThemeGtk::adjustMenuListStyle const):
     65        (WebCore::RenderThemeGtk::adjustMenuListButtonStyle const):
     66        (WebCore::RenderThemeGtk::adjustTextFieldStyle const):
     67        (WebCore::RenderThemeGtk::adjustSearchFieldResultsButtonStyle const):
     68        (WebCore::RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle const):
     69        (WebCore::RenderThemeGtk::adjustSearchFieldCancelButtonStyle const):
     70        (WebCore::RenderThemeGtk::adjustListButtonStyle const):
     71        (WebCore::RenderThemeGtk::adjustSearchFieldStyle const):
     72        (WebCore::RenderThemeGtk::adjustSliderTrackStyle const):
     73        (WebCore::RenderThemeGtk::adjustSliderThumbStyle const):
     74        (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle const):
     75        (WebCore::RenderThemeGtk::adjustProgressBarStyle const):
     76        * rendering/RenderThemeGtk.h:
     77        * rendering/RenderThemeIOS.h:
     78        * rendering/RenderThemeIOS.mm:
     79        (WebCore::RenderThemeIOS::adjustCheckboxStyle const):
     80        (WebCore::RenderThemeIOS::adjustRadioStyle const):
     81        (WebCore::RenderThemeIOS::adjustMenuListButtonStyle const):
     82        (WebCore::RenderThemeIOS::adjustSliderTrackStyle const):
     83        (WebCore::RenderThemeIOS::adjustSearchFieldStyle const):
     84        (WebCore::RenderThemeIOS::adjustButtonStyle const):
     85        * rendering/RenderThemeMac.h:
     86        * rendering/RenderThemeMac.mm:
     87        (WebCore::RenderThemeMac::setFontFromControlSize const):
     88        (WebCore::RenderThemeMac::adjustListButtonStyle const):
     89        (WebCore::RenderThemeMac::adjustTextFieldStyle const):
     90        (WebCore::RenderThemeMac::adjustTextAreaStyle const):
     91        (WebCore::RenderThemeMac::adjustProgressBarStyle const):
     92        (WebCore::RenderThemeMac::adjustMenuListStyle const):
     93        (WebCore::RenderThemeMac::adjustMenuListButtonStyle const):
     94        (WebCore::RenderThemeMac::adjustSliderTrackStyle const):
     95        (WebCore::RenderThemeMac::adjustSliderThumbStyle const):
     96        (WebCore::RenderThemeMac::adjustSearchFieldStyle const):
     97        (WebCore::RenderThemeMac::adjustSearchFieldCancelButtonStyle const):
     98        (WebCore::RenderThemeMac::adjustSearchFieldDecorationPartStyle const):
     99        (WebCore::RenderThemeMac::adjustSearchFieldResultsDecorationPartStyle const):
     100        (WebCore::RenderThemeMac::adjustSearchFieldResultsButtonStyle const):
     101        * style/StyleAdjuster.cpp: Added.
     102        (WebCore::Style::Adjuster::Adjuster):
     103        (WebCore::Style::addIntrinsicMargins):
     104        (WebCore::Style::equivalentBlockDisplay):
     105        (WebCore::Style::isAtShadowBoundary):
     106        (WebCore::Style::doesNotInheritTextDecoration):
     107        (WebCore::Style::isScrollableOverflow):
     108        (WebCore::Style::computeEffectiveTouchActions):
     109        (WebCore::Style::Adjuster::adjust const):
     110        (WebCore::Style::hasEffectiveDisplayNoneForDisplayContents):
     111        (WebCore::Style::Adjuster::adjustDisplayContentsStyle const):
     112        (WebCore::Style::Adjuster::adjustSVGElementStyle):
     113        (WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const):
     114        (WebCore::Style::hasTextChild):
     115        (WebCore::Style::Adjuster::adjustForTextAutosizing):
     116        * style/StyleAdjuster.h: Added.
     117        * svg/SVGElement.cpp:
     118        (WebCore::SVGElement::resolveCustomStyle):
     119
    11202019-11-08  Antoine Quint  <graouts@apple.com>
    2121
  • trunk/Source/WebCore/Sources.txt

    r252253 r252308  
    23502350style/MatchedDeclarationsCache.cpp
    23512351style/PropertyCascade.cpp
     2352style/StyleAdjuster.cpp
    23522353style/StyleBuilder.cpp
    23532354style/StyleBuilderState.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r252276 r252308  
    48194819                E45322AC140CE267005A0F92 /* SelectorQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = E45322AA140CE267005A0F92 /* SelectorQuery.h */; };
    48204820                E45BA6AA2374926C004DFC07 /* MatchedDeclarationsCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E45BA6A82374926B004DFC07 /* MatchedDeclarationsCache.h */; };
     4821                E45BA6B6237622A3004DFC07 /* StyleAdjuster.h in Headers */ = {isa = PBXBuildFile; fileRef = E45BA6B52376229F004DFC07 /* StyleAdjuster.h */; };
    48214822                E4605FEC2166480900E53046 /* PrewarmInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4605FEA2166480800E53046 /* PrewarmInformation.h */; settings = {ATTRIBUTES = (Private, ); }; };
    48224823                E461802D1C8DD2900026C02C /* StyleRelations.h in Headers */ = {isa = PBXBuildFile; fileRef = E461802C1C8DD2900026C02C /* StyleRelations.h */; };
     
    1514815149                E45BA6A82374926B004DFC07 /* MatchedDeclarationsCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MatchedDeclarationsCache.h; sourceTree = "<group>"; };
    1514915150                E45BA6AB2374927B004DFC07 /* MatchedDeclarationsCache.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MatchedDeclarationsCache.cpp; sourceTree = "<group>"; };
     15151                E45BA6B22376227E004DFC07 /* StyleAdjuster.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleAdjuster.cpp; sourceTree = "<group>"; };
     15152                E45BA6B52376229F004DFC07 /* StyleAdjuster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleAdjuster.h; sourceTree = "<group>"; };
    1515015153                E4605FEA2166480800E53046 /* PrewarmInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrewarmInformation.h; sourceTree = "<group>"; };
    1515115154                E461802C1C8DD2900026C02C /* StyleRelations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRelations.h; sourceTree = "<group>"; };
     
    2701727020                                E4ABABE52361A34200FA4345 /* PropertyCascade.cpp */,
    2701827021                                E4ABABE22361A32900FA4345 /* PropertyCascade.h */,
     27022                                E45BA6B22376227E004DFC07 /* StyleAdjuster.cpp */,
     27023                                E45BA6B52376229F004DFC07 /* StyleAdjuster.h */,
    2701927024                                E4ABAC07236B018100FA4345 /* StyleBuilder.cpp */,
    2702027025                                E4ABAC05236B016C00FA4345 /* StyleBuilder.h */,
     
    2926129266                                E1BD331A182D8DDD00C05D9F /* CryptoAlgorithmRSASSA_PKCS1_v1_5.h in Headers */,
    2926229267                                E125F82C1822CFEC00D84CD9 /* CryptoAlgorithmSHA1.h in Headers */,
     29268                                E45BA6B6237622A3004DFC07 /* StyleAdjuster.h in Headers */,
    2926329269                                E19AC3EF1824DC7900349426 /* CryptoAlgorithmSHA224.h in Headers */,
    2926429270                                E19AC3F11824DC7900349426 /* CryptoAlgorithmSHA256.h in Headers */,
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r252255 r252308  
    4646#include "FrameSelection.h"
    4747#include "FrameView.h"
    48 #include "HTMLInputElement.h"
    49 #include "HTMLMarqueeElement.h"
    50 #include "HTMLNames.h"
    51 #include "HTMLSlotElement.h"
    52 #include "HTMLTableElement.h"
    53 #include "HTMLTextAreaElement.h"
    5448#include "InspectorInstrumentation.h"
    5549#include "KeyframeList.h"
    5650#include "Logging.h"
    57 #include "MathMLElement.h"
    58 #include "MathMLNames.h"
    5951#include "MediaList.h"
    6052#include "MediaQueryEvaluator.h"
     
    6254#include "PageRuleCollector.h"
    6355#include "Pair.h"
    64 #include "Quirks.h"
    6556#include "RenderScrollbar.h"
    6657#include "RenderStyleConstants.h"
    67 #include "RenderTheme.h"
    6858#include "RenderView.h"
    6959#include "RuleSet.h"
    7060#include "RuntimeEnabledFeatures.h"
    71 #include "SVGDocument.h"
    7261#include "SVGDocumentExtensions.h"
    7362#include "SVGFontFaceElement.h"
    74 #include "SVGNames.h"
    75 #include "SVGURIReference.h"
    7663#include "Settings.h"
    7764#include "ShadowRoot.h"
    7865#include "SharedStringHash.h"
     66#include "StyleAdjuster.h"
    7967#include "StyleBuilder.h"
    8068#include "StyleFontSizeFunctions.h"
     
    8876#include "VisitedLinkState.h"
    8977#include "WebKitFontFamilyNames.h"
    90 #include <bitset>
    9178#include <wtf/Seconds.h>
    9279#include <wtf/StdLibExtras.h>
     
    276263    applyMatchedProperties(collector.matchResult(), element);
    277264
    278     // Clean up our style object's display and text decorations (among other fixups).
    279     adjustRenderStyle(*state.style(), *state.parentStyle(), parentBoxStyle, &element, state.userAgentAppearanceStyle());
     265    Style::Adjuster adjuster(document(), *state.parentStyle(), parentBoxStyle, &element);
     266    adjuster.adjust(*state.style(), state.userAgentAppearanceStyle());
    280267
    281268    if (state.style()->hasViewportUnits())
     
    305292    builder.applyAllProperties();
    306293
    307     adjustRenderStyle(*state.style(), *state.parentStyle(), nullptr, nullptr, state.userAgentAppearanceStyle());
     294    Style::Adjuster adjuster(document(), *state.parentStyle(), nullptr, nullptr);
     295    adjuster.adjust(*state.style(), state.userAgentAppearanceStyle());
    308296
    309297    // Add all the animating properties to the keyframe.
     
    460448    applyMatchedProperties(collector.matchResult(), element);
    461449
    462     // Clean up our style object's display and text decorations (among other fixups).
    463     adjustRenderStyle(*state.style(), *m_state.parentStyle(), parentBoxStyle, nullptr, state.userAgentAppearanceStyle());
     450    Style::Adjuster adjuster(document(), *state.parentStyle(), parentBoxStyle, nullptr);
     451    adjuster.adjust(*state.style(), state.userAgentAppearanceStyle());
    464452
    465453    if (state.style()->hasViewportUnits())
     
    503491    return m_state.takeStyle();
    504492}
    505 
    506 static void addIntrinsicMargins(RenderStyle& style)
    507 {
    508     // Intrinsic margin value.
    509     const int intrinsicMargin = clampToInteger(2 * style.effectiveZoom());
    510 
    511     // FIXME: Using width/height alone and not also dealing with min-width/max-width is flawed.
    512     // FIXME: Using "hasQuirk" to decide the margin wasn't set is kind of lame.
    513     if (style.width().isIntrinsicOrAuto()) {
    514         if (style.marginLeft().hasQuirk())
    515             style.setMarginLeft(Length(intrinsicMargin, Fixed));
    516         if (style.marginRight().hasQuirk())
    517             style.setMarginRight(Length(intrinsicMargin, Fixed));
    518     }
    519 
    520     if (style.height().isAuto()) {
    521         if (style.marginTop().hasQuirk())
    522             style.setMarginTop(Length(intrinsicMargin, Fixed));
    523         if (style.marginBottom().hasQuirk())
    524             style.setMarginBottom(Length(intrinsicMargin, Fixed));
    525     }
    526 }
    527 
    528 static DisplayType equivalentBlockDisplay(const RenderStyle& style, const Document& document)
    529 {
    530     switch (auto display = style.display()) {
    531     case DisplayType::Block:
    532     case DisplayType::Table:
    533     case DisplayType::Box:
    534     case DisplayType::Flex:
    535     case DisplayType::WebKitFlex:
    536     case DisplayType::Grid:
    537     case DisplayType::FlowRoot:
    538         return display;
    539 
    540     case DisplayType::ListItem:
    541         // It is a WinIE bug that floated list items lose their bullets, so we'll emulate the quirk, but only in quirks mode.
    542         if (document.inQuirksMode() && style.isFloating())
    543             return DisplayType::Block;
    544         return display;
    545     case DisplayType::InlineTable:
    546         return DisplayType::Table;
    547     case DisplayType::InlineBox:
    548         return DisplayType::Box;
    549     case DisplayType::InlineFlex:
    550     case DisplayType::WebKitInlineFlex:
    551         return DisplayType::Flex;
    552     case DisplayType::InlineGrid:
    553         return DisplayType::Grid;
    554 
    555     case DisplayType::Inline:
    556     case DisplayType::Compact:
    557     case DisplayType::InlineBlock:
    558     case DisplayType::TableRowGroup:
    559     case DisplayType::TableHeaderGroup:
    560     case DisplayType::TableFooterGroup:
    561     case DisplayType::TableRow:
    562     case DisplayType::TableColumnGroup:
    563     case DisplayType::TableColumn:
    564     case DisplayType::TableCell:
    565     case DisplayType::TableCaption:
    566         return DisplayType::Block;
    567     case DisplayType::Contents:
    568         ASSERT_NOT_REACHED();
    569         return DisplayType::Contents;
    570     case DisplayType::None:
    571         ASSERT_NOT_REACHED();
    572         return DisplayType::None;
    573     }
    574     ASSERT_NOT_REACHED();
    575     return DisplayType::Block;
    576 }
    577 
    578 // CSS requires text-decoration to be reset at each DOM element for tables,
    579 // inline blocks, inline tables, shadow DOM crossings, floating elements,
    580 // and absolute or relatively positioned elements.
    581 static bool doesNotInheritTextDecoration(const RenderStyle& style, const Element* element)
    582 {
    583     return style.display() == DisplayType::Table || style.display() == DisplayType::InlineTable
    584         || style.display() == DisplayType::InlineBlock || style.display() == DisplayType::InlineBox || (element && isAtShadowBoundary(*element))
    585         || style.isFloating() || style.hasOutOfFlowPosition();
    586 }
    587 
    588 #if ENABLE(OVERFLOW_SCROLLING_TOUCH) || ENABLE(POINTER_EVENTS)
    589 static bool isScrollableOverflow(Overflow overflow)
    590 {
    591     return overflow == Overflow::Scroll || overflow == Overflow::Auto;
    592 }
    593 #endif
    594 
    595 static bool hasEffectiveDisplayNoneForDisplayContents(const Element& element)
    596 {
    597     // https://drafts.csswg.org/css-display-3/#unbox-html
    598     static NeverDestroyed<HashSet<AtomString>> tagNames = [] {
    599         static const HTMLQualifiedName* const tagList[] = {
    600             &brTag.get(),
    601             &wbrTag.get(),
    602             &meterTag.get(),
    603             &appletTag.get(),
    604             &progressTag.get(),
    605             &canvasTag.get(),
    606             &embedTag.get(),
    607             &objectTag.get(),
    608             &audioTag.get(),
    609             &iframeTag.get(),
    610             &imgTag.get(),
    611             &videoTag.get(),
    612             &frameTag.get(),
    613             &framesetTag.get(),
    614             &inputTag.get(),
    615             &textareaTag.get(),
    616             &selectTag.get(),
    617         };
    618         HashSet<AtomString> set;
    619         for (auto& name : tagList)
    620             set.add(name->localName());
    621         return set;
    622     }();
    623 
    624     // https://drafts.csswg.org/css-display-3/#unbox-svg
    625     // FIXME: <g>, <use> and <tspan> have special (?) behavior for display:contents in the current draft spec.
    626     if (is<SVGElement>(element))
    627         return true;
    628 #if ENABLE(MATHML)
    629     // Not sure MathML code can handle it.
    630     if (is<MathMLElement>(element))
    631         return true;
    632 #endif // ENABLE(MATHML)
    633     if (!is<HTMLElement>(element))
    634         return false;
    635     return tagNames.get().contains(element.localName());
    636 }
    637 
    638 static void adjustDisplayContentsStyle(RenderStyle& style, const Element* element)
    639 {
    640     bool displayContentsEnabled = is<HTMLSlotElement>(element) || RuntimeEnabledFeatures::sharedFeatures().displayContentsEnabled();
    641     if (!displayContentsEnabled) {
    642         style.setDisplay(DisplayType::Inline);
    643         return;
    644     }
    645     if (!element) {
    646         if (style.styleType() != PseudoId::Before && style.styleType() != PseudoId::After)
    647             style.setDisplay(DisplayType::None);
    648         return;
    649     }
    650     if (element->document().documentElement() == element) {
    651         style.setDisplay(DisplayType::Block);
    652         return;
    653     }
    654     if (hasEffectiveDisplayNoneForDisplayContents(*element))
    655         style.setDisplay(DisplayType::None);
    656 }
    657 
    658 void StyleResolver::adjustSVGElementStyle(const SVGElement& svgElement, RenderStyle& style)
    659 {
    660     // Only the root <svg> element in an SVG document fragment tree honors css position
    661     auto isPositioningAllowed = svgElement.hasTagName(SVGNames::svgTag) && svgElement.parentNode() && !svgElement.parentNode()->isSVGElement() && !svgElement.correspondingElement();
    662     if (!isPositioningAllowed)
    663         style.setPosition(RenderStyle::initialPosition());
    664 
    665     // RenderSVGRoot handles zooming for the whole SVG subtree, so foreignObject content should
    666     // not be scaled again.
    667     if (svgElement.hasTagName(SVGNames::foreignObjectTag))
    668         style.setEffectiveZoom(RenderStyle::initialZoom());
    669 
    670     // SVG text layout code expects us to be a block-level style element.
    671     if ((svgElement.hasTagName(SVGNames::foreignObjectTag) || svgElement.hasTagName(SVGNames::textTag)) && style.isDisplayInlineType())
    672         style.setDisplay(DisplayType::Block);
    673 }
    674 
    675 #if ENABLE(POINTER_EVENTS)
    676 static OptionSet<TouchAction> computeEffectiveTouchActions(const RenderStyle& style, OptionSet<TouchAction> effectiveTouchActions)
    677 {
    678     // https://w3c.github.io/pointerevents/#determining-supported-touch-behavior
    679     // "A touch behavior is supported if it conforms to the touch-action property of each element between
    680     // the hit tested element and its nearest ancestor with the default touch behavior (including both the
    681     // hit tested element and the element with the default touch behavior)."
    682 
    683     bool hasDefaultTouchBehavior = isScrollableOverflow(style.overflowX()) || isScrollableOverflow(style.overflowY());
    684     if (hasDefaultTouchBehavior)
    685         effectiveTouchActions = RenderStyle::initialTouchActions();
    686 
    687     auto touchActions = style.touchActions();
    688     if (touchActions == RenderStyle::initialTouchActions())
    689         return effectiveTouchActions;
    690 
    691     if (effectiveTouchActions.contains(TouchAction::None))
    692         return { TouchAction::None };
    693 
    694     if (effectiveTouchActions.containsAny({ TouchAction::Auto, TouchAction::Manipulation }))
    695         return touchActions;
    696 
    697     if (touchActions.containsAny({ TouchAction::Auto, TouchAction::Manipulation }))
    698         return effectiveTouchActions;
    699 
    700     auto sharedTouchActions = effectiveTouchActions & touchActions;
    701     if (sharedTouchActions.isEmpty())
    702         return { TouchAction::None };
    703 
    704     return sharedTouchActions;
    705 }
    706 #endif
    707 
    708 #if ENABLE(TEXT_AUTOSIZING)
    709 static bool hasTextChild(const Element& element)
    710 {
    711     for (auto* child = element.firstChild(); child; child = child->nextSibling()) {
    712         if (is<Text>(child))
    713             return true;
    714     }
    715     return false;
    716 }
    717 
    718 bool StyleResolver::adjustRenderStyleForTextAutosizing(RenderStyle& style, const Element& element)
    719 {
    720     if (!settings().textAutosizingEnabled() || !settings().textAutosizingUsesIdempotentMode())
    721         return false;
    722 
    723     AutosizeStatus::updateStatus(style);
    724     if (style.textSizeAdjust().isNone())
    725         return false;
    726 
    727     float initialScale = document().page() ? document().page()->initialScale() : 1;
    728     auto adjustLineHeightIfNeeded = [&](auto computedFontSize) {
    729         auto lineHeight = style.specifiedLineHeight();
    730         constexpr static unsigned eligibleFontSize = 12;
    731         if (computedFontSize * initialScale >= eligibleFontSize)
    732             return;
    733 
    734         constexpr static float boostFactor = 1.25;
    735         auto minimumLineHeight = boostFactor * computedFontSize;
    736         if (!lineHeight.isFixed() || lineHeight.value() >= minimumLineHeight)
    737             return;
    738 
    739         if (AutosizeStatus::probablyContainsASmallFixedNumberOfLines(style))
    740             return;
    741 
    742         style.setLineHeight({ minimumLineHeight, Fixed });
    743     };
    744 
    745     auto fontDescription = style.fontDescription();
    746     auto initialComputedFontSize = fontDescription.computedSize();
    747     auto specifiedFontSize = fontDescription.specifiedSize();
    748     bool isCandidate = style.isIdempotentTextAutosizingCandidate();
    749     if (!isCandidate && WTF::areEssentiallyEqual(initialComputedFontSize, specifiedFontSize))
    750         return false;
    751 
    752     auto adjustedFontSize = AutosizeStatus::idempotentTextSize(fontDescription.specifiedSize(), initialScale);
    753     if (isCandidate && WTF::areEssentiallyEqual(initialComputedFontSize, adjustedFontSize))
    754         return false;
    755 
    756     if (!hasTextChild(element))
    757         return false;
    758 
    759     fontDescription.setComputedSize(isCandidate ? adjustedFontSize : specifiedFontSize);
    760     style.setFontDescription(WTFMove(fontDescription));
    761     style.fontCascade().update(&document().fontSelector());
    762 
    763     // FIXME: We should restore computed line height to its original value in the case where the element is not
    764     // an idempotent text autosizing candidate; otherwise, if an element that is a text autosizing candidate contains
    765     // children which are not autosized, the non-autosized content will end up with a boosted line height.
    766     if (isCandidate)
    767         adjustLineHeightIfNeeded(adjustedFontSize);
    768 
    769     return true;
    770 }
    771 #endif
    772 
    773 void StyleResolver::adjustRenderStyle(RenderStyle& style, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle, const Element* element, const RenderStyle* userAgentAppearanceStyle)
    774 {
    775     // If the composed tree parent has display:contents, the parent box style will be different from the parent style.
    776     // We don't have it when resolving computed style for display:none subtree. Use parent style for adjustments in that case.
    777     if (!parentBoxStyle)
    778         parentBoxStyle = &parentStyle;
    779 
    780     // Cache our original display.
    781     style.setOriginalDisplay(style.display());
    782 
    783     if (style.display() == DisplayType::Contents)
    784         adjustDisplayContentsStyle(style, element);
    785 
    786     if (style.display() != DisplayType::None && style.display() != DisplayType::Contents) {
    787         if (element) {
    788             // If we have a <td> that specifies a float property, in quirks mode we just drop the float
    789             // property.
    790             // Sites also commonly use display:inline/block on <td>s and <table>s. In quirks mode we force
    791             // these tags to retain their display types.
    792             if (document().inQuirksMode()) {
    793                 if (element->hasTagName(tdTag)) {
    794                     style.setDisplay(DisplayType::TableCell);
    795                     style.setFloating(Float::No);
    796                 } else if (is<HTMLTableElement>(*element))
    797                     style.setDisplay(style.isDisplayInlineType() ? DisplayType::InlineTable : DisplayType::Table);
    798             }
    799 
    800             if (element->hasTagName(tdTag) || element->hasTagName(thTag)) {
    801                 if (style.whiteSpace() == WhiteSpace::KHTMLNoWrap) {
    802                     // Figure out if we are really nowrapping or if we should just
    803                     // use normal instead. If the width of the cell is fixed, then
    804                     // we don't actually use WhiteSpace::NoWrap.
    805                     if (style.width().isFixed())
    806                         style.setWhiteSpace(WhiteSpace::Normal);
    807                     else
    808                         style.setWhiteSpace(WhiteSpace::NoWrap);
    809                 }
    810             }
    811 
    812             // Tables never support the -webkit-* values for text-align and will reset back to the default.
    813             if (is<HTMLTableElement>(*element) && (style.textAlign() == TextAlignMode::WebKitLeft || style.textAlign() == TextAlignMode::WebKitCenter || style.textAlign() == TextAlignMode::WebKitRight))
    814                 style.setTextAlign(TextAlignMode::Start);
    815 
    816             // Frames and framesets never honor position:relative or position:absolute. This is necessary to
    817             // fix a crash where a site tries to position these objects. They also never honor display.
    818             if (element->hasTagName(frameTag) || element->hasTagName(framesetTag)) {
    819                 style.setPosition(PositionType::Static);
    820                 style.setDisplay(DisplayType::Block);
    821             }
    822 
    823             // Ruby text does not support float or position. This might change with evolution of the specification.
    824             if (element->hasTagName(rtTag)) {
    825                 style.setPosition(PositionType::Static);
    826                 style.setFloating(Float::No);
    827             }
    828 
    829             // User agents are expected to have a rule in their user agent stylesheet that matches th elements that have a parent
    830             // node whose computed value for the 'text-align' property is its initial value, whose declaration block consists of
    831             // just a single declaration that sets the 'text-align' property to the value 'center'.
    832             // https://html.spec.whatwg.org/multipage/rendering.html#rendering
    833             if (element->hasTagName(thTag) && !style.hasExplicitlySetTextAlign() && parentStyle.textAlign() == RenderStyle::initialTextAlign())
    834                 style.setTextAlign(TextAlignMode::Center);
    835 
    836             if (element->hasTagName(legendTag))
    837                 style.setDisplay(DisplayType::Block);
    838         }
    839 
    840         // Absolute/fixed positioned elements, floating elements and the document element need block-like outside display.
    841         if (style.hasOutOfFlowPosition() || style.isFloating() || (element && element->document().documentElement() == element))
    842             style.setDisplay(equivalentBlockDisplay(style, document()));
    843 
    844         // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely
    845         // clear how that should work.
    846         if (style.display() == DisplayType::Inline && style.styleType() == PseudoId::None && style.writingMode() != parentStyle.writingMode())
    847             style.setDisplay(DisplayType::InlineBlock);
    848 
    849         // After performing the display mutation, check table rows. We do not honor position:relative or position:sticky on
    850         // table rows or cells. This has been established for position:relative in CSS2.1 (and caused a crash in containingBlock()
    851         // on some sites).
    852         if ((style.display() == DisplayType::TableHeaderGroup || style.display() == DisplayType::TableRowGroup
    853             || style.display() == DisplayType::TableFooterGroup || style.display() == DisplayType::TableRow)
    854             && style.position() == PositionType::Relative)
    855             style.setPosition(PositionType::Static);
    856 
    857         // writing-mode does not apply to table row groups, table column groups, table rows, and table columns.
    858         // FIXME: Table cells should be allowed to be perpendicular or flipped with respect to the table, though.
    859         if (style.display() == DisplayType::TableColumn || style.display() == DisplayType::TableColumnGroup || style.display() == DisplayType::TableFooterGroup
    860             || style.display() == DisplayType::TableHeaderGroup || style.display() == DisplayType::TableRow || style.display() == DisplayType::TableRowGroup
    861             || style.display() == DisplayType::TableCell)
    862             style.setWritingMode(parentStyle.writingMode());
    863 
    864         // FIXME: Since we don't support block-flow on flexible boxes yet, disallow setting
    865         // of block-flow to anything other than TopToBottomWritingMode.
    866         // https://bugs.webkit.org/show_bug.cgi?id=46418 - Flexible box support.
    867         if (style.writingMode() != TopToBottomWritingMode && (style.display() == DisplayType::Box || style.display() == DisplayType::InlineBox))
    868             style.setWritingMode(TopToBottomWritingMode);
    869 
    870         // https://www.w3.org/TR/css-display/#transformations
    871         // "A parent with a grid or flex display value blockifies the box’s display type."
    872         if (parentBoxStyle->isDisplayFlexibleOrGridBox()) {
    873             style.setFloating(Float::No);
    874             style.setDisplay(equivalentBlockDisplay(style, document()));
    875         }
    876     }
    877 
    878     // Make sure our z-index value is only applied if the object is positioned.
    879     if (style.position() == PositionType::Static && !parentBoxStyle->isDisplayFlexibleOrGridBox())
    880         style.setHasAutoZIndex();
    881 
    882     // Auto z-index becomes 0 for the root element and transparent objects. This prevents
    883     // cases where objects that should be blended as a single unit end up with a non-transparent
    884     // object wedged in between them. Auto z-index also becomes 0 for objects that specify transforms/masks/reflections.
    885     if (style.hasAutoZIndex()) {
    886         if ((element && element->document().documentElement() == element)
    887             || style.opacity() < 1.0f
    888             || style.hasTransformRelatedProperty()
    889             || style.hasMask()
    890             || style.clipPath()
    891             || style.boxReflect()
    892             || style.hasFilter()
    893 #if ENABLE(FILTERS_LEVEL_2)
    894             || style.hasBackdropFilter()
    895 #endif
    896             || style.hasBlendMode()
    897             || style.hasIsolation()
    898             || style.position() == PositionType::Sticky
    899             || style.position() == PositionType::Fixed
    900             || style.willChangeCreatesStackingContext())
    901             style.setZIndex(0);
    902     }
    903 
    904     if (element) {
    905         // Textarea considers overflow visible as auto.
    906         if (is<HTMLTextAreaElement>(*element)) {
    907             style.setOverflowX(style.overflowX() == Overflow::Visible ? Overflow::Auto : style.overflowX());
    908             style.setOverflowY(style.overflowY() == Overflow::Visible ? Overflow::Auto : style.overflowY());
    909         }
    910 
    911         // Disallow -webkit-user-modify on :pseudo and ::pseudo elements.
    912         if (!element->shadowPseudoId().isNull())
    913             style.setUserModify(UserModify::ReadOnly);
    914 
    915         if (is<HTMLMarqueeElement>(*element)) {
    916             // For now, <marquee> requires an overflow clip to work properly.
    917             style.setOverflowX(Overflow::Hidden);
    918             style.setOverflowY(Overflow::Hidden);
    919 
    920             bool isVertical = style.marqueeDirection() == MarqueeDirection::Up || style.marqueeDirection() == MarqueeDirection::Down;
    921             // Make horizontal marquees not wrap.
    922             if (!isVertical) {
    923                 style.setWhiteSpace(WhiteSpace::NoWrap);
    924                 style.setTextAlign(TextAlignMode::Start);
    925             }
    926             // Apparently this is the expected legacy behavior.
    927             if (isVertical && style.height().isAuto())
    928                 style.setHeight(Length(200, Fixed));
    929         }
    930     }
    931 
    932     if (doesNotInheritTextDecoration(style, element))
    933         style.setTextDecorationsInEffect(style.textDecoration());
    934     else
    935         style.addToTextDecorationsInEffect(style.textDecoration());
    936 
    937     // If either overflow value is not visible, change to auto.
    938     if (style.overflowX() == Overflow::Visible && style.overflowY() != Overflow::Visible) {
    939         // FIXME: Once we implement pagination controls, overflow-x should default to hidden
    940         // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, we'll let it
    941         // default to auto so we can at least scroll through the pages.
    942         style.setOverflowX(Overflow::Auto);
    943     } else if (style.overflowY() == Overflow::Visible && style.overflowX() != Overflow::Visible)
    944         style.setOverflowY(Overflow::Auto);
    945 
    946     // Call setStylesForPaginationMode() if a pagination mode is set for any non-root elements. If these
    947     // styles are specified on a root element, then they will be incorporated in
    948     // Style::createForDocument().
    949     if ((style.overflowY() == Overflow::PagedX || style.overflowY() == Overflow::PagedY) && !(element && (element->hasTagName(htmlTag) || element->hasTagName(bodyTag))))
    950         style.setColumnStylesFromPaginationMode(WebCore::paginationModeForRenderStyle(style));
    951 
    952     // Table rows, sections and the table itself will support overflow:hidden and will ignore scroll/auto.
    953     // FIXME: Eventually table sections will support auto and scroll.
    954     if (style.display() == DisplayType::Table || style.display() == DisplayType::InlineTable
    955         || style.display() == DisplayType::TableRowGroup || style.display() == DisplayType::TableRow) {
    956         if (style.overflowX() != Overflow::Visible && style.overflowX() != Overflow::Hidden)
    957             style.setOverflowX(Overflow::Visible);
    958         if (style.overflowY() != Overflow::Visible && style.overflowY() != Overflow::Hidden)
    959             style.setOverflowY(Overflow::Visible);
    960     }
    961 
    962     // Menulists should have visible overflow
    963     if (style.appearance() == MenulistPart) {
    964         style.setOverflowX(Overflow::Visible);
    965         style.setOverflowY(Overflow::Visible);
    966     }
    967 
    968 #if ENABLE(OVERFLOW_SCROLLING_TOUCH)
    969     // Touch overflow scrolling creates a stacking context.
    970     if (style.hasAutoZIndex() && style.useTouchOverflowScrolling() && (isScrollableOverflow(style.overflowX()) || isScrollableOverflow(style.overflowY())))
    971         style.setZIndex(0);
    972 #endif
    973 
    974     // Cull out any useless layers and also repeat patterns into additional layers.
    975     style.adjustBackgroundLayers();
    976     style.adjustMaskLayers();
    977 
    978     // Do the same for animations and transitions.
    979     style.adjustAnimations();
    980     style.adjustTransitions();
    981 
    982     // Important: Intrinsic margins get added to controls before the theme has adjusted the style, since the theme will
    983     // alter fonts and heights/widths.
    984     if (is<HTMLFormControlElement>(element) && style.computedFontPixelSize() >= 11) {
    985         // Don't apply intrinsic margins to image buttons. The designer knows how big the images are,
    986         // so we have to treat all image buttons as though they were explicitly sized.
    987         if (!is<HTMLInputElement>(*element) || !downcast<HTMLInputElement>(*element).isImageButton())
    988             addIntrinsicMargins(style);
    989     }
    990 
    991     // Let the theme also have a crack at adjusting the style.
    992     if (style.hasAppearance())
    993         RenderTheme::singleton().adjustStyle(*this, style, element, userAgentAppearanceStyle);
    994 
    995     // If we have first-letter pseudo style, do not share this style.
    996     if (style.hasPseudoStyle(PseudoId::FirstLetter))
    997         style.setUnique();
    998 
    999     // FIXME: when dropping the -webkit prefix on transform-style, we should also have opacity < 1 cause flattening.
    1000     if (style.preserves3D() && (style.overflowX() != Overflow::Visible
    1001         || style.overflowY() != Overflow::Visible
    1002         || style.hasClip()
    1003         || style.clipPath()
    1004         || style.hasFilter()
    1005 #if ENABLE(FILTERS_LEVEL_2)
    1006         || style.hasBackdropFilter()
    1007 #endif
    1008         || style.hasBlendMode()))
    1009         style.setTransformStyle3D(TransformStyle3D::Flat);
    1010 
    1011     if (is<SVGElement>(element))
    1012         adjustSVGElementStyle(downcast<SVGElement>(*element), style);
    1013 
    1014     // If the inherited value of justify-items includes the 'legacy' keyword (plus 'left', 'right' or
    1015     // 'center'), 'legacy' computes to the the inherited value. Otherwise, 'auto' computes to 'normal'.
    1016     if (parentBoxStyle->justifyItems().positionType() == ItemPositionType::Legacy && style.justifyItems().position() == ItemPosition::Legacy)
    1017         style.setJustifyItems(parentBoxStyle->justifyItems());
    1018 
    1019 #if ENABLE(POINTER_EVENTS)
    1020     style.setEffectiveTouchActions(computeEffectiveTouchActions(style, parentStyle.effectiveTouchActions()));
    1021 #endif
    1022 
    1023     if (element) {
    1024 #if ENABLE(TEXT_AUTOSIZING)
    1025         adjustRenderStyleForTextAutosizing(style, *element);
    1026 #endif
    1027         adjustRenderStyleForSiteSpecificQuirks(style, *element);
    1028     }
    1029 }
    1030 
    1031 void StyleResolver::adjustRenderStyleForSiteSpecificQuirks(RenderStyle& style, const Element& element)
    1032 {
    1033     if (document().quirks().needsGMailOverflowScrollQuirk()) {
    1034         // This turns sidebar scrollable without mouse move event.
    1035         static NeverDestroyed<AtomString> roleValue("navigation", AtomString::ConstructFromLiteral);
    1036         if (style.overflowY() == Overflow::Hidden && element.attributeWithoutSynchronization(roleAttr) == roleValue)
    1037             style.setOverflowY(Overflow::Auto);
    1038     }
    1039     if (document().quirks().needsYouTubeOverflowScrollQuirk()) {
    1040         // This turns sidebar scrollable without hover.
    1041         static NeverDestroyed<AtomString> idValue("guide-inner-content", AtomString::ConstructFromLiteral);
    1042         if (style.overflowY() == Overflow::Hidden && element.idForStyleResolution() == idValue)
    1043             style.setOverflowY(Overflow::Auto);
    1044     }
    1045 }
    1046 
    1047493
    1048494Vector<RefPtr<StyleRule>> StyleResolver::styleRulesForElement(const Element* element, unsigned rulesToInclude)
  • trunk/Source/WebCore/css/StyleResolver.h

    r252255 r252308  
    134134
    135135    void addCurrentSVGFontFaceRules();
    136     static void adjustSVGElementStyle(const SVGElement&, RenderStyle&);
    137136
    138137    void setNewStateWithElement(const Element&);
     
    184183
    185184private:
    186     void adjustRenderStyle(RenderStyle&, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle, const Element*, const RenderStyle* userAgentStyle);
    187     void adjustRenderStyleForSiteSpecificQuirks(RenderStyle&, const Element&);
    188 
    189185    enum class UseMatchedDeclarationsCache { Yes, No };
    190186    void applyMatchedProperties(const MatchResult&, const Element&, UseMatchedDeclarationsCache = UseMatchedDeclarationsCache::Yes);
     
    196192
    197193public:
    198     typedef HashMap<CSSPropertyID, RefPtr<CSSValue>> PendingImagePropertyMap;
    199 
    200194    class State {
    201195    public:
     
    238232    InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWrappers; }
    239233
    240     bool adjustRenderStyleForTextAutosizing(RenderStyle&, const Element&);
    241 
    242234private:
    243235    void cacheBorderAndBackground();
  • trunk/Source/WebCore/page/Page.cpp

    r252254 r252308  
    114114#include "StorageNamespace.h"
    115115#include "StorageNamespaceProvider.h"
     116#include "StyleAdjuster.h"
    116117#include "StyleResolver.h"
    117118#include "StyleScope.h"
     
    30623063            continue;
    30633064        auto& document = *frame->document();
    3064         if (!document.renderView() || !document.styleScope().resolverIfExists())
    3065             continue;
    3066 
    3067         auto& styleResolver = document.styleScope().resolver();
     3065        if (!document.renderView())
     3066            continue;
     3067
    30683068        for (auto& renderer : descendantsOfType<RenderElement>(*document.renderView())) {
    30693069            if (auto* element = renderer.element()) {
    3070                 auto needsLayout = styleResolver.adjustRenderStyleForTextAutosizing(renderer.mutableStyle(), *element);
     3070                auto needsLayout = Style::Adjuster::adjustForTextAutosizing(renderer.mutableStyle(), *element);
    30713071                if (needsLayout)
    30723072                    renderer.setNeedsLayout();
  • trunk/Source/WebCore/rendering/RenderTheme.cpp

    r252255 r252308  
    7979}
    8080
    81 void RenderTheme::adjustStyle(StyleResolver& styleResolver, RenderStyle& style, const Element* element, const RenderStyle* userAgentAppearanceStyle)
     81void RenderTheme::adjustStyle(RenderStyle& style, const Element* element, const RenderStyle* userAgentAppearanceStyle)
    8282{
    8383    // Force inline and table display styles to be inline-block (except for table- which is block)
     
    9898            break;
    9999        case TextFieldPart:
    100             adjustTextFieldStyle(styleResolver, style, element);
     100            adjustTextFieldStyle(style, element);
    101101            FALLTHROUGH;
    102102        default:
     
    201201#if !USE(NEW_THEME)
    202202    case CheckboxPart:
    203         return adjustCheckboxStyle(styleResolver, style, element);
     203        return adjustCheckboxStyle(style, element);
    204204    case RadioPart:
    205         return adjustRadioStyle(styleResolver, style, element);
     205        return adjustRadioStyle(style, element);
    206206    case PushButtonPart:
    207207    case SquareButtonPart:
     
    211211    case DefaultButtonPart:
    212212    case ButtonPart:
    213         return adjustButtonStyle(styleResolver, style, element);
     213        return adjustButtonStyle(style, element);
    214214    case InnerSpinButtonPart:
    215         return adjustInnerSpinButtonStyle(styleResolver, style, element);
     215        return adjustInnerSpinButtonStyle(style, element);
    216216#endif
    217217    case TextFieldPart:
    218         return adjustTextFieldStyle(styleResolver, style, element);
     218        return adjustTextFieldStyle(style, element);
    219219    case TextAreaPart:
    220         return adjustTextAreaStyle(styleResolver, style, element);
     220        return adjustTextAreaStyle(style, element);
    221221    case MenulistPart:
    222         return adjustMenuListStyle(styleResolver, style, element);
     222        return adjustMenuListStyle(style, element);
    223223    case MenulistButtonPart:
    224         return adjustMenuListButtonStyle(styleResolver, style, element);
     224        return adjustMenuListButtonStyle(style, element);
    225225    case MediaPlayButtonPart:
    226226    case MediaCurrentTimePart:
     
    230230    case MediaMuteButtonPart:
    231231    case MediaVolumeSliderContainerPart:
    232         return adjustMediaControlStyle(styleResolver, style, element);
     232        return adjustMediaControlStyle(style, element);
    233233    case MediaSliderPart:
    234234    case MediaVolumeSliderPart:
     
    236236    case SliderHorizontalPart:
    237237    case SliderVerticalPart:
    238         return adjustSliderTrackStyle(styleResolver, style, element);
     238        return adjustSliderTrackStyle(style, element);
    239239    case SliderThumbHorizontalPart:
    240240    case SliderThumbVerticalPart:
    241         return adjustSliderThumbStyle(styleResolver, style, element);
     241        return adjustSliderThumbStyle(style, element);
    242242    case SearchFieldPart:
    243         return adjustSearchFieldStyle(styleResolver, style, element);
     243        return adjustSearchFieldStyle(style, element);
    244244    case SearchFieldCancelButtonPart:
    245         return adjustSearchFieldCancelButtonStyle(styleResolver, style, element);
     245        return adjustSearchFieldCancelButtonStyle(style, element);
    246246    case SearchFieldDecorationPart:
    247         return adjustSearchFieldDecorationPartStyle(styleResolver, style, element);
     247        return adjustSearchFieldDecorationPartStyle(style, element);
    248248    case SearchFieldResultsDecorationPart:
    249         return adjustSearchFieldResultsDecorationPartStyle(styleResolver, style, element);
     249        return adjustSearchFieldResultsDecorationPartStyle(style, element);
    250250    case SearchFieldResultsButtonPart:
    251         return adjustSearchFieldResultsButtonStyle(styleResolver, style, element);
     251        return adjustSearchFieldResultsButtonStyle(style, element);
    252252    case ProgressBarPart:
    253         return adjustProgressBarStyle(styleResolver, style, element);
     253        return adjustProgressBarStyle(style, element);
    254254#if ENABLE(METER_ELEMENT)
    255255    case MeterPart:
     
    258258    case DiscreteCapacityLevelIndicatorPart:
    259259    case RatingLevelIndicatorPart:
    260         return adjustMeterStyle(styleResolver, style, element);
     260        return adjustMeterStyle(style, element);
    261261#endif
    262262#if ENABLE(SERVICE_CONTROLS)
     
    265265#endif
    266266    case CapsLockIndicatorPart:
    267         return adjustCapsLockIndicatorStyle(styleResolver, style, element);
     267        return adjustCapsLockIndicatorStyle(style, element);
    268268#if ENABLE(APPLE_PAY)
    269269    case ApplePayButtonPart:
    270         return adjustApplePayButtonStyle(styleResolver, style, element);
     270        return adjustApplePayButtonStyle(style, element);
    271271#endif
    272272#if ENABLE(ATTACHMENT_ELEMENT)
    273273    case AttachmentPart:
    274274    case BorderlessAttachmentPart:
    275         return adjustAttachmentStyle(styleResolver, style, element);
     275        return adjustAttachmentStyle(style, element);
    276276#endif
    277277#if ENABLE(DATALIST_ELEMENT)
    278278    case ListButtonPart:
    279         return adjustListButtonStyle(styleResolver, style, element);
     279        return adjustListButtonStyle(style, element);
    280280#endif
    281281    default:
     
    927927#if !USE(NEW_THEME)
    928928
    929 void RenderTheme::adjustCheckboxStyle(StyleResolver&, RenderStyle& style, const Element*) const
     929void RenderTheme::adjustCheckboxStyle(RenderStyle& style, const Element*) const
    930930{
    931931    // A summary of the rules for checkbox designed to match WinIE:
     
    944944}
    945945
    946 void RenderTheme::adjustRadioStyle(StyleResolver&, RenderStyle& style, const Element*) const
     946void RenderTheme::adjustRadioStyle(RenderStyle& style, const Element*) const
    947947{
    948948    // A summary of the rules for checkbox designed to match WinIE:
     
    961961}
    962962
    963 void RenderTheme::adjustButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
     963void RenderTheme::adjustButtonStyle(RenderStyle& style, const Element*) const
    964964{
    965965    // Most platforms will completely honor all CSS, and so we have no need to
     
    969969}
    970970
    971 void RenderTheme::adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle&, const Element*) const
    972 {
    973 }
    974 #endif
    975 
    976 void RenderTheme::adjustTextFieldStyle(StyleResolver&, RenderStyle&, const Element*) const
    977 {
    978 }
    979 
    980 void RenderTheme::adjustTextAreaStyle(StyleResolver&, RenderStyle&, const Element*) const
    981 {
    982 }
    983 
    984 void RenderTheme::adjustMenuListStyle(StyleResolver&, RenderStyle&, const Element*) const
     971void RenderTheme::adjustInnerSpinButtonStyle(RenderStyle&, const Element*) const
     972{
     973}
     974#endif
     975
     976void RenderTheme::adjustTextFieldStyle(RenderStyle&, const Element*) const
     977{
     978}
     979
     980void RenderTheme::adjustTextAreaStyle(RenderStyle&, const Element*) const
     981{
     982}
     983
     984void RenderTheme::adjustMenuListStyle(RenderStyle&, const Element*) const
    985985{
    986986}
     
    988988#if ENABLE(METER_ELEMENT)
    989989
    990 void RenderTheme::adjustMeterStyle(StyleResolver&, RenderStyle& style, const Element*) const
     990void RenderTheme::adjustMeterStyle(RenderStyle& style, const Element*) const
    991991{
    992992    style.setBoxShadow(nullptr);
     
    10101010#endif // METER_ELEMENT
    10111011
    1012 void RenderTheme::adjustCapsLockIndicatorStyle(StyleResolver&, RenderStyle&, const Element*) const
     1012void RenderTheme::adjustCapsLockIndicatorStyle(RenderStyle&, const Element*) const
    10131013{
    10141014}
     
    10211021#if ENABLE(ATTACHMENT_ELEMENT)
    10221022
    1023 void RenderTheme::adjustAttachmentStyle(StyleResolver&, RenderStyle&, const Element*) const
     1023void RenderTheme::adjustAttachmentStyle(RenderStyle&, const Element*) const
    10241024{
    10251025}
     
    10501050}
    10511051
    1052 void RenderTheme::adjustListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const
     1052void RenderTheme::adjustListButtonStyle(RenderStyle&, const Element*) const
    10531053{
    10541054}
     
    11511151}
    11521152
    1153 void RenderTheme::adjustProgressBarStyle(StyleResolver&, RenderStyle&, const Element*) const
     1153void RenderTheme::adjustProgressBarStyle(RenderStyle&, const Element*) const
    11541154{
    11551155}
     
    11701170}
    11711171
    1172 void RenderTheme::adjustMenuListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const
    1173 {
    1174 }
    1175 
    1176 void RenderTheme::adjustMediaControlStyle(StyleResolver&, RenderStyle&, const Element*) const
    1177 {
    1178 }
    1179 
    1180 void RenderTheme::adjustSliderTrackStyle(StyleResolver&, RenderStyle&, const Element*) const
    1181 {
    1182 }
    1183 
    1184 void RenderTheme::adjustSliderThumbStyle(StyleResolver&, RenderStyle& style, const Element* element) const
     1172void RenderTheme::adjustMenuListButtonStyle(RenderStyle&, const Element*) const
     1173{
     1174}
     1175
     1176void RenderTheme::adjustMediaControlStyle(RenderStyle&, const Element*) const
     1177{
     1178}
     1179
     1180void RenderTheme::adjustSliderTrackStyle(RenderStyle&, const Element*) const
     1181{
     1182}
     1183
     1184void RenderTheme::adjustSliderThumbStyle(RenderStyle& style, const Element* element) const
    11851185{
    11861186    adjustSliderThumbSize(style, element);
     
    11911191}
    11921192
    1193 void RenderTheme::adjustSearchFieldStyle(StyleResolver&, RenderStyle&, const Element*) const
    1194 {
    1195 }
    1196 
    1197 void RenderTheme::adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle&, const Element*) const
    1198 {
    1199 }
    1200 
    1201 void RenderTheme::adjustSearchFieldDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const
    1202 {
    1203 }
    1204 
    1205 void RenderTheme::adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const
    1206 {
    1207 }
    1208 
    1209 void RenderTheme::adjustSearchFieldResultsButtonStyle(StyleResolver&, RenderStyle&, const Element*) const
     1193void RenderTheme::adjustSearchFieldStyle(RenderStyle&, const Element*) const
     1194{
     1195}
     1196
     1197void RenderTheme::adjustSearchFieldCancelButtonStyle(RenderStyle&, const Element*) const
     1198{
     1199}
     1200
     1201void RenderTheme::adjustSearchFieldDecorationPartStyle(RenderStyle&, const Element*) const
     1202{
     1203}
     1204
     1205void RenderTheme::adjustSearchFieldResultsDecorationPartStyle(RenderStyle&, const Element*) const
     1206{
     1207}
     1208
     1209void RenderTheme::adjustSearchFieldResultsButtonStyle(RenderStyle&, const Element*) const
    12101210{
    12111211}
  • trunk/Source/WebCore/rendering/RenderTheme.h

    r252255 r252308  
    6666    // selection of control size based off the font, the disabling of appearance when certain other properties like
    6767    // "border" are set, or if the appearance is not supported by the theme.
    68     void adjustStyle(StyleResolver&, RenderStyle&, const Element*, const RenderStyle* userAgentAppearanceStyle);
     68    void adjustStyle(RenderStyle&, const Element*, const RenderStyle* userAgentAppearanceStyle);
    6969
    7070    // This method is called to paint the widget as a background of the RenderObject.  A widget's foreground, e.g., the
     
    286286#if !USE(NEW_THEME)
    287287    // Methods for each appearance value.
    288     virtual void adjustCheckboxStyle(StyleResolver&, RenderStyle&, const Element*) const;
     288    virtual void adjustCheckboxStyle(RenderStyle&, const Element*) const;
    289289    virtual bool paintCheckbox(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    290290    virtual void setCheckboxSize(RenderStyle&) const { }
    291291
    292     virtual void adjustRadioStyle(StyleResolver&, RenderStyle&, const Element*) const;
     292    virtual void adjustRadioStyle(RenderStyle&, const Element*) const;
    293293    virtual bool paintRadio(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    294294    virtual void setRadioSize(RenderStyle&) const { }
    295295
    296     virtual void adjustButtonStyle(StyleResolver&, RenderStyle&, const Element*) const;
     296    virtual void adjustButtonStyle(RenderStyle&, const Element*) const;
    297297    virtual bool paintButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    298298    virtual void setButtonSize(RenderStyle&) const { }
    299299
    300     virtual void adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle&, const Element*) const;
     300    virtual void adjustInnerSpinButtonStyle(RenderStyle&, const Element*) const;
    301301    virtual bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    302302#endif
     
    306306    virtual bool paintButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    307307
    308     virtual void adjustTextFieldStyle(StyleResolver&, RenderStyle&, const Element*) const;
     308    virtual void adjustTextFieldStyle(RenderStyle&, const Element*) const;
    309309    virtual bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; }
    310310    virtual bool paintTextFieldDecorations(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; }
    311311
    312     virtual void adjustTextAreaStyle(StyleResolver&, RenderStyle&, const Element*) const;
     312    virtual void adjustTextAreaStyle(RenderStyle&, const Element*) const;
    313313    virtual bool paintTextArea(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; }
    314314    virtual bool paintTextAreaDecorations(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; }
    315315
    316     virtual void adjustMenuListStyle(StyleResolver&, RenderStyle&, const Element*) const;
     316    virtual void adjustMenuListStyle(RenderStyle&, const Element*) const;
    317317    virtual bool paintMenuList(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; }
    318318    virtual bool paintMenuListDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    319319
    320     virtual void adjustMenuListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const;
     320    virtual void adjustMenuListButtonStyle(RenderStyle&, const Element*) const;
    321321    virtual bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) { return true; }
    322322
     
    325325
    326326#if ENABLE(METER_ELEMENT)
    327     virtual void adjustMeterStyle(StyleResolver&, RenderStyle&, const Element*) const;
     327    virtual void adjustMeterStyle(RenderStyle&, const Element*) const;
    328328    virtual bool paintMeter(const RenderObject&, const PaintInfo&, const IntRect&);
    329329#endif
    330330
    331     virtual void adjustCapsLockIndicatorStyle(StyleResolver&, RenderStyle&, const Element*) const;
     331    virtual void adjustCapsLockIndicatorStyle(RenderStyle&, const Element*) const;
    332332    virtual bool paintCapsLockIndicator(const RenderObject&, const PaintInfo&, const IntRect&);
    333333
    334334#if ENABLE(APPLE_PAY)
    335     virtual void adjustApplePayButtonStyle(StyleResolver&, RenderStyle&, const Element*) const { }
     335    virtual void adjustApplePayButtonStyle(RenderStyle&, const Element*) const { }
    336336    virtual bool paintApplePayButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    337337#endif
    338338
    339339#if ENABLE(ATTACHMENT_ELEMENT)
    340     virtual void adjustAttachmentStyle(StyleResolver&, RenderStyle&, const Element*) const;
     340    virtual void adjustAttachmentStyle(RenderStyle&, const Element*) const;
    341341    virtual bool paintAttachment(const RenderObject&, const PaintInfo&, const IntRect&);
    342342#endif
    343343
    344344#if ENABLE(DATALIST_ELEMENT)
    345     virtual void adjustListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const;
    346 #endif
    347 
    348     virtual void adjustProgressBarStyle(StyleResolver&, RenderStyle&, const Element*) const;
     345    virtual void adjustListButtonStyle(RenderStyle&, const Element*) const;
     346#endif
     347
     348    virtual void adjustProgressBarStyle(RenderStyle&, const Element*) const;
    349349    virtual bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    350350
    351     virtual void adjustSliderTrackStyle(StyleResolver&, RenderStyle&, const Element*) const;
     351    virtual void adjustSliderTrackStyle(RenderStyle&, const Element*) const;
    352352    virtual bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    353353
    354     virtual void adjustSliderThumbStyle(StyleResolver&, RenderStyle&, const Element*) const;
     354    virtual void adjustSliderThumbStyle(RenderStyle&, const Element*) const;
    355355    virtual bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    356356    virtual bool paintSliderThumbDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    357357
    358     virtual void adjustSearchFieldStyle(StyleResolver&, RenderStyle&, const Element*) const;
     358    virtual void adjustSearchFieldStyle(RenderStyle&, const Element*) const;
    359359    virtual bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    360360    virtual bool paintSearchFieldDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    361361
    362     virtual void adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle&, const Element*) const;
     362    virtual void adjustSearchFieldCancelButtonStyle(RenderStyle&, const Element*) const;
    363363    virtual bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) { return true; }
    364364
    365     virtual void adjustSearchFieldDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const;
     365    virtual void adjustSearchFieldDecorationPartStyle(RenderStyle&, const Element*) const;
    366366    virtual bool paintSearchFieldDecorationPart(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    367367
    368     virtual void adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const;
     368    virtual void adjustSearchFieldResultsDecorationPartStyle(RenderStyle&, const Element*) const;
    369369    virtual bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) { return true; }
    370370
    371     virtual void adjustSearchFieldResultsButtonStyle(StyleResolver&, RenderStyle&, const Element*) const;
     371    virtual void adjustSearchFieldResultsButtonStyle(RenderStyle&, const Element*) const;
    372372    virtual bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) { return true; }
    373373
    374     virtual void adjustMediaControlStyle(StyleResolver&, RenderStyle&, const Element*) const;
     374    virtual void adjustMediaControlStyle(RenderStyle&, const Element*) const;
    375375    virtual bool paintMediaFullscreenButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
    376376    virtual bool paintMediaPlayButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
  • trunk/Source/WebCore/rendering/RenderThemeCocoa.h

    r238078 r252308  
    4040
    4141#if ENABLE(APPLE_PAY)
    42     void adjustApplePayButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     42    void adjustApplePayButtonStyle(RenderStyle&, const Element*) const override;
    4343    bool paintApplePayButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
    4444#endif
  • trunk/Source/WebCore/rendering/RenderThemeCocoa.mm

    r238434 r252308  
    5555static const auto applePayButtonMinimumHeight = 30;
    5656
    57 void RenderThemeCocoa::adjustApplePayButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
     57void RenderThemeCocoa::adjustApplePayButtonStyle(RenderStyle& style, const Element*) const
    5858{
    5959    if (style.applePayButtonType() == ApplePayButtonType::Plain)
  • trunk/Source/WebCore/rendering/RenderThemeGtk.cpp

    r248552 r252308  
    291291}
    292292
    293 void RenderThemeGtk::adjustButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
     293void RenderThemeGtk::adjustButtonStyle(RenderStyle& style, const Element*) const
    294294{
    295295    // Some layout tests check explicitly that buttons ignore line-height.
     
    397397}
    398398
    399 void RenderThemeGtk::adjustMenuListStyle(StyleResolver&, RenderStyle& style, const Element* element) const
     399void RenderThemeGtk::adjustMenuListStyle(RenderStyle& style, const Element* element) const
    400400{
    401401    // The tests check explicitly that select menu buttons ignore line height.
     
    409409}
    410410
    411 void RenderThemeGtk::adjustMenuListButtonStyle(StyleResolver& styleResolver, RenderStyle& style, const Element* e) const
    412 {
    413     adjustMenuListStyle(styleResolver, style, e);
     411void RenderThemeGtk::adjustMenuListButtonStyle(RenderStyle& style, const Element* e) const
     412{
     413    adjustMenuListStyle(style, e);
    414414}
    415415
     
    492492
    493493
    494 void RenderThemeGtk::adjustTextFieldStyle(StyleResolver&, RenderStyle& style, const Element* element) const
     494void RenderThemeGtk::adjustTextFieldStyle(RenderStyle& style, const Element* element) const
    495495{
    496496    if (!is<HTMLInputElement>(element) || !shouldHaveSpinButton(downcast<HTMLInputElement>(*element)))
     
    559559}
    560560
    561 void RenderThemeGtk::adjustSearchFieldResultsButtonStyle(StyleResolver& styleResolver, RenderStyle& style, const Element* e) const
    562 {
    563     adjustSearchFieldCancelButtonStyle(styleResolver, style, e);
     561void RenderThemeGtk::adjustSearchFieldResultsButtonStyle(RenderStyle& style, const Element* e) const
     562{
     563    adjustSearchFieldCancelButtonStyle(style, e);
    564564}
    565565
     
    569569}
    570570
    571 void RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle& style, const Element*) const
     571void RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle(RenderStyle& style, const Element*) const
    572572{
    573573    adjustSearchFieldIconStyle(EntryIconLeft, style);
    574574}
    575575
    576 void RenderThemeGtk::adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
     576void RenderThemeGtk::adjustSearchFieldCancelButtonStyle(RenderStyle& style, const Element*) const
    577577{
    578578    adjustSearchFieldIconStyle(EntryIconRight, style);
     
    607607
    608608#if ENABLE(DATALIST_ELEMENT)
    609 void RenderThemeGtk::adjustListButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
     609void RenderThemeGtk::adjustListButtonStyle(RenderStyle& style, const Element*) const
    610610{
    611611    // Add a margin to place the button at end of the input field.
     
    634634#endif
    635635
    636 void RenderThemeGtk::adjustSearchFieldStyle(StyleResolver&, RenderStyle& style, const Element*) const
     636void RenderThemeGtk::adjustSearchFieldStyle(RenderStyle& style, const Element*) const
    637637{
    638638    // We cannot give a proper rendering when border radius is active, unfortunately.
     
    651651}
    652652
    653 void RenderThemeGtk::adjustSliderTrackStyle(StyleResolver&, RenderStyle& style, const Element*) const
     653void RenderThemeGtk::adjustSliderTrackStyle(RenderStyle& style, const Element*) const
    654654{
    655655    style.setBoxShadow(nullptr);
    656656}
    657657
    658 void RenderThemeGtk::adjustSliderThumbStyle(StyleResolver& styleResolver, RenderStyle& style, const Element* element) const
    659 {
    660     RenderTheme::adjustSliderThumbStyle(styleResolver, style, element);
     658void RenderThemeGtk::adjustSliderThumbStyle(RenderStyle& style, const Element* element) const
     659{
     660    RenderTheme::adjustSliderThumbStyle(style, element);
    661661    style.setBoxShadow(nullptr);
    662662}
     
    818818}
    819819
    820 void RenderThemeGtk::adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
     820void RenderThemeGtk::adjustInnerSpinButtonStyle(RenderStyle& style, const Element*) const
    821821{
    822822    style.setWidth(Length(spinButtonSize().width(), Fixed));
     
    11411141#endif
    11421142
    1143 void RenderThemeGtk::adjustProgressBarStyle(StyleResolver&, RenderStyle& style, const Element*) const
     1143void RenderThemeGtk::adjustProgressBarStyle(RenderStyle& style, const Element*) const
    11441144{
    11451145    style.setBoxShadow(nullptr);
  • trunk/Source/WebCore/rendering/RenderThemeGtk.h

    r248033 r252308  
    114114    void setRadioSize(RenderStyle&) const override;
    115115
    116     void adjustButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     116    void adjustButtonStyle(RenderStyle&, const Element*) const override;
    117117    bool paintButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
    118118
    119     void adjustTextFieldStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     119    void adjustTextFieldStyle(RenderStyle&, const Element*) const override;
    120120    bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) override;
    121121    bool paintTextArea(const RenderObject&, const PaintInfo&, const FloatRect&) override;
     
    127127    // Aqua themed controls whenever possible. We always want to use GTK+ theming, so
    128128    // we don't maintain this differentiation.
    129     void adjustMenuListStyle(StyleResolver&, RenderStyle&, const Element*) const override;
    130     void adjustMenuListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     129    void adjustMenuListStyle(RenderStyle&, const Element*) const override;
     130    void adjustMenuListButtonStyle(RenderStyle&, const Element*) const override;
    131131    bool paintMenuList(const RenderObject&, const PaintInfo&, const FloatRect&) override;
    132132    bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) override;
    133133
    134     void adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     134    void adjustSearchFieldResultsDecorationPartStyle(RenderStyle&, const Element*) const override;
    135135    bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) override;
    136136
    137     void adjustSearchFieldStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     137    void adjustSearchFieldStyle(RenderStyle&, const Element*) const override;
    138138    bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) override;
    139139
    140     void adjustSearchFieldResultsButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     140    void adjustSearchFieldResultsButtonStyle(RenderStyle&, const Element*) const override;
    141141    bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) override;
    142142
    143     void adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     143    void adjustSearchFieldCancelButtonStyle(RenderStyle&, const Element*) const override;
    144144    bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) override;
    145145
    146146#if ENABLE(DATALIST_ELEMENT)
    147147    void paintListButtonForInput(const RenderObject&, const PaintInfo&, const FloatRect&);
    148     void adjustListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     148    void adjustListButtonStyle(RenderStyle&, const Element*) const override;
    149149#endif
    150150
    151151    bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override;
    152     void adjustSliderTrackStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     152    void adjustSliderTrackStyle(RenderStyle&, const Element*) const override;
    153153
    154154    bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) override;
    155     void adjustSliderThumbStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     155    void adjustSliderThumbStyle(RenderStyle&, const Element*) const override;
    156156
    157157    void adjustSliderThumbSize(RenderStyle&, const Element*) const override;
     
    176176    Seconds animationRepeatIntervalForProgressBar(RenderProgress&) const override;
    177177    Seconds animationDurationForProgressBar(RenderProgress&) const override;
    178     void adjustProgressBarStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     178    void adjustProgressBarStyle(RenderStyle&, const Element*) const override;
    179179    IntRect progressBarRectForBounds(const RenderObject&, const IntRect&) const override;
    180180    bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) override;
    181181
    182182    InnerSpinButtonLayout innerSpinButtonLayout(const RenderObject&) const override;
    183     void adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     183    void adjustInnerSpinButtonStyle(RenderStyle&, const Element*) const override;
    184184    bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
    185185
  • trunk/Source/WebCore/rendering/RenderThemeIOS.h

    r252255 r252308  
    7070
    7171    // Methods for each appearance value.
    72     void adjustCheckboxStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     72    void adjustCheckboxStyle(RenderStyle&, const Element*) const override;
    7373    bool paintCheckboxDecorations(const RenderObject&, const PaintInfo&, const IntRect&) override;
    7474
    75     void adjustRadioStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     75    void adjustRadioStyle(RenderStyle&, const Element*) const override;
    7676    bool paintRadioDecorations(const RenderObject&, const PaintInfo&, const IntRect&) override;
    7777
    78     void adjustButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     78    void adjustButtonStyle(RenderStyle&, const Element*) const override;
    7979    bool paintButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) override;
    8080    bool paintPushButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) override;
     
    8686    bool paintTextAreaDecorations(const RenderObject&, const PaintInfo&, const FloatRect&) override;
    8787
    88     void adjustMenuListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     88    void adjustMenuListButtonStyle(RenderStyle&, const Element*) const override;
    8989    bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) override;
    9090
    91     void adjustSliderTrackStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     91    void adjustSliderTrackStyle(RenderStyle&, const Element*) const override;
    9292    bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override;
    9393
     
    107107#endif
    108108
    109     void adjustSearchFieldStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     109    void adjustSearchFieldStyle(RenderStyle&, const Element*) const override;
    110110    bool paintSearchFieldDecorations(const RenderObject&, const PaintInfo&, const IntRect&) override;
    111111
  • trunk/Source/WebCore/rendering/RenderThemeIOS.mm

    r252255 r252308  
    345345}
    346346
    347 void RenderThemeIOS::adjustCheckboxStyle(StyleResolver&, RenderStyle& style, const Element*) const
     347void RenderThemeIOS::adjustCheckboxStyle(RenderStyle& style, const Element*) const
    348348{
    349349    if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto())
     
    460460}
    461461
    462 void RenderThemeIOS::adjustRadioStyle(StyleResolver&, RenderStyle& style, const Element*) const
     462void RenderThemeIOS::adjustRadioStyle(RenderStyle& style, const Element*) const
    463463{
    464464    if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto())
     
    621621}
    622622
    623 void RenderThemeIOS::adjustMenuListButtonStyle(StyleResolver&, RenderStyle& style, const Element* element) const
     623void RenderThemeIOS::adjustMenuListButtonStyle(RenderStyle& style, const Element* element) const
    624624{
    625625    // Set the min-height to be at least MenuListMinHeight.
     
    766766const int kDefaultSliderThumbSize = 16;
    767767
    768 void RenderThemeIOS::adjustSliderTrackStyle(StyleResolver& selector, RenderStyle& style, const Element* element) const
    769 {
    770     RenderTheme::adjustSliderTrackStyle(selector, style, element);
     768void RenderThemeIOS::adjustSliderTrackStyle(RenderStyle& style, const Element* element) const
     769{
     770    RenderTheme::adjustSliderTrackStyle(style, element);
    771771
    772772    // FIXME: We should not be relying on border radius for the appearance of our controls <rdar://problem/7675493>.
     
    990990#endif
    991991
    992 void RenderThemeIOS::adjustSearchFieldStyle(StyleResolver& selector, RenderStyle& style, const Element* element) const
    993 {
    994     RenderTheme::adjustSearchFieldStyle(selector, style, element);
     992void RenderThemeIOS::adjustSearchFieldStyle(RenderStyle& style, const Element* element) const
     993{
     994    RenderTheme::adjustSearchFieldStyle(style, element);
    995995
    996996    if (!element)
     
    10121012}
    10131013
    1014 void RenderThemeIOS::adjustButtonStyle(StyleResolver& selector, RenderStyle& style, const Element* element) const
    1015 {
    1016     RenderTheme::adjustButtonStyle(selector, style, element);
     1014void RenderThemeIOS::adjustButtonStyle(RenderStyle& style, const Element* element) const
     1015{
     1016    RenderTheme::adjustButtonStyle(style, element);
    10171017
    10181018#if ENABLE(INPUT_TYPE_COLOR)
  • trunk/Source/WebCore/rendering/RenderThemeMac.h

    r252255 r252308  
    119119
    120120    bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) final;
    121     void adjustTextFieldStyle(StyleResolver&, RenderStyle&, const Element*) const final;
     121    void adjustTextFieldStyle(RenderStyle&, const Element*) const final;
    122122
    123123    bool paintTextArea(const RenderObject&, const PaintInfo&, const FloatRect&) final;
    124     void adjustTextAreaStyle(StyleResolver&, RenderStyle&, const Element*) const final;
     124    void adjustTextAreaStyle(RenderStyle&, const Element*) const final;
    125125
    126126    bool paintMenuList(const RenderObject&, const PaintInfo&, const FloatRect&) final;
    127     void adjustMenuListStyle(StyleResolver&, RenderStyle&, const Element*) const final;
     127    void adjustMenuListStyle(RenderStyle&, const Element*) const final;
    128128
    129129    bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) final;
    130     void adjustMenuListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const final;
    131 
    132     void adjustProgressBarStyle(StyleResolver&, RenderStyle&, const Element*) const final;
     130    void adjustMenuListButtonStyle(RenderStyle&, const Element*) const final;
     131
     132    void adjustProgressBarStyle(RenderStyle&, const Element*) const final;
    133133    bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) final;
    134134
    135135    bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) final;
    136     void adjustSliderTrackStyle(StyleResolver&, RenderStyle&, const Element*) const final;
     136    void adjustSliderTrackStyle(RenderStyle&, const Element*) const final;
    137137
    138138    bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) final;
    139     void adjustSliderThumbStyle(StyleResolver&, RenderStyle&, const Element*) const final;
     139    void adjustSliderThumbStyle(RenderStyle&, const Element*) const final;
    140140
    141141    bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) final;
    142     void adjustSearchFieldStyle(StyleResolver&, RenderStyle&, const Element*) const final;
    143 
    144     void adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle&, const Element*) const final;
     142    void adjustSearchFieldStyle(RenderStyle&, const Element*) const final;
     143
     144    void adjustSearchFieldCancelButtonStyle(RenderStyle&, const Element*) const final;
    145145    bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) final;
    146146
    147     void adjustSearchFieldDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const final;
     147    void adjustSearchFieldDecorationPartStyle(RenderStyle&, const Element*) const final;
    148148    bool paintSearchFieldDecorationPart(const RenderObject&, const PaintInfo&, const IntRect&) final;
    149149
    150     void adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const final;
     150    void adjustSearchFieldResultsDecorationPartStyle(RenderStyle&, const Element*) const final;
    151151    bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) final;
    152152
    153     void adjustSearchFieldResultsButtonStyle(StyleResolver&, RenderStyle&, const Element*) const final;
     153    void adjustSearchFieldResultsButtonStyle(RenderStyle&, const Element*) const final;
    154154    bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) final;
    155155
    156156#if ENABLE(DATALIST_ELEMENT)
    157157    void paintListButtonForInput(const RenderObject&, GraphicsContext&, const FloatRect&);
    158     void adjustListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const final;
     158    void adjustListButtonStyle(RenderStyle&, const Element*) const final;
    159159#endif
    160160
     
    186186    IntSize sizeForFont(const RenderStyle&, const IntSize* sizes) const;
    187187    IntSize sizeForSystemFont(const RenderStyle&, const IntSize* sizes) const;
    188     void setFontFromControlSize(StyleResolver&, RenderStyle&, NSControlSize) const;
     188    void setFontFromControlSize(RenderStyle&, NSControlSize) const;
    189189
    190190    void updateCheckedState(NSCell*, const RenderObject&);
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r252255 r252308  
    6464#import "SharedBuffer.h"
    6565#import "StringTruncator.h"
    66 #import "StyleResolver.h"
    6766#import "ThemeMac.h"
    6867#import "TimeRanges.h"
     
    10751074}
    10761075
    1077 void RenderThemeMac::setFontFromControlSize(StyleResolver&, RenderStyle& style, NSControlSize controlSize) const
     1076void RenderThemeMac::setFontFromControlSize(RenderStyle& style, NSControlSize controlSize) const
    10781077{
    10791078    FontCascadeDescription fontDescription;
     
    11421141}
    11431142
    1144 void RenderThemeMac::adjustListButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
     1143void RenderThemeMac::adjustListButtonStyle(RenderStyle& style, const Element*) const
    11451144{
    11461145    // Add a margin to place the button at end of the input field.
     
    11911190}
    11921191
    1193 void RenderThemeMac::adjustTextFieldStyle(StyleResolver&, RenderStyle&, const Element*) const
     1192void RenderThemeMac::adjustTextFieldStyle(RenderStyle&, const Element*) const
    11941193{
    11951194}
     
    12021201}
    12031202
    1204 void RenderThemeMac::adjustTextAreaStyle(StyleResolver&, RenderStyle&, const Element*) const
     1203void RenderThemeMac::adjustTextAreaStyle(RenderStyle&, const Element*) const
    12051204{
    12061205}
     
    14301429}
    14311430
    1432 void RenderThemeMac::adjustProgressBarStyle(StyleResolver&, RenderStyle&, const Element*) const
     1431void RenderThemeMac::adjustProgressBarStyle(RenderStyle&, const Element*) const
    14331432{
    14341433}
     
    16751674}
    16761675
    1677 void RenderThemeMac::adjustMenuListStyle(StyleResolver& styleResolver, RenderStyle& style, const Element* e) const
     1676void RenderThemeMac::adjustMenuListStyle(RenderStyle& style, const Element* e) const
    16781677{
    16791678    NSControlSize controlSize = controlSizeForFont(style);
     
    17021701    // a reasonable control size, but once that control size is determined, we throw that font away and use the appropriate
    17031702    // system font for the control size instead.
    1704     setFontFromControlSize(styleResolver, style, controlSize);
     1703    setFontFromControlSize(style, controlSize);
    17051704
    17061705    style.setBoxShadow(nullptr);
     
    17481747}
    17491748
    1750 void RenderThemeMac::adjustMenuListButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
     1749void RenderThemeMac::adjustMenuListButtonStyle(RenderStyle& style, const Element*) const
    17511750{
    17521751    float fontScale = style.computedFontPixelSize() / baseFontSize;
     
    18001799const int trackRadius = 2;
    18011800
    1802 void RenderThemeMac::adjustSliderTrackStyle(StyleResolver&, RenderStyle& style, const Element*) const
     1801void RenderThemeMac::adjustSliderTrackStyle(RenderStyle& style, const Element*) const
    18031802{
    18041803    style.setBoxShadow(nullptr);
     
    18461845}
    18471846
    1848 void RenderThemeMac::adjustSliderThumbStyle(StyleResolver& styleResolver, RenderStyle& style, const Element* element) const
    1849 {
    1850     RenderTheme::adjustSliderThumbStyle(styleResolver, style, element);
     1847void RenderThemeMac::adjustSliderThumbStyle(RenderStyle& style, const Element* element) const
     1848{
     1849    RenderTheme::adjustSliderThumbStyle(style, element);
    18511850    style.setBoxShadow(nullptr);
    18521851}
     
    19851984}
    19861985
    1987 void RenderThemeMac::adjustSearchFieldStyle(StyleResolver& styleResolver, RenderStyle& style, const Element*) const
     1986void RenderThemeMac::adjustSearchFieldStyle(RenderStyle& style, const Element*) const
    19881987{
    19891988    // Override border.
     
    20112010
    20122011    NSControlSize controlSize = controlSizeForFont(style);
    2013     setFontFromControlSize(styleResolver, style, controlSize);
     2012    setFontFromControlSize(style, controlSize);
    20142013
    20152014    style.setBoxShadow(nullptr);
     
    20762075}
    20772076
    2078 void RenderThemeMac::adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
     2077void RenderThemeMac::adjustSearchFieldCancelButtonStyle(RenderStyle& style, const Element*) const
    20792078{
    20802079    IntSize size = sizeForSystemFont(style, cancelButtonSizes());
     
    20922091
    20932092const int emptyResultsOffset = 9;
    2094 void RenderThemeMac::adjustSearchFieldDecorationPartStyle(StyleResolver&, RenderStyle& style, const Element*) const
     2093void RenderThemeMac::adjustSearchFieldDecorationPartStyle(RenderStyle& style, const Element*) const
    20952094{
    20962095    IntSize size = sizeForSystemFont(style, resultsButtonSizes());
     
    21052104}
    21062105
    2107 void RenderThemeMac::adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle& style, const Element*) const
     2106void RenderThemeMac::adjustSearchFieldResultsDecorationPartStyle(RenderStyle& style, const Element*) const
    21082107{
    21092108    IntSize size = sizeForSystemFont(style, resultsButtonSizes());
     
    21412140}
    21422141
    2143 void RenderThemeMac::adjustSearchFieldResultsButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
     2142void RenderThemeMac::adjustSearchFieldResultsButtonStyle(RenderStyle& style, const Element*) const
    21442143{
    21452144    IntSize size = sizeForSystemFont(style, resultsButtonSizes());
  • trunk/Source/WebCore/rendering/RenderThemeWin.cpp

    r242842 r252308  
    683683}
    684684
    685 void RenderThemeWin::adjustInnerSpinButtonStyle(StyleResolver& styleResolver, RenderStyle& style, const Element*) const
     685void RenderThemeWin::adjustInnerSpinButtonStyle(RenderStyle& style, const Element*) const
    686686{
    687687    int width = ::GetSystemMetrics(SM_CXVSCROLL);
     
    747747}
    748748
    749 void RenderThemeWin::adjustMenuListStyle(StyleResolver& styleResolver, RenderStyle& style, const Element* e) const
     749void RenderThemeWin::adjustMenuListStyle(RenderStyle& style, const Element* e) const
    750750{
    751751    style.resetBorder();
    752     adjustMenuListButtonStyle(styleResolver, style, e);
    753 }
    754 
    755 void RenderThemeWin::adjustMenuListButtonStyle(StyleResolver& styleResolver, RenderStyle& style, const Element*) const
     752    adjustMenuListButtonStyle(style, e);
     753}
     754
     755void RenderThemeWin::adjustMenuListButtonStyle(RenderStyle& style, const Element*) const
    756756{
    757757    // These are the paddings needed to place the text correctly in the <select> box
     
    857857}
    858858
    859 void RenderThemeWin::adjustSearchFieldStyle(StyleResolver& styleResolver, RenderStyle& style, const Element* e) const
     859void RenderThemeWin::adjustSearchFieldStyle(RenderStyle& style, const Element* e) const
    860860{
    861861    // Override paddingSize to match AppKit text positioning.
     
    892892}
    893893
    894 void RenderThemeWin::adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
     894void RenderThemeWin::adjustSearchFieldCancelButtonStyle(RenderStyle& style, const Element*) const
    895895{
    896896    // Scale the button size based on the font size
     
    901901}
    902902
    903 void RenderThemeWin::adjustSearchFieldDecorationPartStyle(StyleResolver&, RenderStyle& style, const Element*) const
     903void RenderThemeWin::adjustSearchFieldDecorationPartStyle(RenderStyle& style, const Element*) const
    904904{
    905905    IntSize emptySize(1, 11);
     
    908908}
    909909
    910 void RenderThemeWin::adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle& style, const Element*) const
     910void RenderThemeWin::adjustSearchFieldResultsDecorationPartStyle(RenderStyle& style, const Element*) const
    911911{
    912912    // Scale the decoration size based on the font size
     
    940940}
    941941
    942 void RenderThemeWin::adjustSearchFieldResultsButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
     942void RenderThemeWin::adjustSearchFieldResultsButtonStyle(RenderStyle& style, const Element*) const
    943943{
    944944    // Scale the button size based on the font size
     
    11051105
    11061106#if ENABLE(METER_ELEMENT)
    1107 void RenderThemeWin::adjustMeterStyle(StyleResolver&, RenderStyle& style, const Element*) const
     1107void RenderThemeWin::adjustMeterStyle(RenderStyle& style, const Element*) const
    11081108{
    11091109    style.setBoxShadow(nullptr);
  • trunk/Source/WebCore/rendering/RenderThemeWin.h

    r241851 r252308  
    7373    bool paintButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
    7474
    75     void adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     75    void adjustInnerSpinButtonStyle(RenderStyle&, const Element*) const override;
    7676    bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
    7777
     
    8181    { return paintTextField(o, i, r); }
    8282
    83     void adjustMenuListStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     83    void adjustMenuListStyle(RenderStyle&, const Element*) const override;
    8484    bool paintMenuList(const RenderObject&, const PaintInfo&, const FloatRect&) override;
    85     void adjustMenuListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     85    void adjustMenuListButtonStyle(RenderStyle&, const Element*) const override;
    8686
    8787    bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) override;
     
    9393    bool popupOptionSupportsTextIndent() const override { return true; }
    9494
    95     void adjustSearchFieldStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     95    void adjustSearchFieldStyle(RenderStyle&, const Element*) const override;
    9696    bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) override;
    9797
    98     void adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     98    void adjustSearchFieldCancelButtonStyle(RenderStyle&, const Element*) const override;
    9999    bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) override;
    100100
    101     void adjustSearchFieldDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     101    void adjustSearchFieldDecorationPartStyle(RenderStyle&, const Element*) const override;
    102102    bool paintSearchFieldDecorationPart(const RenderObject&, const PaintInfo&, const IntRect&) override { return false; }
    103103
    104     void adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     104    void adjustSearchFieldResultsDecorationPartStyle(RenderStyle&, const Element*) const override;
    105105    bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) override;
    106106
    107     void adjustSearchFieldResultsButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     107    void adjustSearchFieldResultsButtonStyle(RenderStyle&, const Element*) const override;
    108108    bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) override;
    109109
    110110    void themeChanged() override;
    111111
    112     void adjustButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const override { }
    113     void adjustTextFieldStyle(StyleResolver&, RenderStyle& style, const Element*) const override { }
    114     void adjustTextAreaStyle(StyleResolver&, RenderStyle& style, const Element*) const override { }
     112    void adjustButtonStyle(RenderStyle& style, const Element*) const override { }
     113    void adjustTextFieldStyle(RenderStyle& style, const Element*) const override { }
     114    void adjustTextAreaStyle(RenderStyle& style, const Element*) const override { }
    115115
    116116    static void setWebKitIsBeingUnloaded();
     
    128128    IntSize meterSizeForBounds(const RenderMeter&, const IntRect&) const override;
    129129    bool supportsMeter(ControlPart) const override;
    130     void adjustMeterStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     130    void adjustMeterStyle(RenderStyle&, const Element*) const override;
    131131    bool paintMeter(const RenderObject&, const PaintInfo&, const IntRect&) override;
    132132#endif
  • trunk/Source/WebCore/style/StyleAdjuster.h

    r252307 r252308  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626#pragma once
    2727
    28 #include "RenderTheme.h"
    29 #include <wtf/RetainPtr.h>
     28namespace WebCore {
    3029
    31 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
    32 OBJC_CLASS NSDateComponentsFormatter;
     30class Element;
     31class RenderStyle;
     32class SVGElement;
     33class Settings;
     34
     35namespace Style {
     36
     37class Adjuster {
     38public:
     39    Adjuster(const Document&, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle, const Element*);
     40
     41    void adjust(RenderStyle&, const RenderStyle* userAgentAppearanceStyle) const;
     42
     43    static void adjustSVGElementStyle(RenderStyle&, const SVGElement&);
     44#if ENABLE(TEXT_AUTOSIZING)
     45    static bool adjustForTextAutosizing(RenderStyle&, const Element&);
    3346#endif
    3447
    35 namespace WebCore {
     48private:
     49    void adjustDisplayContentsStyle(RenderStyle&) const;
     50    void adjustForSiteSpecificQuirks(RenderStyle&) const;
    3651
    37 class RenderThemeCocoa : public RenderTheme {
    38 private:
    39     bool shouldHaveCapsLockIndicator(const HTMLInputElement&) const final;
    40 
    41 #if ENABLE(APPLE_PAY)
    42     void adjustApplePayButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
    43     bool paintApplePayButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
    44 #endif
    45 
    46 protected:
    47 #if ENABLE(VIDEO)
    48     String mediaControlsFormattedStringForDuration(double) override;
    49 #endif
    50 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
    51     RetainPtr<NSDateComponentsFormatter> m_durationFormatter;
    52 #endif
     52    const Document& m_document;
     53    const RenderStyle& m_parentStyle;
     54    const RenderStyle& m_parentBoxStyle;
     55    const Element* m_element;
    5356};
    5457
    5558}
     59}
  • trunk/Source/WebCore/svg/SVGElement.cpp

    r251499 r252308  
    5252#include "SVGUseElement.h"
    5353#include "ShadowRoot.h"
     54#include "StyleAdjuster.h"
    5455#include "XMLNames.h"
    5556#include <wtf/Assertions.h>
     
    598599    if (auto styleElement = makeRefPtr(this->correspondingElement())) {
    599600        Optional<ElementStyle> style = styleElement->resolveStyle(&parentStyle);
    600         StyleResolver::adjustSVGElementStyle(*this, *style->renderStyle);
     601        Style::Adjuster::adjustSVGElementStyle(*style->renderStyle, *this);
    601602        return style;
    602603    }
Note: See TracChangeset for help on using the changeset viewer.