Skip to content

Commit

Permalink
Remove ShadowRoot::resetStyleInheritance mechanism
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=260338
rdar://114015755

Reviewed by Alan Baradlay.

UA shadow trees should just use 'all: initial' if needed.

* Source/WebCore/dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::setResetStyleInheritance): Deleted.
* Source/WebCore/dom/ShadowRoot.h:
* Source/WebCore/html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot):
* Source/WebCore/html/shadow/ShadowPseudoIds.cpp:
(WebCore::ShadowPseudoIds::webkitPluginReplacement): Deleted.

Also remove this non-referenced pseudo element name.

* Source/WebCore/html/shadow/ShadowPseudoIds.h:
* Source/WebCore/html/shadow/YouTubeEmbedShadowElement.cpp:

This is the only client for the mechanism, use 'all:initial' instead.

(WebCore::YouTubeEmbedShadowElement::create):
* Source/WebCore/style/StyleResolver.cpp:
(WebCore::Style::Resolver::State::State):

Canonical link: https://commits.webkit.org/266999@main
  • Loading branch information
anttijk committed Aug 17, 2023
1 parent 42904df commit 121c1a4
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 25 deletions.
6 changes: 0 additions & 6 deletions Source/WebCore/dom/ShadowRoot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,6 @@ bool ShadowRoot::childTypeAllowed(NodeType type) const
}
}

void ShadowRoot::setResetStyleInheritance(bool value)
{
// If this was ever changed after initialization, child styles would need to be invalidated here.
m_resetStyleInheritance = value;
}

Ref<Node> ShadowRoot::cloneNodeInternal(Document& targetDocument, CloningOperation type)
{
RELEASE_ASSERT(m_mode != ShadowRootMode::UserAgent);
Expand Down
4 changes: 0 additions & 4 deletions Source/WebCore/dom/ShadowRoot.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ class ShadowRoot final : public DocumentFragment, public TreeScope {
WEBCORE_EXPORT Style::Scope& styleScope();
StyleSheetList& styleSheets();

bool resetStyleInheritance() const { return m_resetStyleInheritance; }
void setResetStyleInheritance(bool);

bool delegatesFocus() const { return m_delegatesFocus; }
bool containsFocusedElement() const { return m_containsFocusedElement; }
void setContainsFocusedElement(bool flag) { m_containsFocusedElement = flag; }
Expand Down Expand Up @@ -144,7 +141,6 @@ class ShadowRoot final : public DocumentFragment, public TreeScope {

void childrenChanged(const ChildChange&) override;

bool m_resetStyleInheritance : 1 { false };
bool m_hasBegunDeletingDetachedChildren : 1 { false };
bool m_delegatesFocus : 1 { false };
bool m_isCloneable : 1 { false };
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/html/HTMLPlugInElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,6 @@ void HTMLPlugInElement::didAddUserAgentShadowRoot(ShadowRoot& root)
if (!m_pluginReplacement || !document().page() || displayState() != PreparingPluginReplacement)
return;

root.setResetStyleInheritance(true);

m_pluginReplacement->installReplacement(root);

setDisplayState(DisplayingPluginReplacement);
Expand Down
6 changes: 0 additions & 6 deletions Source/WebCore/html/shadow/ShadowPseudoIds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,6 @@ const AtomString& webkitMeterEvenLessGoodValue()
return webkitMeterEvenLessGoodValue;
}

const AtomString& webkitPluginReplacement()
{
static MainThreadNeverDestroyed<const AtomString> webkitPluginReplacement("-webkit-plugin-replacement"_s);
return webkitPluginReplacement;
}

const AtomString& webkitProgressBar()
{
static MainThreadNeverDestroyed<const AtomString> webkitProgressBar("-webkit-progress-bar"_s);
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/html/shadow/ShadowPseudoIds.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ const AtomString& webkitMeterOptimumValue();
const AtomString& webkitMeterSuboptimumValue();
const AtomString& webkitMeterEvenLessGoodValue();

const AtomString& webkitPluginReplacement();

const AtomString& webkitProgressBar();
const AtomString& webkitProgressValue();
const AtomString& webkitProgressInnerElement();
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/html/shadow/YouTubeEmbedShadowElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(YouTubeEmbedShadowElement);
Ref<YouTubeEmbedShadowElement> YouTubeEmbedShadowElement::create(Document& document)
{
auto element = adoptRef(*new YouTubeEmbedShadowElement(document));
element->setPseudo(ShadowPseudoIds::webkitPluginReplacement());
element->setInlineStyleProperty(CSSPropertyAll, CSSValueInitial);
return element;
}

Expand Down
4 changes: 0 additions & 4 deletions Source/WebCore/style/StyleResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ class Resolver::State {
: m_element(&element)
, m_parentStyle(parentStyle)
{
bool resetStyleInheritance = hasShadowRootParent(element) && downcast<ShadowRoot>(element.parentNode())->resetStyleInheritance();
if (resetStyleInheritance)
m_parentStyle = nullptr;

auto& document = element.document();
auto* documentElement = document.documentElement();
if (!documentElement || documentElement == &element)
Expand Down

0 comments on commit 121c1a4

Please sign in to comment.