Modified: trunk/Source/WebCore/ChangeLog (284175 => 284176)
--- trunk/Source/WebCore/ChangeLog 2021-10-14 17:54:42 UTC (rev 284175)
+++ trunk/Source/WebCore/ChangeLog 2021-10-14 17:58:17 UTC (rev 284176)
@@ -1,3 +1,34 @@
+2021-10-14 Tim Horton <[email protected]>
+
+ Further adjust style of alternate form control design
+ https://bugs.webkit.org/show_bug.cgi?id=231723
+ <rdar://84227020>
+
+ Reviewed by Dean Jackson.
+
+ * css/parser/CSSParserContext.cpp:
+ (WebCore::CSSParserContext::CSSParserContext):
+ Enable some features used in the new stylesheet. Eventually we should
+ make a bare WebCore::Settings (with the WebCore-level defaults) and
+ initialize everything that comes from Settings from there.
+
+ * rendering/RenderThemeIOS.h:
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::adjustStyleForAlternateFormControlDesignTransition const):
+ (WebCore::RenderThemeIOS::adjustCheckboxStyle const):
+ (WebCore::RenderThemeIOS::adjustRadioStyle const):
+ (WebCore::RenderThemeIOS::adjustMenuListButtonStyle const):
+ (WebCore::RenderThemeIOS::adjustButtonStyle const):
+ (WebCore::RenderThemeIOS::adjustColorWellStyle const):
+ Adjust the style to use an optimized mode when a transform transition is
+ underway, or the element is hovered. This currently affects all transform
+ transitions on these controls, but should be adjusted to only affect
+ ones installed by the UA style sheet.
+
+ * style/InspectorCSSOMWrappers.cpp:
+ (WebCore::Style::InspectorCSSOMWrappers::collectDocumentWrappers):
+ I failed to add the new sheet to the Web Inspector in r284008; do so now.
+
2021-10-14 Tim Nguyen <[email protected]>
Don't run focusing steps on disconnected or inert <dialog>
Modified: trunk/Source/WebCore/css/parser/CSSParserContext.cpp (284175 => 284176)
--- trunk/Source/WebCore/css/parser/CSSParserContext.cpp 2021-10-14 17:54:42 UTC (rev 284175)
+++ trunk/Source/WebCore/css/parser/CSSParserContext.cpp 2021-10-14 17:58:17 UTC (rev 284176)
@@ -46,6 +46,13 @@
: baseURL(baseURL)
, mode(mode)
{
+ // FIXME: We should turn all of the features on from their WebCore Settings defaults.
+ if (mode == UASheetMode) {
+ individualTransformPropertiesEnabled = true;
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+ transformStyleOptimized3DEnabled = true;
+#endif
+ }
}
#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (284175 => 284176)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.h 2021-10-14 17:54:42 UTC (rev 284175)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h 2021-10-14 17:58:17 UTC (rev 284176)
@@ -203,6 +203,8 @@
Color systemColor(CSSValueID, OptionSet<StyleColorOptions>) const override;
+ void adjustStyleForAlternateFormControlDesignTransition(RenderStyle&, const Element*) const;
+
#if USE(SYSTEM_PREVIEW)
RetainPtr<CIContext> m_ciContext;
std::unique_ptr<IOSurface> m_largeBadgeSurface;
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (284175 => 284176)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2021-10-14 17:54:42 UTC (rev 284175)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2021-10-14 17:58:17 UTC (rev 284176)
@@ -336,8 +336,26 @@
return border.rect();
}
-void RenderThemeIOS::adjustCheckboxStyle(RenderStyle& style, const Element*) const
+void RenderThemeIOS::adjustStyleForAlternateFormControlDesignTransition(RenderStyle& style, const Element* element) const
{
+ if (!element)
+ return;
+
+ if (!element->document().settings().alternateFormControlDesignEnabled())
+ return;
+
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+ // FIXME: We need to find a way to not do this for any running transition, only the UA-owned transition.
+ style.setTransformStyle3D(element->hasRunningTransitionForProperty(PseudoId::None, CSSPropertyID::CSSPropertyTranslate) || element->hovered() ? TransformStyle3D::Optimized3D : TransformStyle3D::Flat);
+#else
+ UNUSED_PARAM(style);
+#endif
+}
+
+void RenderThemeIOS::adjustCheckboxStyle(RenderStyle& style, const Element* element) const
+{
+ adjustStyleForAlternateFormControlDesignTransition(style, element);
+
if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto())
return;
@@ -478,8 +496,10 @@
return RenderTheme::isControlStyled(style, userAgentStyle);
}
-void RenderThemeIOS::adjustRadioStyle(RenderStyle& style, const Element*) const
+void RenderThemeIOS::adjustRadioStyle(RenderStyle& style, const Element* element) const
{
+ adjustStyleForAlternateFormControlDesignTransition(style, element);
+
if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto())
return;
@@ -781,6 +801,8 @@
void RenderThemeIOS::adjustMenuListButtonStyle(RenderStyle& style, const Element* element) const
{
+ adjustStyleForAlternateFormControlDesignTransition(style, element);
+
// Set the min-height to be at least MenuListMinHeight.
if (style.height().isAuto())
style.setMinHeight(Length(std::max(MenuListMinHeight, static_cast<int>(MenuListBaseHeight / MenuListBaseFontSize * style.fontDescription().computedSize())), LengthType::Fixed));
@@ -1200,6 +1222,8 @@
void RenderThemeIOS::adjustButtonStyle(RenderStyle& style, const Element* element) const
{
+ adjustStyleForAlternateFormControlDesignTransition(style, element);
+
// If no size is specified, ensure the height of the button matches ControlBaseHeight scaled
// with the font size. min-height is used rather than height to avoid clipping the contents of
// the button in cases where the button contains more than one line of text.
@@ -2657,6 +2681,8 @@
void RenderThemeIOS::adjustColorWellStyle(RenderStyle& style, const Element* element) const
{
+ adjustStyleForAlternateFormControlDesignTransition(style, element);
+
if (!element || element->document().settings().iOSFormControlRefreshEnabled())
return;
Modified: trunk/Source/WebCore/style/InspectorCSSOMWrappers.cpp (284175 => 284176)
--- trunk/Source/WebCore/style/InspectorCSSOMWrappers.cpp 2021-10-14 17:54:42 UTC (rev 284175)
+++ trunk/Source/WebCore/style/InspectorCSSOMWrappers.cpp 2021-10-14 17:58:17 UTC (rev 284176)
@@ -120,6 +120,9 @@
#if ENABLE(IOS_FORM_CONTROL_REFRESH)
collectFromStyleSheetContents(UserAgentStyle::legacyFormControlsIOSStyleSheet);
#endif
+#if ENABLE(ALTERNATE_FORM_CONTROL_DESIGN)
+ collectFromStyleSheetContents(UserAgentStyle::alternateFormControlDesignStyleSheet);
+#endif
collectFromStyleSheetContents(UserAgentStyle::plugInsStyleSheet);
collectFromStyleSheetContents(UserAgentStyle::mediaQueryStyleSheet);