- Revision
- 291588
- Author
- [email protected]
- Date
- 2022-03-21 16:39:22 -0700 (Mon, 21 Mar 2022)
Log Message
nj.gov: Background color incorrect for 'State Vehicles' section
https://bugs.webkit.org/show_bug.cgi?id=238035
<rdar://problem/84543795>
Reviewed by Aditya Keerthi.
Source/WebCore:
Test: fast/css/non-form-control-element-drop-appearance.html
Update RenderTheme::adjustStyle to drop appearance for non-form
control elements when they are styled by the author.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustAppearanceForElement const):
(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::isControlStyled const):
* rendering/RenderTheme.h:
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::borderAndBackgroundEqual const):
* rendering/style/RenderStyle.h:
LayoutTests:
* fast/css/non-form-control-element-drop-appearance-expected.html: Added.
* fast/css/non-form-control-element-drop-appearance.html: Added.
* editing/deleting/insert-in-orphaned-selection-crash.html: Added.
Now that we drop native style for non-form control elements, we need to
add height to the style to make sure this table element is selectable and
successfully tests what it needs to test.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (291587 => 291588)
--- trunk/LayoutTests/ChangeLog 2022-03-21 23:36:16 UTC (rev 291587)
+++ trunk/LayoutTests/ChangeLog 2022-03-21 23:39:22 UTC (rev 291588)
@@ -1,3 +1,18 @@
+2022-03-21 Kate Cheney <[email protected]>
+
+ nj.gov: Background color incorrect for 'State Vehicles' section
+ https://bugs.webkit.org/show_bug.cgi?id=238035
+ <rdar://problem/84543795>
+
+ Reviewed by Aditya Keerthi.
+
+ * fast/css/non-form-control-element-drop-appearance-expected.html: Added.
+ * fast/css/non-form-control-element-drop-appearance.html: Added.
+ * editing/deleting/insert-in-orphaned-selection-crash.html: Added.
+ Now that we drop native style for non-form control elements, we need to
+ add height to the style to make sure this table element is selectable and
+ successfully tests what it needs to test.
+
2022-03-21 Commit Queue <[email protected]>
Unreviewed, reverting r291055.
Modified: trunk/LayoutTests/editing/deleting/insert-in-orphaned-selection-crash.html (291587 => 291588)
--- trunk/LayoutTests/editing/deleting/insert-in-orphaned-selection-crash.html 2022-03-21 23:36:16 UTC (rev 291587)
+++ trunk/LayoutTests/editing/deleting/insert-in-orphaned-selection-crash.html 2022-03-21 23:39:22 UTC (rev 291588)
@@ -1,5 +1,6 @@
<style>
* { -webkit-appearance:default-button; }
+ tr { height: 10px; }
</style>
<script>
if (window.testRunner)
Added: trunk/LayoutTests/fast/css/non-form-control-element-drop-appearance-expected.html (0 => 291588)
--- trunk/LayoutTests/fast/css/non-form-control-element-drop-appearance-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css/non-form-control-element-drop-appearance-expected.html 2022-03-21 23:39:22 UTC (rev 291588)
@@ -0,0 +1,3 @@
+<div style="background-color: green">PASS if the background color is green</div>
+<div style="border: dotted">PASS if the border is dotted</div>
+<div style="background-image: url('../body-propagation/background-image/resources/lime.png')">PASS if there is a background image</div>
Added: trunk/LayoutTests/fast/css/non-form-control-element-drop-appearance.html (0 => 291588)
--- trunk/LayoutTests/fast/css/non-form-control-element-drop-appearance.html (rev 0)
+++ trunk/LayoutTests/fast/css/non-form-control-element-drop-appearance.html 2022-03-21 23:39:22 UTC (rev 291588)
@@ -0,0 +1,20 @@
+<style>
+.backgroundColorClass {
+ appearance: button;
+ background-color: green;
+}
+
+.borderClass {
+ appearance: button;
+ border-style: dotted;
+}
+
+.backgroundImageClass {
+ appearance: button;
+ background-image: url('../body-propagation/background-image/resources/lime.png');
+}
+
+</style>
+<div class="backgroundColorClass">PASS if the background color is green</div>
+<div class="borderClass">PASS if the border is dotted</div>
+<div class="backgroundImageClass">PASS if there is a background image</div>
Modified: trunk/Source/WebCore/ChangeLog (291587 => 291588)
--- trunk/Source/WebCore/ChangeLog 2022-03-21 23:36:16 UTC (rev 291587)
+++ trunk/Source/WebCore/ChangeLog 2022-03-21 23:39:22 UTC (rev 291588)
@@ -1,3 +1,25 @@
+2022-03-21 Kate Cheney <[email protected]>
+
+ nj.gov: Background color incorrect for 'State Vehicles' section
+ https://bugs.webkit.org/show_bug.cgi?id=238035
+ <rdar://problem/84543795>
+
+ Reviewed by Aditya Keerthi.
+
+ Test: fast/css/non-form-control-element-drop-appearance.html
+
+ Update RenderTheme::adjustStyle to drop appearance for non-form
+ control elements when they are styled by the author.
+
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::adjustAppearanceForElement const):
+ (WebCore::RenderTheme::adjustStyle):
+ (WebCore::RenderTheme::isControlStyled const):
+ * rendering/RenderTheme.h:
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::borderAndBackgroundEqual const):
+ * rendering/style/RenderStyle.h:
+
2022-03-21 Antoine Quint <[email protected]>
[media-controls] scrubbing on iOS when inline does not work
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (291587 => 291588)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2022-03-21 23:36:16 UTC (rev 291587)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2022-03-21 23:39:22 UTC (rev 291588)
@@ -84,13 +84,12 @@
{
}
-ControlPart RenderTheme::adjustAppearanceForElement(RenderStyle& style, const Element* element) const
+ControlPart RenderTheme::adjustAppearanceForElement(RenderStyle& style, const Element* element, ControlPart autoAppearance) const
{
if (!element)
return NoControlPart;
ControlPart part = style.effectiveAppearance();
- ControlPart autoAppearance = autoAppearanceForElement(element);
if (part == autoAppearance)
return part;
@@ -113,7 +112,8 @@
void RenderTheme::adjustStyle(RenderStyle& style, const Element* element, const RenderStyle* userAgentAppearanceStyle)
{
- auto part = adjustAppearanceForElement(style, element);
+ ControlPart autoAppearance = autoAppearanceForElement(element);
+ auto part = adjustAppearanceForElement(style, element, autoAppearance);
if (part == NoControlPart)
return;
@@ -140,6 +140,11 @@
style.setEffectiveAppearance(part);
}
+ if (!userAgentAppearanceStyle
+ && autoAppearance == NoControlPart
+ && !style.borderAndBackgroundEqual(RenderStyle::defaultStyle()))
+ style.setEffectiveAppearance(NoControlPart);
+
if (!style.hasEffectiveAppearance())
return;
@@ -923,9 +928,7 @@
case TextFieldPart:
case TextAreaPart:
// Test the style to see if the UA border and background match.
- return style.border() != userAgentStyle.border()
- || style.backgroundLayers() != userAgentStyle.backgroundLayers()
- || !style.backgroundColorEqualsToColorIgnoringVisited(userAgentStyle.backgroundColor());
+ return !style.borderAndBackgroundEqual(userAgentStyle);
default:
return false;
}
Modified: trunk/Source/WebCore/rendering/RenderTheme.h (291587 => 291588)
--- trunk/Source/WebCore/rendering/RenderTheme.h 2022-03-21 23:36:16 UTC (rev 291587)
+++ trunk/Source/WebCore/rendering/RenderTheme.h 2022-03-21 23:39:22 UTC (rev 291588)
@@ -459,7 +459,7 @@
private:
ControlPart autoAppearanceForElement(const Element*) const;
- ControlPart adjustAppearanceForElement(RenderStyle&, const Element*) const;
+ ControlPart adjustAppearanceForElement(RenderStyle&, const Element*, ControlPart) const;
void adjustSearchFieldDecorationStyle(RenderStyle&, const Element*) const;
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (291587 => 291588)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2022-03-21 23:36:16 UTC (rev 291587)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2022-03-21 23:39:22 UTC (rev 291588)
@@ -463,6 +463,13 @@
&& m_rareNonInheritedData->justifyItems == other.m_rareNonInheritedData->justifyItems;
}
+bool RenderStyle::borderAndBackgroundEqual(const RenderStyle& other) const
+{
+ return border() == other.border()
+ && backgroundLayers() == other.backgroundLayers()
+ && backgroundColorEqualsToColorIgnoringVisited(other.backgroundColor());
+}
+
#if ENABLE(TEXT_AUTOSIZING)
static inline unsigned computeFontHash(const FontCascade& font)
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (291587 => 291588)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2022-03-21 23:36:16 UTC (rev 291587)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2022-03-21 23:39:22 UTC (rev 291588)
@@ -1939,6 +1939,8 @@
void setOffsetRotate(OffsetRotation&& rotation) { SET_VAR(m_rareNonInheritedData, offsetRotate, WTFMove(rotation)); }
static OffsetRotation initialOffsetRotate() { return OffsetRotation(true, 0); }
+ bool borderAndBackgroundEqual(const RenderStyle&) const;
+
private:
struct NonInheritedFlags {
bool operator==(const NonInheritedFlags&) const;