Changeset 252308 in webkit
- Timestamp:
- Nov 9, 2019 9:09:02 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 19 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252307 r252308 1 2019-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 1 120 2019-11-08 Antoine Quint <graouts@apple.com> 2 121 -
trunk/Source/WebCore/Sources.txt
r252253 r252308 2350 2350 style/MatchedDeclarationsCache.cpp 2351 2351 style/PropertyCascade.cpp 2352 style/StyleAdjuster.cpp 2352 2353 style/StyleBuilder.cpp 2353 2354 style/StyleBuilderState.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r252276 r252308 4819 4819 E45322AC140CE267005A0F92 /* SelectorQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = E45322AA140CE267005A0F92 /* SelectorQuery.h */; }; 4820 4820 E45BA6AA2374926C004DFC07 /* MatchedDeclarationsCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E45BA6A82374926B004DFC07 /* MatchedDeclarationsCache.h */; }; 4821 E45BA6B6237622A3004DFC07 /* StyleAdjuster.h in Headers */ = {isa = PBXBuildFile; fileRef = E45BA6B52376229F004DFC07 /* StyleAdjuster.h */; }; 4821 4822 E4605FEC2166480900E53046 /* PrewarmInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4605FEA2166480800E53046 /* PrewarmInformation.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4822 4823 E461802D1C8DD2900026C02C /* StyleRelations.h in Headers */ = {isa = PBXBuildFile; fileRef = E461802C1C8DD2900026C02C /* StyleRelations.h */; }; … … 15148 15149 E45BA6A82374926B004DFC07 /* MatchedDeclarationsCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MatchedDeclarationsCache.h; sourceTree = "<group>"; }; 15149 15150 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>"; }; 15150 15153 E4605FEA2166480800E53046 /* PrewarmInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrewarmInformation.h; sourceTree = "<group>"; }; 15151 15154 E461802C1C8DD2900026C02C /* StyleRelations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRelations.h; sourceTree = "<group>"; }; … … 27017 27020 E4ABABE52361A34200FA4345 /* PropertyCascade.cpp */, 27018 27021 E4ABABE22361A32900FA4345 /* PropertyCascade.h */, 27022 E45BA6B22376227E004DFC07 /* StyleAdjuster.cpp */, 27023 E45BA6B52376229F004DFC07 /* StyleAdjuster.h */, 27019 27024 E4ABAC07236B018100FA4345 /* StyleBuilder.cpp */, 27020 27025 E4ABAC05236B016C00FA4345 /* StyleBuilder.h */, … … 29261 29266 E1BD331A182D8DDD00C05D9F /* CryptoAlgorithmRSASSA_PKCS1_v1_5.h in Headers */, 29262 29267 E125F82C1822CFEC00D84CD9 /* CryptoAlgorithmSHA1.h in Headers */, 29268 E45BA6B6237622A3004DFC07 /* StyleAdjuster.h in Headers */, 29263 29269 E19AC3EF1824DC7900349426 /* CryptoAlgorithmSHA224.h in Headers */, 29264 29270 E19AC3F11824DC7900349426 /* CryptoAlgorithmSHA256.h in Headers */, -
trunk/Source/WebCore/css/StyleResolver.cpp
r252255 r252308 46 46 #include "FrameSelection.h" 47 47 #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"54 48 #include "InspectorInstrumentation.h" 55 49 #include "KeyframeList.h" 56 50 #include "Logging.h" 57 #include "MathMLElement.h"58 #include "MathMLNames.h"59 51 #include "MediaList.h" 60 52 #include "MediaQueryEvaluator.h" … … 62 54 #include "PageRuleCollector.h" 63 55 #include "Pair.h" 64 #include "Quirks.h"65 56 #include "RenderScrollbar.h" 66 57 #include "RenderStyleConstants.h" 67 #include "RenderTheme.h"68 58 #include "RenderView.h" 69 59 #include "RuleSet.h" 70 60 #include "RuntimeEnabledFeatures.h" 71 #include "SVGDocument.h"72 61 #include "SVGDocumentExtensions.h" 73 62 #include "SVGFontFaceElement.h" 74 #include "SVGNames.h"75 #include "SVGURIReference.h"76 63 #include "Settings.h" 77 64 #include "ShadowRoot.h" 78 65 #include "SharedStringHash.h" 66 #include "StyleAdjuster.h" 79 67 #include "StyleBuilder.h" 80 68 #include "StyleFontSizeFunctions.h" … … 88 76 #include "VisitedLinkState.h" 89 77 #include "WebKitFontFamilyNames.h" 90 #include <bitset>91 78 #include <wtf/Seconds.h> 92 79 #include <wtf/StdLibExtras.h> … … 276 263 applyMatchedProperties(collector.matchResult(), element); 277 264 278 // Clean up our style object's display and text decorations (among other fixups).279 adjust RenderStyle(*state.style(), *state.parentStyle(), parentBoxStyle, &element, state.userAgentAppearanceStyle());265 Style::Adjuster adjuster(document(), *state.parentStyle(), parentBoxStyle, &element); 266 adjuster.adjust(*state.style(), state.userAgentAppearanceStyle()); 280 267 281 268 if (state.style()->hasViewportUnits()) … … 305 292 builder.applyAllProperties(); 306 293 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()); 308 296 309 297 // Add all the animating properties to the keyframe. … … 460 448 applyMatchedProperties(collector.matchResult(), element); 461 449 462 // Clean up our style object's display and text decorations (among other fixups).463 adjust RenderStyle(*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()); 464 452 465 453 if (state.style()->hasViewportUnits()) … … 503 491 return m_state.takeStyle(); 504 492 } 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::InlineTable584 || 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 #endif594 595 static bool hasEffectiveDisplayNoneForDisplayContents(const Element& element)596 {597 // https://drafts.csswg.org/css-display-3/#unbox-html598 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-svg625 // 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 position661 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 should666 // 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-behavior679 // "A touch behavior is supported if it conforms to the touch-action property of each element between680 // the hit tested element and its nearest ancestor with the default touch behavior (including both the681 // 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 #endif707 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 not764 // an idempotent text autosizing candidate; otherwise, if an element that is a text autosizing candidate contains765 // 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 #endif772 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 float789 // property.790 // Sites also commonly use display:inline/block on <td>s and <table>s. In quirks mode we force791 // 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 just803 // use normal instead. If the width of the cell is fixed, then804 // we don't actually use WhiteSpace::NoWrap.805 if (style.width().isFixed())806 style.setWhiteSpace(WhiteSpace::Normal);807 else808 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 to817 // 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 parent830 // node whose computed value for the 'text-align' property is its initial value, whose declaration block consists of831 // just a single declaration that sets the 'text-align' property to the value 'center'.832 // https://html.spec.whatwg.org/multipage/rendering.html#rendering833 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 completely845 // 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 on850 // 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::TableRowGroup853 || 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::TableFooterGroup860 || style.display() == DisplayType::TableHeaderGroup || style.display() == DisplayType::TableRow || style.display() == DisplayType::TableRowGroup861 || style.display() == DisplayType::TableCell)862 style.setWritingMode(parentStyle.writingMode());863 864 // FIXME: Since we don't support block-flow on flexible boxes yet, disallow setting865 // 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/#transformations871 // "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 prevents883 // cases where objects that should be blended as a single unit end up with a non-transparent884 // 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.0f888 || style.hasTransformRelatedProperty()889 || style.hasMask()890 || style.clipPath()891 || style.boxReflect()892 || style.hasFilter()893 #if ENABLE(FILTERS_LEVEL_2)894 || style.hasBackdropFilter()895 #endif896 || style.hasBlendMode()897 || style.hasIsolation()898 || style.position() == PositionType::Sticky899 || style.position() == PositionType::Fixed900 || 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 else935 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 hidden940 // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, we'll let it941 // 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 these947 // styles are specified on a root element, then they will be incorporated in948 // 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::InlineTable955 || 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 overflow963 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 #endif973 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 will983 // 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::Visible1001 || style.overflowY() != Overflow::Visible1002 || style.hasClip()1003 || style.clipPath()1004 || style.hasFilter()1005 #if ENABLE(FILTERS_LEVEL_2)1006 || style.hasBackdropFilter()1007 #endif1008 || 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' or1015 // '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 #endif1022 1023 if (element) {1024 #if ENABLE(TEXT_AUTOSIZING)1025 adjustRenderStyleForTextAutosizing(style, *element);1026 #endif1027 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 1047 493 1048 494 Vector<RefPtr<StyleRule>> StyleResolver::styleRulesForElement(const Element* element, unsigned rulesToInclude) -
trunk/Source/WebCore/css/StyleResolver.h
r252255 r252308 134 134 135 135 void addCurrentSVGFontFaceRules(); 136 static void adjustSVGElementStyle(const SVGElement&, RenderStyle&);137 136 138 137 void setNewStateWithElement(const Element&); … … 184 183 185 184 private: 186 void adjustRenderStyle(RenderStyle&, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle, const Element*, const RenderStyle* userAgentStyle);187 void adjustRenderStyleForSiteSpecificQuirks(RenderStyle&, const Element&);188 189 185 enum class UseMatchedDeclarationsCache { Yes, No }; 190 186 void applyMatchedProperties(const MatchResult&, const Element&, UseMatchedDeclarationsCache = UseMatchedDeclarationsCache::Yes); … … 196 192 197 193 public: 198 typedef HashMap<CSSPropertyID, RefPtr<CSSValue>> PendingImagePropertyMap;199 200 194 class State { 201 195 public: … … 238 232 InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWrappers; } 239 233 240 bool adjustRenderStyleForTextAutosizing(RenderStyle&, const Element&);241 242 234 private: 243 235 void cacheBorderAndBackground(); -
trunk/Source/WebCore/page/Page.cpp
r252254 r252308 114 114 #include "StorageNamespace.h" 115 115 #include "StorageNamespaceProvider.h" 116 #include "StyleAdjuster.h" 116 117 #include "StyleResolver.h" 117 118 #include "StyleScope.h" … … 3062 3063 continue; 3063 3064 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 3068 3068 for (auto& renderer : descendantsOfType<RenderElement>(*document.renderView())) { 3069 3069 if (auto* element = renderer.element()) { 3070 auto needsLayout = styleResolver.adjustRenderStyleForTextAutosizing(renderer.mutableStyle(), *element);3070 auto needsLayout = Style::Adjuster::adjustForTextAutosizing(renderer.mutableStyle(), *element); 3071 3071 if (needsLayout) 3072 3072 renderer.setNeedsLayout(); -
trunk/Source/WebCore/rendering/RenderTheme.cpp
r252255 r252308 79 79 } 80 80 81 void RenderTheme::adjustStyle( StyleResolver& styleResolver,RenderStyle& style, const Element* element, const RenderStyle* userAgentAppearanceStyle)81 void RenderTheme::adjustStyle(RenderStyle& style, const Element* element, const RenderStyle* userAgentAppearanceStyle) 82 82 { 83 83 // Force inline and table display styles to be inline-block (except for table- which is block) … … 98 98 break; 99 99 case TextFieldPart: 100 adjustTextFieldStyle(style Resolver, style, element);100 adjustTextFieldStyle(style, element); 101 101 FALLTHROUGH; 102 102 default: … … 201 201 #if !USE(NEW_THEME) 202 202 case CheckboxPart: 203 return adjustCheckboxStyle(style Resolver, style, element);203 return adjustCheckboxStyle(style, element); 204 204 case RadioPart: 205 return adjustRadioStyle(style Resolver, style, element);205 return adjustRadioStyle(style, element); 206 206 case PushButtonPart: 207 207 case SquareButtonPart: … … 211 211 case DefaultButtonPart: 212 212 case ButtonPart: 213 return adjustButtonStyle(style Resolver, style, element);213 return adjustButtonStyle(style, element); 214 214 case InnerSpinButtonPart: 215 return adjustInnerSpinButtonStyle(style Resolver, style, element);215 return adjustInnerSpinButtonStyle(style, element); 216 216 #endif 217 217 case TextFieldPart: 218 return adjustTextFieldStyle(style Resolver, style, element);218 return adjustTextFieldStyle(style, element); 219 219 case TextAreaPart: 220 return adjustTextAreaStyle(style Resolver, style, element);220 return adjustTextAreaStyle(style, element); 221 221 case MenulistPart: 222 return adjustMenuListStyle(style Resolver, style, element);222 return adjustMenuListStyle(style, element); 223 223 case MenulistButtonPart: 224 return adjustMenuListButtonStyle(style Resolver, style, element);224 return adjustMenuListButtonStyle(style, element); 225 225 case MediaPlayButtonPart: 226 226 case MediaCurrentTimePart: … … 230 230 case MediaMuteButtonPart: 231 231 case MediaVolumeSliderContainerPart: 232 return adjustMediaControlStyle(style Resolver, style, element);232 return adjustMediaControlStyle(style, element); 233 233 case MediaSliderPart: 234 234 case MediaVolumeSliderPart: … … 236 236 case SliderHorizontalPart: 237 237 case SliderVerticalPart: 238 return adjustSliderTrackStyle(style Resolver, style, element);238 return adjustSliderTrackStyle(style, element); 239 239 case SliderThumbHorizontalPart: 240 240 case SliderThumbVerticalPart: 241 return adjustSliderThumbStyle(style Resolver, style, element);241 return adjustSliderThumbStyle(style, element); 242 242 case SearchFieldPart: 243 return adjustSearchFieldStyle(style Resolver, style, element);243 return adjustSearchFieldStyle(style, element); 244 244 case SearchFieldCancelButtonPart: 245 return adjustSearchFieldCancelButtonStyle(style Resolver, style, element);245 return adjustSearchFieldCancelButtonStyle(style, element); 246 246 case SearchFieldDecorationPart: 247 return adjustSearchFieldDecorationPartStyle(style Resolver, style, element);247 return adjustSearchFieldDecorationPartStyle(style, element); 248 248 case SearchFieldResultsDecorationPart: 249 return adjustSearchFieldResultsDecorationPartStyle(style Resolver, style, element);249 return adjustSearchFieldResultsDecorationPartStyle(style, element); 250 250 case SearchFieldResultsButtonPart: 251 return adjustSearchFieldResultsButtonStyle(style Resolver, style, element);251 return adjustSearchFieldResultsButtonStyle(style, element); 252 252 case ProgressBarPart: 253 return adjustProgressBarStyle(style Resolver, style, element);253 return adjustProgressBarStyle(style, element); 254 254 #if ENABLE(METER_ELEMENT) 255 255 case MeterPart: … … 258 258 case DiscreteCapacityLevelIndicatorPart: 259 259 case RatingLevelIndicatorPart: 260 return adjustMeterStyle(style Resolver, style, element);260 return adjustMeterStyle(style, element); 261 261 #endif 262 262 #if ENABLE(SERVICE_CONTROLS) … … 265 265 #endif 266 266 case CapsLockIndicatorPart: 267 return adjustCapsLockIndicatorStyle(style Resolver, style, element);267 return adjustCapsLockIndicatorStyle(style, element); 268 268 #if ENABLE(APPLE_PAY) 269 269 case ApplePayButtonPart: 270 return adjustApplePayButtonStyle(style Resolver, style, element);270 return adjustApplePayButtonStyle(style, element); 271 271 #endif 272 272 #if ENABLE(ATTACHMENT_ELEMENT) 273 273 case AttachmentPart: 274 274 case BorderlessAttachmentPart: 275 return adjustAttachmentStyle(style Resolver, style, element);275 return adjustAttachmentStyle(style, element); 276 276 #endif 277 277 #if ENABLE(DATALIST_ELEMENT) 278 278 case ListButtonPart: 279 return adjustListButtonStyle(style Resolver, style, element);279 return adjustListButtonStyle(style, element); 280 280 #endif 281 281 default: … … 927 927 #if !USE(NEW_THEME) 928 928 929 void RenderTheme::adjustCheckboxStyle( StyleResolver&,RenderStyle& style, const Element*) const929 void RenderTheme::adjustCheckboxStyle(RenderStyle& style, const Element*) const 930 930 { 931 931 // A summary of the rules for checkbox designed to match WinIE: … … 944 944 } 945 945 946 void RenderTheme::adjustRadioStyle( StyleResolver&,RenderStyle& style, const Element*) const946 void RenderTheme::adjustRadioStyle(RenderStyle& style, const Element*) const 947 947 { 948 948 // A summary of the rules for checkbox designed to match WinIE: … … 961 961 } 962 962 963 void RenderTheme::adjustButtonStyle( StyleResolver&,RenderStyle& style, const Element*) const963 void RenderTheme::adjustButtonStyle(RenderStyle& style, const Element*) const 964 964 { 965 965 // Most platforms will completely honor all CSS, and so we have no need to … … 969 969 } 970 970 971 void RenderTheme::adjustInnerSpinButtonStyle( StyleResolver&,RenderStyle&, const Element*) const972 { 973 } 974 #endif 975 976 void RenderTheme::adjustTextFieldStyle( StyleResolver&,RenderStyle&, const Element*) const977 { 978 } 979 980 void RenderTheme::adjustTextAreaStyle( StyleResolver&,RenderStyle&, const Element*) const981 { 982 } 983 984 void RenderTheme::adjustMenuListStyle( StyleResolver&,RenderStyle&, const Element*) const971 void RenderTheme::adjustInnerSpinButtonStyle(RenderStyle&, const Element*) const 972 { 973 } 974 #endif 975 976 void RenderTheme::adjustTextFieldStyle(RenderStyle&, const Element*) const 977 { 978 } 979 980 void RenderTheme::adjustTextAreaStyle(RenderStyle&, const Element*) const 981 { 982 } 983 984 void RenderTheme::adjustMenuListStyle(RenderStyle&, const Element*) const 985 985 { 986 986 } … … 988 988 #if ENABLE(METER_ELEMENT) 989 989 990 void RenderTheme::adjustMeterStyle( StyleResolver&,RenderStyle& style, const Element*) const990 void RenderTheme::adjustMeterStyle(RenderStyle& style, const Element*) const 991 991 { 992 992 style.setBoxShadow(nullptr); … … 1010 1010 #endif // METER_ELEMENT 1011 1011 1012 void RenderTheme::adjustCapsLockIndicatorStyle( StyleResolver&,RenderStyle&, const Element*) const1012 void RenderTheme::adjustCapsLockIndicatorStyle(RenderStyle&, const Element*) const 1013 1013 { 1014 1014 } … … 1021 1021 #if ENABLE(ATTACHMENT_ELEMENT) 1022 1022 1023 void RenderTheme::adjustAttachmentStyle( StyleResolver&,RenderStyle&, const Element*) const1023 void RenderTheme::adjustAttachmentStyle(RenderStyle&, const Element*) const 1024 1024 { 1025 1025 } … … 1050 1050 } 1051 1051 1052 void RenderTheme::adjustListButtonStyle( StyleResolver&,RenderStyle&, const Element*) const1052 void RenderTheme::adjustListButtonStyle(RenderStyle&, const Element*) const 1053 1053 { 1054 1054 } … … 1151 1151 } 1152 1152 1153 void RenderTheme::adjustProgressBarStyle( StyleResolver&,RenderStyle&, const Element*) const1153 void RenderTheme::adjustProgressBarStyle(RenderStyle&, const Element*) const 1154 1154 { 1155 1155 } … … 1170 1170 } 1171 1171 1172 void RenderTheme::adjustMenuListButtonStyle( StyleResolver&,RenderStyle&, const Element*) const1173 { 1174 } 1175 1176 void RenderTheme::adjustMediaControlStyle( StyleResolver&,RenderStyle&, const Element*) const1177 { 1178 } 1179 1180 void RenderTheme::adjustSliderTrackStyle( StyleResolver&,RenderStyle&, const Element*) const1181 { 1182 } 1183 1184 void RenderTheme::adjustSliderThumbStyle( StyleResolver&,RenderStyle& style, const Element* element) const1172 void RenderTheme::adjustMenuListButtonStyle(RenderStyle&, const Element*) const 1173 { 1174 } 1175 1176 void RenderTheme::adjustMediaControlStyle(RenderStyle&, const Element*) const 1177 { 1178 } 1179 1180 void RenderTheme::adjustSliderTrackStyle(RenderStyle&, const Element*) const 1181 { 1182 } 1183 1184 void RenderTheme::adjustSliderThumbStyle(RenderStyle& style, const Element* element) const 1185 1185 { 1186 1186 adjustSliderThumbSize(style, element); … … 1191 1191 } 1192 1192 1193 void RenderTheme::adjustSearchFieldStyle( StyleResolver&,RenderStyle&, const Element*) const1194 { 1195 } 1196 1197 void RenderTheme::adjustSearchFieldCancelButtonStyle( StyleResolver&,RenderStyle&, const Element*) const1198 { 1199 } 1200 1201 void RenderTheme::adjustSearchFieldDecorationPartStyle( StyleResolver&,RenderStyle&, const Element*) const1202 { 1203 } 1204 1205 void RenderTheme::adjustSearchFieldResultsDecorationPartStyle( StyleResolver&,RenderStyle&, const Element*) const1206 { 1207 } 1208 1209 void RenderTheme::adjustSearchFieldResultsButtonStyle( StyleResolver&,RenderStyle&, const Element*) const1193 void RenderTheme::adjustSearchFieldStyle(RenderStyle&, const Element*) const 1194 { 1195 } 1196 1197 void RenderTheme::adjustSearchFieldCancelButtonStyle(RenderStyle&, const Element*) const 1198 { 1199 } 1200 1201 void RenderTheme::adjustSearchFieldDecorationPartStyle(RenderStyle&, const Element*) const 1202 { 1203 } 1204 1205 void RenderTheme::adjustSearchFieldResultsDecorationPartStyle(RenderStyle&, const Element*) const 1206 { 1207 } 1208 1209 void RenderTheme::adjustSearchFieldResultsButtonStyle(RenderStyle&, const Element*) const 1210 1210 { 1211 1211 } -
trunk/Source/WebCore/rendering/RenderTheme.h
r252255 r252308 66 66 // selection of control size based off the font, the disabling of appearance when certain other properties like 67 67 // "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); 69 69 70 70 // This method is called to paint the widget as a background of the RenderObject. A widget's foreground, e.g., the … … 286 286 #if !USE(NEW_THEME) 287 287 // Methods for each appearance value. 288 virtual void adjustCheckboxStyle( StyleResolver&,RenderStyle&, const Element*) const;288 virtual void adjustCheckboxStyle(RenderStyle&, const Element*) const; 289 289 virtual bool paintCheckbox(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 290 290 virtual void setCheckboxSize(RenderStyle&) const { } 291 291 292 virtual void adjustRadioStyle( StyleResolver&,RenderStyle&, const Element*) const;292 virtual void adjustRadioStyle(RenderStyle&, const Element*) const; 293 293 virtual bool paintRadio(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 294 294 virtual void setRadioSize(RenderStyle&) const { } 295 295 296 virtual void adjustButtonStyle( StyleResolver&,RenderStyle&, const Element*) const;296 virtual void adjustButtonStyle(RenderStyle&, const Element*) const; 297 297 virtual bool paintButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 298 298 virtual void setButtonSize(RenderStyle&) const { } 299 299 300 virtual void adjustInnerSpinButtonStyle( StyleResolver&,RenderStyle&, const Element*) const;300 virtual void adjustInnerSpinButtonStyle(RenderStyle&, const Element*) const; 301 301 virtual bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 302 302 #endif … … 306 306 virtual bool paintButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 307 307 308 virtual void adjustTextFieldStyle( StyleResolver&,RenderStyle&, const Element*) const;308 virtual void adjustTextFieldStyle(RenderStyle&, const Element*) const; 309 309 virtual bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; } 310 310 virtual bool paintTextFieldDecorations(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; } 311 311 312 virtual void adjustTextAreaStyle( StyleResolver&,RenderStyle&, const Element*) const;312 virtual void adjustTextAreaStyle(RenderStyle&, const Element*) const; 313 313 virtual bool paintTextArea(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; } 314 314 virtual bool paintTextAreaDecorations(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; } 315 315 316 virtual void adjustMenuListStyle( StyleResolver&,RenderStyle&, const Element*) const;316 virtual void adjustMenuListStyle(RenderStyle&, const Element*) const; 317 317 virtual bool paintMenuList(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; } 318 318 virtual bool paintMenuListDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 319 319 320 virtual void adjustMenuListButtonStyle( StyleResolver&,RenderStyle&, const Element*) const;320 virtual void adjustMenuListButtonStyle(RenderStyle&, const Element*) const; 321 321 virtual bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) { return true; } 322 322 … … 325 325 326 326 #if ENABLE(METER_ELEMENT) 327 virtual void adjustMeterStyle( StyleResolver&,RenderStyle&, const Element*) const;327 virtual void adjustMeterStyle(RenderStyle&, const Element*) const; 328 328 virtual bool paintMeter(const RenderObject&, const PaintInfo&, const IntRect&); 329 329 #endif 330 330 331 virtual void adjustCapsLockIndicatorStyle( StyleResolver&,RenderStyle&, const Element*) const;331 virtual void adjustCapsLockIndicatorStyle(RenderStyle&, const Element*) const; 332 332 virtual bool paintCapsLockIndicator(const RenderObject&, const PaintInfo&, const IntRect&); 333 333 334 334 #if ENABLE(APPLE_PAY) 335 virtual void adjustApplePayButtonStyle( StyleResolver&,RenderStyle&, const Element*) const { }335 virtual void adjustApplePayButtonStyle(RenderStyle&, const Element*) const { } 336 336 virtual bool paintApplePayButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 337 337 #endif 338 338 339 339 #if ENABLE(ATTACHMENT_ELEMENT) 340 virtual void adjustAttachmentStyle( StyleResolver&,RenderStyle&, const Element*) const;340 virtual void adjustAttachmentStyle(RenderStyle&, const Element*) const; 341 341 virtual bool paintAttachment(const RenderObject&, const PaintInfo&, const IntRect&); 342 342 #endif 343 343 344 344 #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; 349 349 virtual bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 350 350 351 virtual void adjustSliderTrackStyle( StyleResolver&,RenderStyle&, const Element*) const;351 virtual void adjustSliderTrackStyle(RenderStyle&, const Element*) const; 352 352 virtual bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 353 353 354 virtual void adjustSliderThumbStyle( StyleResolver&,RenderStyle&, const Element*) const;354 virtual void adjustSliderThumbStyle(RenderStyle&, const Element*) const; 355 355 virtual bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 356 356 virtual bool paintSliderThumbDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 357 357 358 virtual void adjustSearchFieldStyle( StyleResolver&,RenderStyle&, const Element*) const;358 virtual void adjustSearchFieldStyle(RenderStyle&, const Element*) const; 359 359 virtual bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 360 360 virtual bool paintSearchFieldDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 361 361 362 virtual void adjustSearchFieldCancelButtonStyle( StyleResolver&,RenderStyle&, const Element*) const;362 virtual void adjustSearchFieldCancelButtonStyle(RenderStyle&, const Element*) const; 363 363 virtual bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) { return true; } 364 364 365 virtual void adjustSearchFieldDecorationPartStyle( StyleResolver&,RenderStyle&, const Element*) const;365 virtual void adjustSearchFieldDecorationPartStyle(RenderStyle&, const Element*) const; 366 366 virtual bool paintSearchFieldDecorationPart(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 367 367 368 virtual void adjustSearchFieldResultsDecorationPartStyle( StyleResolver&,RenderStyle&, const Element*) const;368 virtual void adjustSearchFieldResultsDecorationPartStyle(RenderStyle&, const Element*) const; 369 369 virtual bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) { return true; } 370 370 371 virtual void adjustSearchFieldResultsButtonStyle( StyleResolver&,RenderStyle&, const Element*) const;371 virtual void adjustSearchFieldResultsButtonStyle(RenderStyle&, const Element*) const; 372 372 virtual bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) { return true; } 373 373 374 virtual void adjustMediaControlStyle( StyleResolver&,RenderStyle&, const Element*) const;374 virtual void adjustMediaControlStyle(RenderStyle&, const Element*) const; 375 375 virtual bool paintMediaFullscreenButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } 376 376 virtual bool paintMediaPlayButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } -
trunk/Source/WebCore/rendering/RenderThemeCocoa.h
r238078 r252308 40 40 41 41 #if ENABLE(APPLE_PAY) 42 void adjustApplePayButtonStyle( StyleResolver&,RenderStyle&, const Element*) const override;42 void adjustApplePayButtonStyle(RenderStyle&, const Element*) const override; 43 43 bool paintApplePayButton(const RenderObject&, const PaintInfo&, const IntRect&) override; 44 44 #endif -
trunk/Source/WebCore/rendering/RenderThemeCocoa.mm
r238434 r252308 55 55 static const auto applePayButtonMinimumHeight = 30; 56 56 57 void RenderThemeCocoa::adjustApplePayButtonStyle( StyleResolver&,RenderStyle& style, const Element*) const57 void RenderThemeCocoa::adjustApplePayButtonStyle(RenderStyle& style, const Element*) const 58 58 { 59 59 if (style.applePayButtonType() == ApplePayButtonType::Plain) -
trunk/Source/WebCore/rendering/RenderThemeGtk.cpp
r248552 r252308 291 291 } 292 292 293 void RenderThemeGtk::adjustButtonStyle( StyleResolver&,RenderStyle& style, const Element*) const293 void RenderThemeGtk::adjustButtonStyle(RenderStyle& style, const Element*) const 294 294 { 295 295 // Some layout tests check explicitly that buttons ignore line-height. … … 397 397 } 398 398 399 void RenderThemeGtk::adjustMenuListStyle( StyleResolver&,RenderStyle& style, const Element* element) const399 void RenderThemeGtk::adjustMenuListStyle(RenderStyle& style, const Element* element) const 400 400 { 401 401 // The tests check explicitly that select menu buttons ignore line height. … … 409 409 } 410 410 411 void RenderThemeGtk::adjustMenuListButtonStyle( StyleResolver& styleResolver,RenderStyle& style, const Element* e) const412 { 413 adjustMenuListStyle(style Resolver, style, e);411 void RenderThemeGtk::adjustMenuListButtonStyle(RenderStyle& style, const Element* e) const 412 { 413 adjustMenuListStyle(style, e); 414 414 } 415 415 … … 492 492 493 493 494 void RenderThemeGtk::adjustTextFieldStyle( StyleResolver&,RenderStyle& style, const Element* element) const494 void RenderThemeGtk::adjustTextFieldStyle(RenderStyle& style, const Element* element) const 495 495 { 496 496 if (!is<HTMLInputElement>(element) || !shouldHaveSpinButton(downcast<HTMLInputElement>(*element))) … … 559 559 } 560 560 561 void RenderThemeGtk::adjustSearchFieldResultsButtonStyle( StyleResolver& styleResolver,RenderStyle& style, const Element* e) const562 { 563 adjustSearchFieldCancelButtonStyle(style Resolver, style, e);561 void RenderThemeGtk::adjustSearchFieldResultsButtonStyle(RenderStyle& style, const Element* e) const 562 { 563 adjustSearchFieldCancelButtonStyle(style, e); 564 564 } 565 565 … … 569 569 } 570 570 571 void RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle( StyleResolver&,RenderStyle& style, const Element*) const571 void RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle(RenderStyle& style, const Element*) const 572 572 { 573 573 adjustSearchFieldIconStyle(EntryIconLeft, style); 574 574 } 575 575 576 void RenderThemeGtk::adjustSearchFieldCancelButtonStyle( StyleResolver&,RenderStyle& style, const Element*) const576 void RenderThemeGtk::adjustSearchFieldCancelButtonStyle(RenderStyle& style, const Element*) const 577 577 { 578 578 adjustSearchFieldIconStyle(EntryIconRight, style); … … 607 607 608 608 #if ENABLE(DATALIST_ELEMENT) 609 void RenderThemeGtk::adjustListButtonStyle( StyleResolver&,RenderStyle& style, const Element*) const609 void RenderThemeGtk::adjustListButtonStyle(RenderStyle& style, const Element*) const 610 610 { 611 611 // Add a margin to place the button at end of the input field. … … 634 634 #endif 635 635 636 void RenderThemeGtk::adjustSearchFieldStyle( StyleResolver&,RenderStyle& style, const Element*) const636 void RenderThemeGtk::adjustSearchFieldStyle(RenderStyle& style, const Element*) const 637 637 { 638 638 // We cannot give a proper rendering when border radius is active, unfortunately. … … 651 651 } 652 652 653 void RenderThemeGtk::adjustSliderTrackStyle( StyleResolver&,RenderStyle& style, const Element*) const653 void RenderThemeGtk::adjustSliderTrackStyle(RenderStyle& style, const Element*) const 654 654 { 655 655 style.setBoxShadow(nullptr); 656 656 } 657 657 658 void RenderThemeGtk::adjustSliderThumbStyle( StyleResolver& styleResolver,RenderStyle& style, const Element* element) const659 { 660 RenderTheme::adjustSliderThumbStyle(style Resolver, style, element);658 void RenderThemeGtk::adjustSliderThumbStyle(RenderStyle& style, const Element* element) const 659 { 660 RenderTheme::adjustSliderThumbStyle(style, element); 661 661 style.setBoxShadow(nullptr); 662 662 } … … 818 818 } 819 819 820 void RenderThemeGtk::adjustInnerSpinButtonStyle( StyleResolver&,RenderStyle& style, const Element*) const820 void RenderThemeGtk::adjustInnerSpinButtonStyle(RenderStyle& style, const Element*) const 821 821 { 822 822 style.setWidth(Length(spinButtonSize().width(), Fixed)); … … 1141 1141 #endif 1142 1142 1143 void RenderThemeGtk::adjustProgressBarStyle( StyleResolver&,RenderStyle& style, const Element*) const1143 void RenderThemeGtk::adjustProgressBarStyle(RenderStyle& style, const Element*) const 1144 1144 { 1145 1145 style.setBoxShadow(nullptr); -
trunk/Source/WebCore/rendering/RenderThemeGtk.h
r248033 r252308 114 114 void setRadioSize(RenderStyle&) const override; 115 115 116 void adjustButtonStyle( StyleResolver&,RenderStyle&, const Element*) const override;116 void adjustButtonStyle(RenderStyle&, const Element*) const override; 117 117 bool paintButton(const RenderObject&, const PaintInfo&, const IntRect&) override; 118 118 119 void adjustTextFieldStyle( StyleResolver&,RenderStyle&, const Element*) const override;119 void adjustTextFieldStyle(RenderStyle&, const Element*) const override; 120 120 bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) override; 121 121 bool paintTextArea(const RenderObject&, const PaintInfo&, const FloatRect&) override; … … 127 127 // Aqua themed controls whenever possible. We always want to use GTK+ theming, so 128 128 // 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; 131 131 bool paintMenuList(const RenderObject&, const PaintInfo&, const FloatRect&) override; 132 132 bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) override; 133 133 134 void adjustSearchFieldResultsDecorationPartStyle( StyleResolver&,RenderStyle&, const Element*) const override;134 void adjustSearchFieldResultsDecorationPartStyle(RenderStyle&, const Element*) const override; 135 135 bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) override; 136 136 137 void adjustSearchFieldStyle( StyleResolver&,RenderStyle&, const Element*) const override;137 void adjustSearchFieldStyle(RenderStyle&, const Element*) const override; 138 138 bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) override; 139 139 140 void adjustSearchFieldResultsButtonStyle( StyleResolver&,RenderStyle&, const Element*) const override;140 void adjustSearchFieldResultsButtonStyle(RenderStyle&, const Element*) const override; 141 141 bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) override; 142 142 143 void adjustSearchFieldCancelButtonStyle( StyleResolver&,RenderStyle&, const Element*) const override;143 void adjustSearchFieldCancelButtonStyle(RenderStyle&, const Element*) const override; 144 144 bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) override; 145 145 146 146 #if ENABLE(DATALIST_ELEMENT) 147 147 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; 149 149 #endif 150 150 151 151 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; 153 153 154 154 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; 156 156 157 157 void adjustSliderThumbSize(RenderStyle&, const Element*) const override; … … 176 176 Seconds animationRepeatIntervalForProgressBar(RenderProgress&) const override; 177 177 Seconds animationDurationForProgressBar(RenderProgress&) const override; 178 void adjustProgressBarStyle( StyleResolver&,RenderStyle&, const Element*) const override;178 void adjustProgressBarStyle(RenderStyle&, const Element*) const override; 179 179 IntRect progressBarRectForBounds(const RenderObject&, const IntRect&) const override; 180 180 bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) override; 181 181 182 182 InnerSpinButtonLayout innerSpinButtonLayout(const RenderObject&) const override; 183 void adjustInnerSpinButtonStyle( StyleResolver&,RenderStyle&, const Element*) const override;183 void adjustInnerSpinButtonStyle(RenderStyle&, const Element*) const override; 184 184 bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) override; 185 185 -
trunk/Source/WebCore/rendering/RenderThemeIOS.h
r252255 r252308 70 70 71 71 // Methods for each appearance value. 72 void adjustCheckboxStyle( StyleResolver&,RenderStyle&, const Element*) const override;72 void adjustCheckboxStyle(RenderStyle&, const Element*) const override; 73 73 bool paintCheckboxDecorations(const RenderObject&, const PaintInfo&, const IntRect&) override; 74 74 75 void adjustRadioStyle( StyleResolver&,RenderStyle&, const Element*) const override;75 void adjustRadioStyle(RenderStyle&, const Element*) const override; 76 76 bool paintRadioDecorations(const RenderObject&, const PaintInfo&, const IntRect&) override; 77 77 78 void adjustButtonStyle( StyleResolver&,RenderStyle&, const Element*) const override;78 void adjustButtonStyle(RenderStyle&, const Element*) const override; 79 79 bool paintButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) override; 80 80 bool paintPushButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) override; … … 86 86 bool paintTextAreaDecorations(const RenderObject&, const PaintInfo&, const FloatRect&) override; 87 87 88 void adjustMenuListButtonStyle( StyleResolver&,RenderStyle&, const Element*) const override;88 void adjustMenuListButtonStyle(RenderStyle&, const Element*) const override; 89 89 bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) override; 90 90 91 void adjustSliderTrackStyle( StyleResolver&,RenderStyle&, const Element*) const override;91 void adjustSliderTrackStyle(RenderStyle&, const Element*) const override; 92 92 bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override; 93 93 … … 107 107 #endif 108 108 109 void adjustSearchFieldStyle( StyleResolver&,RenderStyle&, const Element*) const override;109 void adjustSearchFieldStyle(RenderStyle&, const Element*) const override; 110 110 bool paintSearchFieldDecorations(const RenderObject&, const PaintInfo&, const IntRect&) override; 111 111 -
trunk/Source/WebCore/rendering/RenderThemeIOS.mm
r252255 r252308 345 345 } 346 346 347 void RenderThemeIOS::adjustCheckboxStyle( StyleResolver&,RenderStyle& style, const Element*) const347 void RenderThemeIOS::adjustCheckboxStyle(RenderStyle& style, const Element*) const 348 348 { 349 349 if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto()) … … 460 460 } 461 461 462 void RenderThemeIOS::adjustRadioStyle( StyleResolver&,RenderStyle& style, const Element*) const462 void RenderThemeIOS::adjustRadioStyle(RenderStyle& style, const Element*) const 463 463 { 464 464 if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto()) … … 621 621 } 622 622 623 void RenderThemeIOS::adjustMenuListButtonStyle( StyleResolver&,RenderStyle& style, const Element* element) const623 void RenderThemeIOS::adjustMenuListButtonStyle(RenderStyle& style, const Element* element) const 624 624 { 625 625 // Set the min-height to be at least MenuListMinHeight. … … 766 766 const int kDefaultSliderThumbSize = 16; 767 767 768 void RenderThemeIOS::adjustSliderTrackStyle( StyleResolver& selector,RenderStyle& style, const Element* element) const769 { 770 RenderTheme::adjustSliderTrackStyle(s elector, style, element);768 void RenderThemeIOS::adjustSliderTrackStyle(RenderStyle& style, const Element* element) const 769 { 770 RenderTheme::adjustSliderTrackStyle(style, element); 771 771 772 772 // FIXME: We should not be relying on border radius for the appearance of our controls <rdar://problem/7675493>. … … 990 990 #endif 991 991 992 void RenderThemeIOS::adjustSearchFieldStyle( StyleResolver& selector,RenderStyle& style, const Element* element) const993 { 994 RenderTheme::adjustSearchFieldStyle(s elector, style, element);992 void RenderThemeIOS::adjustSearchFieldStyle(RenderStyle& style, const Element* element) const 993 { 994 RenderTheme::adjustSearchFieldStyle(style, element); 995 995 996 996 if (!element) … … 1012 1012 } 1013 1013 1014 void RenderThemeIOS::adjustButtonStyle( StyleResolver& selector,RenderStyle& style, const Element* element) const1015 { 1016 RenderTheme::adjustButtonStyle(s elector, style, element);1014 void RenderThemeIOS::adjustButtonStyle(RenderStyle& style, const Element* element) const 1015 { 1016 RenderTheme::adjustButtonStyle(style, element); 1017 1017 1018 1018 #if ENABLE(INPUT_TYPE_COLOR) -
trunk/Source/WebCore/rendering/RenderThemeMac.h
r252255 r252308 119 119 120 120 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; 122 122 123 123 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; 125 125 126 126 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; 128 128 129 129 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; 133 133 bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) final; 134 134 135 135 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; 137 137 138 138 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; 140 140 141 141 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; 145 145 bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) final; 146 146 147 void adjustSearchFieldDecorationPartStyle( StyleResolver&,RenderStyle&, const Element*) const final;147 void adjustSearchFieldDecorationPartStyle(RenderStyle&, const Element*) const final; 148 148 bool paintSearchFieldDecorationPart(const RenderObject&, const PaintInfo&, const IntRect&) final; 149 149 150 void adjustSearchFieldResultsDecorationPartStyle( StyleResolver&,RenderStyle&, const Element*) const final;150 void adjustSearchFieldResultsDecorationPartStyle(RenderStyle&, const Element*) const final; 151 151 bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) final; 152 152 153 void adjustSearchFieldResultsButtonStyle( StyleResolver&,RenderStyle&, const Element*) const final;153 void adjustSearchFieldResultsButtonStyle(RenderStyle&, const Element*) const final; 154 154 bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) final; 155 155 156 156 #if ENABLE(DATALIST_ELEMENT) 157 157 void paintListButtonForInput(const RenderObject&, GraphicsContext&, const FloatRect&); 158 void adjustListButtonStyle( StyleResolver&,RenderStyle&, const Element*) const final;158 void adjustListButtonStyle(RenderStyle&, const Element*) const final; 159 159 #endif 160 160 … … 186 186 IntSize sizeForFont(const RenderStyle&, const IntSize* sizes) const; 187 187 IntSize sizeForSystemFont(const RenderStyle&, const IntSize* sizes) const; 188 void setFontFromControlSize( StyleResolver&,RenderStyle&, NSControlSize) const;188 void setFontFromControlSize(RenderStyle&, NSControlSize) const; 189 189 190 190 void updateCheckedState(NSCell*, const RenderObject&); -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r252255 r252308 64 64 #import "SharedBuffer.h" 65 65 #import "StringTruncator.h" 66 #import "StyleResolver.h"67 66 #import "ThemeMac.h" 68 67 #import "TimeRanges.h" … … 1075 1074 } 1076 1075 1077 void RenderThemeMac::setFontFromControlSize( StyleResolver&,RenderStyle& style, NSControlSize controlSize) const1076 void RenderThemeMac::setFontFromControlSize(RenderStyle& style, NSControlSize controlSize) const 1078 1077 { 1079 1078 FontCascadeDescription fontDescription; … … 1142 1141 } 1143 1142 1144 void RenderThemeMac::adjustListButtonStyle( StyleResolver&,RenderStyle& style, const Element*) const1143 void RenderThemeMac::adjustListButtonStyle(RenderStyle& style, const Element*) const 1145 1144 { 1146 1145 // Add a margin to place the button at end of the input field. … … 1191 1190 } 1192 1191 1193 void RenderThemeMac::adjustTextFieldStyle( StyleResolver&,RenderStyle&, const Element*) const1192 void RenderThemeMac::adjustTextFieldStyle(RenderStyle&, const Element*) const 1194 1193 { 1195 1194 } … … 1202 1201 } 1203 1202 1204 void RenderThemeMac::adjustTextAreaStyle( StyleResolver&,RenderStyle&, const Element*) const1203 void RenderThemeMac::adjustTextAreaStyle(RenderStyle&, const Element*) const 1205 1204 { 1206 1205 } … … 1430 1429 } 1431 1430 1432 void RenderThemeMac::adjustProgressBarStyle( StyleResolver&,RenderStyle&, const Element*) const1431 void RenderThemeMac::adjustProgressBarStyle(RenderStyle&, const Element*) const 1433 1432 { 1434 1433 } … … 1675 1674 } 1676 1675 1677 void RenderThemeMac::adjustMenuListStyle( StyleResolver& styleResolver,RenderStyle& style, const Element* e) const1676 void RenderThemeMac::adjustMenuListStyle(RenderStyle& style, const Element* e) const 1678 1677 { 1679 1678 NSControlSize controlSize = controlSizeForFont(style); … … 1702 1701 // a reasonable control size, but once that control size is determined, we throw that font away and use the appropriate 1703 1702 // system font for the control size instead. 1704 setFontFromControlSize(style Resolver, style, controlSize);1703 setFontFromControlSize(style, controlSize); 1705 1704 1706 1705 style.setBoxShadow(nullptr); … … 1748 1747 } 1749 1748 1750 void RenderThemeMac::adjustMenuListButtonStyle( StyleResolver&,RenderStyle& style, const Element*) const1749 void RenderThemeMac::adjustMenuListButtonStyle(RenderStyle& style, const Element*) const 1751 1750 { 1752 1751 float fontScale = style.computedFontPixelSize() / baseFontSize; … … 1800 1799 const int trackRadius = 2; 1801 1800 1802 void RenderThemeMac::adjustSliderTrackStyle( StyleResolver&,RenderStyle& style, const Element*) const1801 void RenderThemeMac::adjustSliderTrackStyle(RenderStyle& style, const Element*) const 1803 1802 { 1804 1803 style.setBoxShadow(nullptr); … … 1846 1845 } 1847 1846 1848 void RenderThemeMac::adjustSliderThumbStyle( StyleResolver& styleResolver,RenderStyle& style, const Element* element) const1849 { 1850 RenderTheme::adjustSliderThumbStyle(style Resolver, style, element);1847 void RenderThemeMac::adjustSliderThumbStyle(RenderStyle& style, const Element* element) const 1848 { 1849 RenderTheme::adjustSliderThumbStyle(style, element); 1851 1850 style.setBoxShadow(nullptr); 1852 1851 } … … 1985 1984 } 1986 1985 1987 void RenderThemeMac::adjustSearchFieldStyle( StyleResolver& styleResolver,RenderStyle& style, const Element*) const1986 void RenderThemeMac::adjustSearchFieldStyle(RenderStyle& style, const Element*) const 1988 1987 { 1989 1988 // Override border. … … 2011 2010 2012 2011 NSControlSize controlSize = controlSizeForFont(style); 2013 setFontFromControlSize(style Resolver, style, controlSize);2012 setFontFromControlSize(style, controlSize); 2014 2013 2015 2014 style.setBoxShadow(nullptr); … … 2076 2075 } 2077 2076 2078 void RenderThemeMac::adjustSearchFieldCancelButtonStyle( StyleResolver&,RenderStyle& style, const Element*) const2077 void RenderThemeMac::adjustSearchFieldCancelButtonStyle(RenderStyle& style, const Element*) const 2079 2078 { 2080 2079 IntSize size = sizeForSystemFont(style, cancelButtonSizes()); … … 2092 2091 2093 2092 const int emptyResultsOffset = 9; 2094 void RenderThemeMac::adjustSearchFieldDecorationPartStyle( StyleResolver&,RenderStyle& style, const Element*) const2093 void RenderThemeMac::adjustSearchFieldDecorationPartStyle(RenderStyle& style, const Element*) const 2095 2094 { 2096 2095 IntSize size = sizeForSystemFont(style, resultsButtonSizes()); … … 2105 2104 } 2106 2105 2107 void RenderThemeMac::adjustSearchFieldResultsDecorationPartStyle( StyleResolver&,RenderStyle& style, const Element*) const2106 void RenderThemeMac::adjustSearchFieldResultsDecorationPartStyle(RenderStyle& style, const Element*) const 2108 2107 { 2109 2108 IntSize size = sizeForSystemFont(style, resultsButtonSizes()); … … 2141 2140 } 2142 2141 2143 void RenderThemeMac::adjustSearchFieldResultsButtonStyle( StyleResolver&,RenderStyle& style, const Element*) const2142 void RenderThemeMac::adjustSearchFieldResultsButtonStyle(RenderStyle& style, const Element*) const 2144 2143 { 2145 2144 IntSize size = sizeForSystemFont(style, resultsButtonSizes()); -
trunk/Source/WebCore/rendering/RenderThemeWin.cpp
r242842 r252308 683 683 } 684 684 685 void RenderThemeWin::adjustInnerSpinButtonStyle( StyleResolver& styleResolver,RenderStyle& style, const Element*) const685 void RenderThemeWin::adjustInnerSpinButtonStyle(RenderStyle& style, const Element*) const 686 686 { 687 687 int width = ::GetSystemMetrics(SM_CXVSCROLL); … … 747 747 } 748 748 749 void RenderThemeWin::adjustMenuListStyle( StyleResolver& styleResolver,RenderStyle& style, const Element* e) const749 void RenderThemeWin::adjustMenuListStyle(RenderStyle& style, const Element* e) const 750 750 { 751 751 style.resetBorder(); 752 adjustMenuListButtonStyle(style Resolver, style, e);753 } 754 755 void RenderThemeWin::adjustMenuListButtonStyle( StyleResolver& styleResolver,RenderStyle& style, const Element*) const752 adjustMenuListButtonStyle(style, e); 753 } 754 755 void RenderThemeWin::adjustMenuListButtonStyle(RenderStyle& style, const Element*) const 756 756 { 757 757 // These are the paddings needed to place the text correctly in the <select> box … … 857 857 } 858 858 859 void RenderThemeWin::adjustSearchFieldStyle( StyleResolver& styleResolver,RenderStyle& style, const Element* e) const859 void RenderThemeWin::adjustSearchFieldStyle(RenderStyle& style, const Element* e) const 860 860 { 861 861 // Override paddingSize to match AppKit text positioning. … … 892 892 } 893 893 894 void RenderThemeWin::adjustSearchFieldCancelButtonStyle( StyleResolver&,RenderStyle& style, const Element*) const894 void RenderThemeWin::adjustSearchFieldCancelButtonStyle(RenderStyle& style, const Element*) const 895 895 { 896 896 // Scale the button size based on the font size … … 901 901 } 902 902 903 void RenderThemeWin::adjustSearchFieldDecorationPartStyle( StyleResolver&,RenderStyle& style, const Element*) const903 void RenderThemeWin::adjustSearchFieldDecorationPartStyle(RenderStyle& style, const Element*) const 904 904 { 905 905 IntSize emptySize(1, 11); … … 908 908 } 909 909 910 void RenderThemeWin::adjustSearchFieldResultsDecorationPartStyle( StyleResolver&,RenderStyle& style, const Element*) const910 void RenderThemeWin::adjustSearchFieldResultsDecorationPartStyle(RenderStyle& style, const Element*) const 911 911 { 912 912 // Scale the decoration size based on the font size … … 940 940 } 941 941 942 void RenderThemeWin::adjustSearchFieldResultsButtonStyle( StyleResolver&,RenderStyle& style, const Element*) const942 void RenderThemeWin::adjustSearchFieldResultsButtonStyle(RenderStyle& style, const Element*) const 943 943 { 944 944 // Scale the button size based on the font size … … 1105 1105 1106 1106 #if ENABLE(METER_ELEMENT) 1107 void RenderThemeWin::adjustMeterStyle( StyleResolver&,RenderStyle& style, const Element*) const1107 void RenderThemeWin::adjustMeterStyle(RenderStyle& style, const Element*) const 1108 1108 { 1109 1109 style.setBoxShadow(nullptr); -
trunk/Source/WebCore/rendering/RenderThemeWin.h
r241851 r252308 73 73 bool paintButton(const RenderObject&, const PaintInfo&, const IntRect&) override; 74 74 75 void adjustInnerSpinButtonStyle( StyleResolver&,RenderStyle&, const Element*) const override;75 void adjustInnerSpinButtonStyle(RenderStyle&, const Element*) const override; 76 76 bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) override; 77 77 … … 81 81 { return paintTextField(o, i, r); } 82 82 83 void adjustMenuListStyle( StyleResolver&,RenderStyle&, const Element*) const override;83 void adjustMenuListStyle(RenderStyle&, const Element*) const override; 84 84 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; 86 86 87 87 bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) override; … … 93 93 bool popupOptionSupportsTextIndent() const override { return true; } 94 94 95 void adjustSearchFieldStyle( StyleResolver&,RenderStyle&, const Element*) const override;95 void adjustSearchFieldStyle(RenderStyle&, const Element*) const override; 96 96 bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) override; 97 97 98 void adjustSearchFieldCancelButtonStyle( StyleResolver&,RenderStyle&, const Element*) const override;98 void adjustSearchFieldCancelButtonStyle(RenderStyle&, const Element*) const override; 99 99 bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) override; 100 100 101 void adjustSearchFieldDecorationPartStyle( StyleResolver&,RenderStyle&, const Element*) const override;101 void adjustSearchFieldDecorationPartStyle(RenderStyle&, const Element*) const override; 102 102 bool paintSearchFieldDecorationPart(const RenderObject&, const PaintInfo&, const IntRect&) override { return false; } 103 103 104 void adjustSearchFieldResultsDecorationPartStyle( StyleResolver&,RenderStyle&, const Element*) const override;104 void adjustSearchFieldResultsDecorationPartStyle(RenderStyle&, const Element*) const override; 105 105 bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) override; 106 106 107 void adjustSearchFieldResultsButtonStyle( StyleResolver&,RenderStyle&, const Element*) const override;107 void adjustSearchFieldResultsButtonStyle(RenderStyle&, const Element*) const override; 108 108 bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) override; 109 109 110 110 void themeChanged() override; 111 111 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 { } 115 115 116 116 static void setWebKitIsBeingUnloaded(); … … 128 128 IntSize meterSizeForBounds(const RenderMeter&, const IntRect&) const override; 129 129 bool supportsMeter(ControlPart) const override; 130 void adjustMeterStyle( StyleResolver&,RenderStyle&, const Element*) const override;130 void adjustMeterStyle(RenderStyle&, const Element*) const override; 131 131 bool paintMeter(const RenderObject&, const PaintInfo&, const IntRect&) override; 132 132 #endif -
trunk/Source/WebCore/style/StyleAdjuster.h
r252307 r252308 1 1 /* 2 * Copyright (C) 201 6Apple Inc. All rights reserved.2 * Copyright (C) 2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include "RenderTheme.h" 29 #include <wtf/RetainPtr.h> 28 namespace WebCore { 30 29 31 #if ENABLE(MEDIA_CONTROLS_SCRIPT) 32 OBJC_CLASS NSDateComponentsFormatter; 30 class Element; 31 class RenderStyle; 32 class SVGElement; 33 class Settings; 34 35 namespace Style { 36 37 class Adjuster { 38 public: 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&); 33 46 #endif 34 47 35 namespace WebCore { 48 private: 49 void adjustDisplayContentsStyle(RenderStyle&) const; 50 void adjustForSiteSpecificQuirks(RenderStyle&) const; 36 51 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; 53 56 }; 54 57 55 58 } 59 } -
trunk/Source/WebCore/svg/SVGElement.cpp
r251499 r252308 52 52 #include "SVGUseElement.h" 53 53 #include "ShadowRoot.h" 54 #include "StyleAdjuster.h" 54 55 #include "XMLNames.h" 55 56 #include <wtf/Assertions.h> … … 598 599 if (auto styleElement = makeRefPtr(this->correspondingElement())) { 599 600 Optional<ElementStyle> style = styleElement->resolveStyle(&parentStyle); 600 Style Resolver::adjustSVGElementStyle(*this, *style->renderStyle);601 Style::Adjuster::adjustSVGElementStyle(*style->renderStyle, *this); 601 602 return style; 602 603 }
Note: See TracChangeset
for help on using the changeset viewer.