Skip to content
Permalink
Browse files
Remove RenderTheme::adjustSearchFieldDecorationStyle()
https://bugs.webkit.org/show_bug.cgi?id=240798

Reviewed by Antti Koivisto.

Let appearance: auto; handle this instead, to centralize this in one place.

* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::autoAppearanceForElement const):
(WebCore::RenderTheme::adjustSearchFieldDecorationStyle const): Deleted.
* Source/WebCore/rendering/RenderTheme.h:

Canonical link: https://commits.webkit.org/250864@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
nt1m committed May 23, 2022
1 parent c4017c5 commit 393f7dd9d0b3e248e3066a9f8e73979a556eb11c
Showing 2 changed files with 14 additions and 28 deletions.
@@ -306,9 +306,11 @@ void RenderTheme::adjustStyle(RenderStyle& style, const Element* element, const
case SearchFieldCancelButtonPart:
return adjustSearchFieldCancelButtonStyle(style, element);
case SearchFieldDecorationPart:
return adjustSearchFieldDecorationPartStyle(style, element);
case SearchFieldResultsDecorationPart:
return adjustSearchFieldResultsDecorationPartStyle(style, element);
case SearchFieldResultsButtonPart:
return adjustSearchFieldDecorationStyle(style, element);
return adjustSearchFieldResultsButtonStyle(style, element);
case ProgressBarPart:
return adjustProgressBarStyle(style, element);
case MeterPart:
@@ -426,14 +428,19 @@ ControlPart RenderTheme::autoAppearanceForElement(const Element* elementPtr) con
if (pseudo == ShadowPseudoIds::webkitSearchCancelButton())
return SearchFieldCancelButtonPart;

if (pseudo == ShadowPseudoIds::webkitSearchDecoration())
return SearchFieldDecorationPart;
if (is<SearchFieldResultsButtonElement>(element)) {
if (!downcast<SearchFieldResultsButtonElement>(element.get()).canAdjustStyleForAppearance())
return NoControlPart;

if (pseudo == ShadowPseudoIds::webkitSearchResultsDecoration())
return SearchFieldResultsDecorationPart;
if (pseudo == ShadowPseudoIds::webkitSearchDecoration())
return SearchFieldDecorationPart;

if (pseudo == ShadowPseudoIds::webkitSearchResultsButton())
return SearchFieldResultsButtonPart;
if (pseudo == ShadowPseudoIds::webkitSearchResultsDecoration())
return SearchFieldResultsDecorationPart;

if (pseudo == ShadowPseudoIds::webkitSearchResultsButton())
return SearchFieldResultsButtonPart;
}

if (pseudo == ShadowPseudoIds::webkitSliderThumb() || pseudo == ShadowPseudoIds::webkitMediaSliderThumb())
return SliderThumbHorizontalPart;
@@ -445,25 +452,6 @@ ControlPart RenderTheme::autoAppearanceForElement(const Element* elementPtr) con
return NoControlPart;
}

void RenderTheme::adjustSearchFieldDecorationStyle(RenderStyle& style, const Element* element) const
{
if (is<SearchFieldResultsButtonElement>(element) && !downcast<SearchFieldResultsButtonElement>(*element).canAdjustStyleForAppearance()) {
style.setEffectiveAppearance(NoControlPart);
return;
}

switch (style.effectiveAppearance()) {
case SearchFieldDecorationPart:
return adjustSearchFieldDecorationPartStyle(style, element);
case SearchFieldResultsDecorationPart:
return adjustSearchFieldResultsDecorationPartStyle(style, element);
case SearchFieldResultsButtonPart:
return adjustSearchFieldResultsButtonStyle(style, element);
default:
break;
}
}

bool RenderTheme::paint(const RenderBox& box, ControlStates& controlStates, const PaintInfo& paintInfo, const LayoutRect& rect)
{
// If painting is disabled, but we aren't updating control tints, then just bail.
@@ -449,8 +449,6 @@ class RenderTheme {
ControlPart autoAppearanceForElement(const Element*) const;
ControlPart adjustAppearanceForElement(RenderStyle&, const Element*, ControlPart) const;

void adjustSearchFieldDecorationStyle(RenderStyle&, const Element*) const;

mutable HashMap<uint8_t, ColorCache, DefaultHash<uint8_t>, WTF::UnsignedWithZeroKeyHashTraits<uint8_t>> m_colorCacheMap;
};

0 comments on commit 393f7dd

Please sign in to comment.