Title: [294640] trunk/Source/WebCore/rendering
Revision
294640
Author
[email protected]
Date
2022-05-23 07:58:55 -0700 (Mon, 23 May 2022)

Log Message

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (294639 => 294640)


--- trunk/Source/WebCore/rendering/RenderTheme.cpp	2022-05-23 14:34:34 UTC (rev 294639)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp	2022-05-23 14:58:55 UTC (rev 294640)
@@ -306,9 +306,11 @@
     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,15 +428,20 @@
         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 @@
     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.

Modified: trunk/Source/WebCore/rendering/RenderTheme.h (294639 => 294640)


--- trunk/Source/WebCore/rendering/RenderTheme.h	2022-05-23 14:34:34 UTC (rev 294639)
+++ trunk/Source/WebCore/rendering/RenderTheme.h	2022-05-23 14:58:55 UTC (rev 294640)
@@ -449,8 +449,6 @@
     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;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to