Diff
Modified: trunk/LayoutTests/ChangeLog (293496 => 293497)
--- trunk/LayoutTests/ChangeLog 2022-04-27 04:49:25 UTC (rev 293496)
+++ trunk/LayoutTests/ChangeLog 2022-04-27 05:30:42 UTC (rev 293497)
@@ -1,3 +1,16 @@
+2022-04-26 Antti Koivisto <[email protected]>
+
+ ::first-letter does not work if used only in shadow content
+ https://bugs.webkit.org/show_bug.cgi?id=220650
+ <rdar://problem/73477161>
+
+ Reviewed by Alan Bujtas.
+
+ Test case by [email protected].
+
+ * fast/shadow-dom/shadow-first-line-and-letter-expected.html: Added.
+ * fast/shadow-dom/shadow-first-line-and-letter.html: Added.
+
2022-04-26 Truitt Savell <[email protected]>
Cleanup expectations for 7 imported/w3c/web-platform-tests/html/semantics/interactive-elements/ tests
Added: trunk/LayoutTests/fast/shadow-dom/shadow-first-line-and-letter-expected.html (0 => 293497)
--- trunk/LayoutTests/fast/shadow-dom/shadow-first-line-and-letter-expected.html (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/shadow-first-line-and-letter-expected.html 2022-04-27 05:30:42 UTC (rev 293497)
@@ -0,0 +1,16 @@
+<style>
+p {
+ background-color: antiquewhite;
+ padding: 8px;
+ border: 1px solid coral;
+}
+
+p::first-letter {
+ color: blue;
+}
+
+p::first-line {
+ font-weight: bold;
+}
+</style>
+<p>I should start with a blue I and have a bold first line.</p>
Added: trunk/LayoutTests/fast/shadow-dom/shadow-first-line-and-letter.html (0 => 293497)
--- trunk/LayoutTests/fast/shadow-dom/shadow-first-line-and-letter.html (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/shadow-first-line-and-letter.html 2022-04-27 05:30:42 UTC (rev 293497)
@@ -0,0 +1,22 @@
+<div id=host></div>
+<script>
+const shadow = host.attachShadow({ mode: 'open'});
+shadow.innerHTML = `
+<style>
+p {
+ background-color: antiquewhite;
+ padding: 8px;
+ border: 1px solid coral;
+}
+
+p::first-letter {
+ color: blue;
+}
+
+p::first-line {
+ font-weight: bold;
+}
+</style>
+<p>I should start with a blue I and have a bold first line.</p>
+`;
+</script>
Modified: trunk/Source/WebCore/ChangeLog (293496 => 293497)
--- trunk/Source/WebCore/ChangeLog 2022-04-27 04:49:25 UTC (rev 293496)
+++ trunk/Source/WebCore/ChangeLog 2022-04-27 05:30:42 UTC (rev 293497)
@@ -1,3 +1,33 @@
+2022-04-26 Antti Koivisto <[email protected]>
+
+ ::first-letter does not work if used only in shadow content
+ https://bugs.webkit.org/show_bug.cgi?id=220650
+ <rdar://problem/73477161>
+
+ Reviewed by Alan Bujtas.
+
+ Test: fast/shadow-dom/shadow-first-line-and-letter.html
+
+ We were not setting usesFirstLetter/LinesRules bits if those pseudo-elements were used
+ only in shadow trees.
+
+ Fix by removing the bits. They don't seem to allow any valuable optimizations.
+
+ * rendering/LegacyRootInlineBox.cpp:
+ (WebCore::LegacyRootInlineBox::verticalPositionForBox):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::lineHeight const):
+ (WebCore::RenderBlock::getFirstLetter):
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::mayAffectLayout const):
+ (WebCore::RenderInline::lineHeight const):
+ * rendering/RenderLineBreak.cpp:
+ (WebCore::RenderLineBreak::lineHeight const):
+ * rendering/RenderView.h:
+ * style/StyleTreeResolver.cpp:
+ (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
+ (WebCore::Style::TreeResolver::resolve):
+
2022-04-26 Oriol Brufau <[email protected]>
[css-logical] Side border shorthands should not be logical/physical
Modified: trunk/Source/WebCore/rendering/LegacyRootInlineBox.cpp (293496 => 293497)
--- trunk/Source/WebCore/rendering/LegacyRootInlineBox.cpp 2022-04-27 04:49:25 UTC (rev 293496)
+++ trunk/Source/WebCore/rendering/LegacyRootInlineBox.cpp 2022-04-27 05:30:42 UTC (rev 293497)
@@ -798,8 +798,6 @@
// This method determines the vertical position for inline elements.
bool firstLine = isFirstLine();
- if (firstLine && !blockFlow().view().usesFirstLineRules())
- firstLine = false;
// Check the cache.
bool isRenderInline = renderer->isRenderInline();
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (293496 => 293497)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2022-04-27 04:49:25 UTC (rev 293496)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2022-04-27 05:30:42 UTC (rev 293497)
@@ -2458,13 +2458,8 @@
if (isReplacedOrInlineBlock() && linePositionMode == PositionOnContainingLine)
return RenderBox::lineHeight(firstLine, direction, linePositionMode);
- if (firstLine && view().usesFirstLineRules()) {
- auto& s = firstLineStyle();
- if (&s != &style())
- return s.computedLineHeight();
- }
-
- return style().computedLineHeight();
+ auto& lineStyle = firstLine ? firstLineStyle() : style();
+ return lineStyle.computedLineHeight();
}
LayoutUnit RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
@@ -2618,9 +2613,6 @@
firstLetter = nullptr;
firstLetterContainer = nullptr;
- if (!view().usesFirstLetterRules())
- return;
-
// Don't recur
if (style().styleType() == PseudoId::FirstLetter)
return;
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (293496 => 293497)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2022-04-27 04:49:25 UTC (rev 293496)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2022-04-27 05:30:42 UTC (rev 293497)
@@ -215,7 +215,7 @@
|| parentStyle->lineHeight() != style().lineHeight()))
|| hasHardLineBreakChildOnly;
- if (!mayAffectLayout && checkFonts && view().usesFirstLineRules()) {
+ if (!mayAffectLayout && checkFonts) {
// Have to check the first line style as well.
parentStyle = &parent()->firstLineStyle();
auto& childStyle = firstLineStyle();
@@ -856,13 +856,8 @@
LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*direction*/, LinePositionMode /*linePositionMode*/) const
{
- if (firstLine && view().usesFirstLineRules()) {
- const RenderStyle& firstLineStyle = this->firstLineStyle();
- if (&firstLineStyle != &style())
- return firstLineStyle.computedLineHeight();
- }
-
- return style().computedLineHeight();
+ auto& lineStyle = firstLine ? firstLineStyle() : style();
+ return lineStyle.computedLineHeight();
}
LayoutUnit RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
Modified: trunk/Source/WebCore/rendering/RenderLineBreak.cpp (293496 => 293497)
--- trunk/Source/WebCore/rendering/RenderLineBreak.cpp 2022-04-27 04:49:25 UTC (rev 293496)
+++ trunk/Source/WebCore/rendering/RenderLineBreak.cpp 2022-04-27 05:30:42 UTC (rev 293497)
@@ -66,7 +66,7 @@
LayoutUnit RenderLineBreak::lineHeight(bool firstLine, LineDirectionMode /*direction*/, LinePositionMode /*linePositionMode*/) const
{
- if (firstLine && view().usesFirstLineRules()) {
+ if (firstLine) {
const RenderStyle& firstLineStyle = this->firstLineStyle();
if (&firstLineStyle != &style())
return firstLineStyle.computedLineHeight();
Modified: trunk/Source/WebCore/rendering/RenderView.h (293496 => 293497)
--- trunk/Source/WebCore/rendering/RenderView.h 2022-04-27 04:49:25 UTC (rev 293496)
+++ trunk/Source/WebCore/rendering/RenderView.h 2022-04-27 05:30:42 UTC (rev 293497)
@@ -128,11 +128,6 @@
WEBCORE_EXPORT RenderLayerCompositor& compositor();
WEBCORE_EXPORT bool usesCompositing() const;
- bool usesFirstLineRules() const { return m_usesFirstLineRules; }
- bool usesFirstLetterRules() const { return m_usesFirstLetterRules; }
- void setUsesFirstLineRules(bool value) { m_usesFirstLineRules = value; }
- void setUsesFirstLetterRules(bool value) { m_usesFirstLetterRules = value; }
-
WEBCORE_EXPORT IntRect unscaledDocumentRect() const;
LayoutRect unextendedBackgroundRect() const;
LayoutRect backgroundRect() const;
@@ -265,8 +260,6 @@
unsigned m_renderersWithOutlineCount { 0 };
bool m_hasSoftwareFilters { false };
- bool m_usesFirstLineRules { false };
- bool m_usesFirstLetterRules { false };
bool m_needsRepaintHackAfterCompositingLayerUpdateForDebugOverlaysOnly { false };
bool m_needsEventRegionUpdateForNonCompositedFrame { false };
Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (293496 => 293497)
--- trunk/Source/WebCore/style/StyleTreeResolver.cpp 2022-04-27 04:49:25 UTC (rev 293496)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp 2022-04-27 05:30:42 UTC (rev 293497)
@@ -45,7 +45,6 @@
#include "Quirks.h"
#include "RenderElement.h"
#include "RenderStyle.h"
-#include "RenderView.h"
#include "RuntimeEnabledFeatures.h"
#include "Settings.h"
#include "ShadowRoot.h"
@@ -490,7 +489,7 @@
// First, we need to make sure that any new CSS animation occuring on this element has a matching WebAnimation
// on the document timeline.
- if (document.backForwardCacheState() == Document::NotInBackForwardCache && !document.renderView()->printing()) {
+ if (document.backForwardCacheState() == Document::NotInBackForwardCache && !document.printing()) {
if (oldStyle && (oldStyle->hasTransitions() || newStyle->hasTransitions()))
styleable.updateCSSTransitions(*oldStyle, *newStyle);
@@ -787,8 +786,6 @@
std::unique_ptr<Update> TreeResolver::resolve()
{
- auto& renderView = *m_document.renderView();
-
Element* documentElement = m_document.documentElement();
if (!documentElement) {
m_document.styleScope().resolver();
@@ -809,17 +806,8 @@
m_scopeStack.append(adoptRef(*new Scope(m_document)));
m_parentStack.append(Parent(m_document));
- auto rootResolver = scope().resolver;
-
- // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
- renderView.setUsesFirstLineRules(renderView.usesFirstLineRules() || rootResolver->usesFirstLineRules());
- renderView.setUsesFirstLetterRules(renderView.usesFirstLetterRules() || rootResolver->usesFirstLetterRules());
-
resolveComposedTree();
- renderView.setUsesFirstLineRules(rootResolver->usesFirstLineRules());
- renderView.setUsesFirstLetterRules(rootResolver->usesFirstLetterRules());
-
ASSERT(m_scopeStack.size() == 1);
ASSERT(m_parentStack.size() == 1);
m_parentStack.clear();