Diff
Modified: trunk/LayoutTests/ChangeLog (292305 => 292306)
--- trunk/LayoutTests/ChangeLog 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/LayoutTests/ChangeLog 2022-04-04 18:11:11 UTC (rev 292306)
@@ -1,3 +1,20 @@
+2022-04-04 Tim Nguyen <[email protected]>
+
+ Conditionally inject <attachment> styles based on runtime flag
+ https://bugs.webkit.org/show_bug.cgi?id=238739
+
+ Reviewed by Tim Horton.
+
+ Update test expectations, now that display is no longer forced to inline-block by appearance, and now that
+ color is no longer unconditionally set on iOS to -apple-system-blue.
+
+ * fast/attachment/attachment-disabled-rendering-expected.txt:
+ * fast/attachment/attachment-disabled-rendering.html:
+ * platform/ios/fast/attachment/attachment-disabled-rendering-expected.txt: Removed.
+ * platform/mac/fast/attachment/attachment-disabled-rendering-expected.png:
+ * platform/win/fast/attachment/attachment-disabled-rendering-expected.txt: Removed.
+ * platform/wpe/fast/attachment/attachment-disabled-rendering-expected.txt: Removed.
+
2022-04-04 Youenn Fablet <[email protected]>
Service-Worker-Navigation-Preload header not being sent when Navigation Preload is enabled.
Modified: trunk/LayoutTests/fast/attachment/attachment-disabled-rendering-expected.txt (292305 => 292306)
--- trunk/LayoutTests/fast/attachment/attachment-disabled-rendering-expected.txt 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/LayoutTests/fast/attachment/attachment-disabled-rendering-expected.txt 2022-04-04 18:11:11 UTC (rev 292306)
@@ -1,11 +1,11 @@
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
- RenderBlock {HTML} at (0,0) size 800x600
- RenderBody {BODY} at (8,8) size 784x584
+layer at (0,0) size 800x50
+ RenderBlock {HTML} at (0,0) size 800x50
+ RenderBody {BODY} at (8,16) size 784x18
RenderBlock {P} at (0,0) size 784x18
RenderText {#text} at (0,0) size 766x18
text run at (0,0) width 766: "This tests that attachments don't have a custom renderer when they are disabled. This test must be run in the test runner."
RenderBlock (anonymous) at (0,34) size 784x0
- RenderBlock {ATTACHMENT} at (0,0) size 0x0
+ RenderInline {ATTACHMENT} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
Modified: trunk/LayoutTests/fast/attachment/attachment-disabled-rendering.html (292305 => 292306)
--- trunk/LayoutTests/fast/attachment/attachment-disabled-rendering.html 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/LayoutTests/fast/attachment/attachment-disabled-rendering.html 2022-04-04 18:11:11 UTC (rev 292306)
@@ -1,3 +1,4 @@
+<!DOCTYPE html><!-- webkit-test-runner [ AttachmentElementEnabled=false ] -->
<html>
<body>
<p>This tests that attachments don't have a custom renderer when they are disabled. This test must be run in the test runner.</p>
Deleted: trunk/LayoutTests/platform/ios/fast/attachment/attachment-disabled-rendering-expected.txt (292305 => 292306)
--- trunk/LayoutTests/platform/ios/fast/attachment/attachment-disabled-rendering-expected.txt 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/LayoutTests/platform/ios/fast/attachment/attachment-disabled-rendering-expected.txt 2022-04-04 18:11:11 UTC (rev 292306)
@@ -1,11 +0,0 @@
-layer at (0,0) size 800x600
- RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
- RenderBlock {HTML} at (0,0) size 800x600
- RenderBody {BODY} at (8,8) size 784x584
- RenderBlock {P} at (0,0) size 784x20
- RenderText {#text} at (0,0) size 766x19
- text run at (0,0) width 766: "This tests that attachments don't have a custom renderer when they are disabled. This test must be run in the test runner."
- RenderBlock (anonymous) at (0,36) size 784x0
- RenderBlock {ATTACHMENT} at (0,0) size 0x0 [color=#007AFF]
- RenderText {#text} at (0,0) size 0x0
Modified: trunk/LayoutTests/platform/mac/fast/attachment/attachment-disabled-rendering-expected.png
(Binary files differ)
Deleted: trunk/LayoutTests/platform/win/fast/attachment/attachment-disabled-rendering-expected.txt (292305 => 292306)
--- trunk/LayoutTests/platform/win/fast/attachment/attachment-disabled-rendering-expected.txt 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/LayoutTests/platform/win/fast/attachment/attachment-disabled-rendering-expected.txt 2022-04-04 18:11:11 UTC (rev 292306)
@@ -1,11 +0,0 @@
-layer at (0,0) size 800x600
- RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
- RenderBlock {HTML} at (0,0) size 800x600
- RenderBody {BODY} at (8,8) size 784x584
- RenderBlock {P} at (0,0) size 784x18
- RenderText {#text} at (0,0) size 750x18
- text run at (0,0) width 750: "This tests that attachments don't have a custom renderer when they are disabled. This test must be run in the test runner."
- RenderBlock (anonymous) at (0,34) size 784x0
- RenderBlock {ATTACHMENT} at (0,0) size 0x0
- RenderText {#text} at (0,0) size 0x0
Deleted: trunk/LayoutTests/platform/wpe/fast/attachment/attachment-disabled-rendering-expected.txt (292305 => 292306)
--- trunk/LayoutTests/platform/wpe/fast/attachment/attachment-disabled-rendering-expected.txt 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/LayoutTests/platform/wpe/fast/attachment/attachment-disabled-rendering-expected.txt 2022-04-04 18:11:11 UTC (rev 292306)
@@ -1,11 +0,0 @@
-layer at (0,0) size 800x600
- RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
- RenderBlock {HTML} at (0,0) size 800x600
- RenderBody {BODY} at (8,8) size 784x576
- RenderBlock {P} at (0,0) size 784x18
- RenderText {#text} at (0,0) size 750x17
- text run at (0,0) width 750: "This tests that attachments don't have a custom renderer when they are disabled. This test must be run in the test runner."
- RenderBlock (anonymous) at (0,34) size 784x0
- RenderInline {ATTACHMENT} at (0,0) size 0x0
- RenderText {#text} at (0,0) size 0x0
Modified: trunk/Source/WebCore/ChangeLog (292305 => 292306)
--- trunk/Source/WebCore/ChangeLog 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/Source/WebCore/ChangeLog 2022-04-04 18:11:11 UTC (rev 292306)
@@ -1,3 +1,33 @@
+2022-04-04 Tim Nguyen <[email protected]>
+
+ Conditionally inject <attachment> styles based on runtime flag
+ https://bugs.webkit.org/show_bug.cgi?id=238739
+
+ Reviewed by Tim Horton.
+
+ Also use appearance: auto instead of -webkit-appearance: attachment, since it also works thanks to
+ RenderTheme::adjustAppearanceForElement().
+
+ Test: LayoutTests/fast/attachment/attachment-disabled-rendering.html
+
+ * css/html.css:
+ (#endif):
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::attachmentStyleSheet const):
+ Move html.css styles in there.
+ (WebCore::RenderTheme::adjustStyle):
+ (WebCore::RenderTheme::adjustAttachmentStyle const): Deleted.
+ adjustAttachmentStyle was unused, not overriden and no-op.
+ * rendering/RenderTheme.h:
+ * rendering/RenderThemeIOS.h:
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::attachmentStyleSheet const):
+ Put iOS specific styles there.
+ * style/UserAgentStyle.cpp:
+ (WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement):
+ Append styles to UA styling.
+ * style/UserAgentStyle.h:
+
2022-04-04 Víctor Manuel Jáquez Leal <[email protected]>
[GTK][WPE] Compilation error in debug mode after r292279
Modified: trunk/Source/WebCore/css/html.css (292305 => 292306)
--- trunk/Source/WebCore/css/html.css 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/Source/WebCore/css/html.css 2022-04-04 18:11:11 UTC (rev 292306)
@@ -1367,15 +1367,6 @@
}
#endif
-#if defined(ENABLE_ATTACHMENT_ELEMENT) && ENABLE_ATTACHMENT_ELEMENT
-attachment {
- -webkit-appearance: attachment;
-#if defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY
- color: -apple-system-blue;
-#endif
-}
-#endif
-
/* page */
@page {
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (292305 => 292306)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2022-04-04 18:11:11 UTC (rev 292306)
@@ -316,11 +316,6 @@
case ApplePayButtonPart:
return adjustApplePayButtonStyle(style, element);
#endif
-#if ENABLE(ATTACHMENT_ELEMENT)
- case AttachmentPart:
- case BorderlessAttachmentPart:
- return adjustAttachmentStyle(style, element);
-#endif
#if ENABLE(DATALIST_ELEMENT)
case ListButtonPart:
return adjustListButtonStyle(style, element);
@@ -1220,8 +1215,10 @@
#if ENABLE(ATTACHMENT_ELEMENT)
-void RenderTheme::adjustAttachmentStyle(RenderStyle&, const Element*) const
+String RenderTheme::attachmentStyleSheet() const
{
+ ASSERT(RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled());
+ return "attachment { appearance: auto; }"_s;
}
bool RenderTheme::paintAttachment(const RenderObject&, const PaintInfo&, const IntRect&)
Modified: trunk/Source/WebCore/rendering/RenderTheme.h (292305 => 292306)
--- trunk/Source/WebCore/rendering/RenderTheme.h 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/Source/WebCore/rendering/RenderTheme.h 2022-04-04 18:11:11 UTC (rev 292306)
@@ -95,6 +95,9 @@
#if ENABLE(FULLSCREEN_API)
virtual String extraFullScreenStyleSheet() { return String(); }
#endif
+#if ENABLE(ATTACHMENT_ELEMENT)
+ virtual String attachmentStyleSheet() const;
+#endif
#if ENABLE(DATALIST_ELEMENT)
String dataListStyleSheet() const;
#endif
@@ -351,7 +354,6 @@
#endif
#if ENABLE(ATTACHMENT_ELEMENT)
- virtual void adjustAttachmentStyle(RenderStyle&, const Element*) const;
virtual bool paintAttachment(const RenderObject&, const PaintInfo&, const IntRect&);
#endif
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (292305 => 292306)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.h 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h 2022-04-04 18:11:11 UTC (rev 292306)
@@ -179,6 +179,7 @@
LayoutSize attachmentIntrinsicSize(const RenderAttachment&) const override;
int attachmentBaseline(const RenderAttachment&) const override;
bool attachmentShouldAllowWidthToShrink(const RenderAttachment&) const override { return true; }
+ String attachmentStyleSheet() const final;
bool paintAttachment(const RenderObject&, const PaintInfo&, const IntRect&) override;
#endif
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (292305 => 292306)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2022-04-04 18:11:11 UTC (rev 292306)
@@ -1996,6 +1996,12 @@
return true;
}
+String RenderThemeIOS::attachmentStyleSheet() const
+{
+ ASSERT(RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled());
+ return "attachment { appearance: auto; color: -apple-system-blue; }"_s;
+}
+
#endif // ENABLE(ATTACHMENT_ELEMENT)
#if PLATFORM(WATCHOS)
Modified: trunk/Source/WebCore/style/UserAgentStyle.cpp (292305 => 292306)
--- trunk/Source/WebCore/style/UserAgentStyle.cpp 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/Source/WebCore/style/UserAgentStyle.cpp 2022-04-04 18:11:11 UTC (rev 292306)
@@ -33,6 +33,7 @@
#include "ChromeClient.h"
#include "FullscreenManager.h"
#include "HTMLAnchorElement.h"
+#include "HTMLAttachmentElement.h"
#include "HTMLBRElement.h"
#include "HTMLBodyElement.h"
#include "HTMLDataListElement.h"
@@ -78,6 +79,9 @@
StyleSheetContents* UserAgentStyle::imageControlsStyleSheet;
#endif
StyleSheetContents* UserAgentStyle::mediaQueryStyleSheet;
+#if ENABLE(ATTACHMENT_ELEMENT)
+StyleSheetContents* UserAgentStyle::attachmentStyleSheet;
+#endif
#if ENABLE(DATALIST_ELEMENT)
StyleSheetContents* UserAgentStyle::dataListStyleSheet;
#endif
@@ -189,6 +193,12 @@
}
}
#endif // ENABLE(VIDEO) && !ENABLE(MODERN_MEDIA_CONTROLS)
+#if ENABLE(ATTACHMENT_ELEMENT)
+ else if (!attachmentStyleSheet && is<HTMLAttachmentElement>(element)) {
+ attachmentStyleSheet = parseUASheet(RenderTheme::singleton().attachmentStyleSheet());
+ addToDefaultStyle(*attachmentStyleSheet);
+ }
+#endif // ENABLE(ATTACHMENT_ELEMENT)
#if ENABLE(DATALIST_ELEMENT)
else if (!dataListStyleSheet && is<HTMLDataListElement>(element)) {
dataListStyleSheet = parseUASheet(RenderTheme::singleton().dataListStyleSheet());
Modified: trunk/Source/WebCore/style/UserAgentStyle.h (292305 => 292306)
--- trunk/Source/WebCore/style/UserAgentStyle.h 2022-04-04 17:56:54 UTC (rev 292305)
+++ trunk/Source/WebCore/style/UserAgentStyle.h 2022-04-04 18:11:11 UTC (rev 292306)
@@ -49,6 +49,9 @@
#if ENABLE(SERVICE_CONTROLS)
static StyleSheetContents* imageControlsStyleSheet;
#endif
+#if ENABLE(ATTACHMENT_ELEMENT)
+ static StyleSheetContents* attachmentStyleSheet;
+#endif
#if ENABLE(DATALIST_ELEMENT)
static StyleSheetContents* dataListStyleSheet;
#endif