Skip to content

Commit

Permalink
Use PseudoElementIdentifier in ComputedStyleExtractor and CSSComputed…
Browse files Browse the repository at this point in the history
…StyleDeclaration

https://bugs.webkit.org/show_bug.cgi?id=268063
rdar://121580606

Reviewed by Antti Koivisto.

In preparation of making animation code and `getComputedStyle()` work with pseudo-element name arguments (like `::highlight(name)` or `::view-transition-group(name)`).

Some of the consumers will also need refactoring to take PseudoElementIdentifier, which will be done separately.

* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::getKeyframes):
* Source/WebCore/css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::CSSComputedStyleDeclaration):
(WebCore::CSSComputedStyleDeclaration::create):
(WebCore::CSSComputedStyleDeclaration::createEmpty):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue const):
(WebCore::CSSComputedStyleDeclaration::copyProperties const):
(WebCore::CSSComputedStyleDeclaration::getPropertyValue const):
(WebCore::CSSComputedStyleDeclaration::length const):
(WebCore::CSSComputedStyleDeclaration::item const):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
(WebCore::CSSComputedStyleDeclaration::getPropertyValue):
* Source/WebCore/css/CSSComputedStyleDeclaration.h:
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::ComputedStyleExtractor::ComputedStyleExtractor):
(WebCore::ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword const):
(WebCore::ComputedStyleExtractor::useFixedFontDefaultSize const):
(WebCore::ComputedStyleExtractor::styledRenderer const):
(WebCore::computeRenderStyleForProperty):
(WebCore::ComputedStyleExtractor::customPropertyValue const):
(WebCore::ComputedStyleExtractor::propertyValue const):
(WebCore::ComputedStyleExtractor::propertyMatches const):
(WebCore::ComputedStyleExtractor::getLayerCount const):
* Source/WebCore/css/ComputedStyleExtractor.h:
* Source/WebCore/css/SelectorChecker.h:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::styleForElementIgnoringPendingStylesheets):
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::resolvePseudoElementStyle):
(WebCore::Element::computedStyle):
* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/Node.cpp:
(WebCore::Node::computedStyle):
* Source/WebCore/dom/Node.h:
* Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp:
(WebCore::buildObjectForKeyframes):
* Source/WebCore/inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::getComputedStyleForNode):
* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::getComputedStyle const):
(WebCore::LocalDOMWindow::getMatchedCSSRules const): Deleted.
(WebCore::LocalDOMWindow::webkitConvertPointFromNodeToPage const): Deleted.
(WebCore::LocalDOMWindow::webkitConvertPointFromPageToNode const): Deleted.
(WebCore::LocalDOMWindow::devicePixelRatio const): Deleted.
(WebCore::LocalDOMWindow::scrollBy const): Deleted.
(WebCore::LocalDOMWindow::scrollTo const): Deleted.
(WebCore::LocalDOMWindow::allowedToChangeWindowGeometry const): Deleted.
(WebCore::LocalDOMWindow::moveBy const): Deleted.
(WebCore::LocalDOMWindow::moveTo const): Deleted.
(WebCore::LocalDOMWindow::resizeBy const): Deleted.
(WebCore::LocalDOMWindow::resizeTo const): Deleted.
(WebCore::LocalDOMWindow::setTimeout): Deleted.
(WebCore::LocalDOMWindow::clearTimeout): Deleted.
(WebCore::LocalDOMWindow::setInterval): Deleted.
(WebCore::LocalDOMWindow::clearInterval): Deleted.
(WebCore::LocalDOMWindow::requestAnimationFrame): Deleted.
(WebCore::LocalDOMWindow::webkitRequestAnimationFrame): Deleted.
(WebCore::LocalDOMWindow::cancelAnimationFrame): Deleted.
(WebCore::LocalDOMWindow::requestIdleCallback): Deleted.
(WebCore::LocalDOMWindow::cancelIdleCallback): Deleted.
(WebCore::LocalDOMWindow::createImageBitmap): Deleted.
(WebCore::LocalDOMWindow::isSecureContext const): Deleted.
(WebCore::LocalDOMWindow::crossOriginIsolated const): Deleted.
(WebCore::didAddStorageEventListener): Deleted.
(WebCore::LocalDOMWindow::isSameSecurityOriginAsMainFrame const): Deleted.
(WebCore::LocalDOMWindow::addEventListener): Deleted.
(WebCore::LocalDOMWindow::deviceOrientationController const): Deleted.
(WebCore::LocalDOMWindow::deviceMotionController const): Deleted.
(WebCore::LocalDOMWindow::isAllowedToUseDeviceMotionOrOrientation const): Deleted.
(WebCore::LocalDOMWindow::isAllowedToUseDeviceMotion const): Deleted.
(WebCore::LocalDOMWindow::isAllowedToUseDeviceOrientation const): Deleted.
(WebCore::LocalDOMWindow::hasPermissionToReceiveDeviceMotionOrOrientationEvents const): Deleted.
(WebCore::LocalDOMWindow::startListeningForDeviceOrientationIfNecessary): Deleted.
(WebCore::LocalDOMWindow::stopListeningForDeviceOrientationIfNecessary): Deleted.
(WebCore::LocalDOMWindow::startListeningForDeviceMotionIfNecessary): Deleted.
(WebCore::LocalDOMWindow::stopListeningForDeviceMotionIfNecessary): Deleted.
(WebCore::LocalDOMWindow::failedToRegisterDeviceMotionEventListener): Deleted.
(WebCore::LocalDOMWindow::incrementScrollEventListenersCount): Deleted.
(WebCore::LocalDOMWindow::decrementScrollEventListenersCount): Deleted.
(WebCore::LocalDOMWindow::resetAllGeolocationPermission): Deleted.
(WebCore::LocalDOMWindow::removeEventListener): Deleted.
(WebCore::LocalDOMWindow::languagesChanged): Deleted.
(WebCore::LocalDOMWindow::dispatchLoadEvent): Deleted.
(WebCore::LocalDOMWindow::dispatchEvent): Deleted.
(WebCore::LocalDOMWindow::removeAllEventListeners): Deleted.
(WebCore::LocalDOMWindow::captureEvents): Deleted.
(WebCore::LocalDOMWindow::releaseEvents): Deleted.
(WebCore::LocalDOMWindow::finishedLoading): Deleted.
(WebCore::LocalDOMWindow::setLocation): Deleted.
(WebCore::LocalDOMWindow::printErrorMessage const): Deleted.
(WebCore::LocalDOMWindow::crossDomainAccessErrorMessage): Deleted.
(WebCore::LocalDOMWindow::isInsecureScriptAccess): Deleted.
(WebCore::LocalDOMWindow::createWindow): Deleted.
(WebCore::LocalDOMWindow::open): Deleted.
(WebCore::LocalDOMWindow::showModalDialog): Deleted.
(WebCore::LocalDOMWindow::enableSuddenTermination): Deleted.
(WebCore::LocalDOMWindow::disableSuddenTermination): Deleted.
(WebCore::LocalDOMWindow::frame const): Deleted.
(WebCore::LocalDOMWindow::protectedFrame const): Deleted.
(WebCore::LocalDOMWindow::eventListenersDidChange): Deleted.
(WebCore::LocalDOMWindow::cookieStore): Deleted.
* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::ruleMatches):
* Source/WebCore/style/PseudoElementIdentifier.h:
* Source/WebCore/style/PseudoElementRequest.h:
(WebCore::Style::PseudoElementRequest::PseudoElementRequest):
(WebCore::Style::PseudoElementRequest::nameArgument const):
(WebCore::Style::PseudoElementRequest::pseudoElementNameArgument const): Deleted.
* Source/WebCore/style/StyleResolver.cpp:
(WebCore::Style::Resolver::styleForPseudoElement):
* Source/WebCore/svg/SVGElement.cpp:
(WebCore::SVGElement::computedStyle):
* Source/WebCore/svg/SVGElement.h:
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::computedStyleIncludingVisitedInfo const):

Canonical link: https://commits.webkit.org/273934@main
  • Loading branch information
nt1m committed Feb 1, 2024
1 parent 839113f commit 741f7b1
Show file tree
Hide file tree
Showing 24 changed files with 150 additions and 97 deletions.
1 change: 1 addition & 0 deletions Source/WebCore/Headers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2449,6 +2449,7 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS
storage/StorageType.h
storage/StorageUtilities.h

style/PseudoElementIdentifier.h
style/ScopedName.h
style/StyleAppearance.h
style/StyleChange.h
Expand Down
5 changes: 3 additions & 2 deletions Source/WebCore/WebCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,6 @@
43E28B572ACB7C6F0033526B /* RenderSVGResourcePaintServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 43F48A552BAC7C6E0033527C /* RenderSVGResourcePaintServer.h */; };
43E632892AC43FB71174B113 /* RenderSVGResourceRadialGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 43E632872AC43FB71174B113 /* RenderSVGResourceRadialGradient.h */; };
43EDD67F1B485DBF00640E75 /* CombinedFiltersAlphabet.h in Headers */ = {isa = PBXBuildFile; fileRef = 43EDD67D1B485DBF00640E75 /* CombinedFiltersAlphabet.h */; settings = {ATTRIBUTES = (Private, ); }; };
43F532862CA34EC61174B113 /* RenderSVGResourceGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 43A633772CA43FB70065AD06 /* RenderSVGResourceGradient.h */; };
440615562AEAABD3009B8F9C /* LegacyRenderSVGResourceMarkerInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 440615552AEAABD2009B8F9C /* LegacyRenderSVGResourceMarkerInlines.h */; };
440615592AEAAC17009B8F9C /* LegacyRenderSVGResourceMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = 440615572AEAABE7009B8F9C /* LegacyRenderSVGResourceMarker.h */; };
4406155A2AEAAC1A009B8F9C /* LegacyRenderSVGResourceMasker.h in Headers */ = {isa = PBXBuildFile; fileRef = 440615582AEAABE7009B8F9C /* LegacyRenderSVGResourceMasker.h */; };
Expand Down Expand Up @@ -1767,7 +1766,7 @@
48B0242A2B2A65AA0083D122 /* AXTextRun.h in Headers */ = {isa = PBXBuildFile; fileRef = 48B024282B2A65AA0083D122 /* AXTextRun.h */; settings = {ATTRIBUTES = (Private, ); }; };
48B5BF3729CA691700FEBE3B /* AccessibilityRegionContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 48B5BF3529CA691700FEBE3B /* AccessibilityRegionContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
48D0E12929F7329E00263857 /* ElementAnimationContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 48D0E12829F7322900263857 /* ElementAnimationContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
490D51012B698A8300C6B266 /* PseudoElementIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 490D51002B698A8300C6B266 /* PseudoElementIdentifier.h */; };
490D51012B698A8300C6B266 /* PseudoElementIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 490D51002B698A8300C6B266 /* PseudoElementIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
491342E32B43FFEF00FEEF18 /* CSSSelectorInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 491342DA2B43FAA800FEEF18 /* CSSSelectorInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
491342E42B43FFEF00FEEF18 /* CSSSelectorEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 491342D92B43FAA700FEEF18 /* CSSSelectorEnums.h */; settings = {ATTRIBUTES = (Private, ); }; };
493E5E0912D6420500020081 /* PlatformCALayerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 493E5E0812D6420500020081 /* PlatformCALayerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand All @@ -1783,6 +1782,7 @@
4969B0F313D0B33F00DF3521 /* HitTestingTransformState.h in Headers */ = {isa = PBXBuildFile; fileRef = 4969B0F113D0B33F00DF3521 /* HitTestingTransformState.h */; };
4970AD822AE59BCE00AD3909 /* TransformOperationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 4970AD802AE59BCE00AD3909 /* TransformOperationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
4989734B2B663C6700720679 /* StyleScrollbarState.h in Headers */ = {isa = PBXBuildFile; fileRef = 4989734A2B663C6600720679 /* StyleScrollbarState.h */; };
499553402B6AD10C00268658 /* RenderSVGResourceGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B632872AC43FB71174B113 /* RenderSVGResourceGradient.h */; };
4996C0F627177488002C125D /* AVVideoCaptureSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 070363DF181A1CDC00C074A5 /* AVVideoCaptureSource.mm */; };
4998AEC613F9D0EA0090B1AA /* RequestAnimationFrameCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4998AEC413F9D0EA0090B1AA /* RequestAnimationFrameCallback.h */; };
4998AECE13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4998AECC13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.h */; };
Expand Down Expand Up @@ -41530,6 +41530,7 @@
448C95942AC4417700161D5A /* RenderSVGResourceClipperInlines.h in Headers */,
448C95942AC4417700161D5A /* RenderSVGResourceClipperInlines.h in Headers */,
44F48A682ABC7B6F0044526B /* RenderSVGResourceContainer.h in Headers */,
499553402B6AD10C00268658 /* RenderSVGResourceGradient.h in Headers */,
44E632892AC43FB71174B113 /* RenderSVGResourceLinearGradient.h in Headers */,
44355FDC2AF29A0C001ED218 /* RenderSVGResourceMarker.h in Headers */,
44355FDA2AF29A0C001ED218 /* RenderSVGResourceMarkerInlines.h in Headers */,
Expand Down
3 changes: 2 additions & 1 deletion Source/WebCore/animation/KeyframeEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,8 @@ auto KeyframeEffect::getKeyframes() -> Vector<ComputedKeyframe>
auto* lastStyleChangeEventStyle = targetStyleable()->lastStyleChangeEventStyle();
auto& elementStyle = lastStyleChangeEventStyle ? *lastStyleChangeEventStyle : currentStyle();

ComputedStyleExtractor computedStyleExtractor { target, false, m_pseudoId };
auto pseudoElementIdentifier = m_pseudoId == PseudoId::None ? std::nullopt : std::optional(Style::PseudoElementIdentifier { m_pseudoId });
ComputedStyleExtractor computedStyleExtractor { target, false, pseudoElementIdentifier };

BlendingKeyframes computedBlendingKeyframes(m_blendingKeyframes.animationName());
computedBlendingKeyframes.copyKeyframes(m_blendingKeyframes);
Expand Down
55 changes: 33 additions & 22 deletions Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,39 @@ namespace WebCore {

WTF_MAKE_ISO_ALLOCATED_IMPL(CSSComputedStyleDeclaration);

CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(Element& element, bool allowVisitedStyle)
CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(Element& element, AllowVisited allowVisited)
: m_element(element)
, m_allowVisitedStyle(allowVisitedStyle)
, m_allowVisitedStyle(allowVisited == AllowVisited::Yes)
{
}

CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(Element& element, std::optional<PseudoId> pseudoId)
CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(Element& element, IsEmpty isEmpty)
: m_element(element)
, m_pseudoElementSpecifier(pseudoId)
, m_isEmpty(isEmpty == IsEmpty::Yes)
{
}

CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(Element& element, const std::optional<Style::PseudoElementIdentifier>& pseudoElementIdentifier)
: m_element(element)
, m_pseudoElementIdentifier(pseudoElementIdentifier)
{
}

CSSComputedStyleDeclaration::~CSSComputedStyleDeclaration() = default;

Ref<CSSComputedStyleDeclaration> CSSComputedStyleDeclaration::create(Element& element, bool allowVisitedStyle)
Ref<CSSComputedStyleDeclaration> CSSComputedStyleDeclaration::create(Element& element, AllowVisited allowVisited)
{
return adoptRef(*new CSSComputedStyleDeclaration(element, allowVisited));
}

Ref<CSSComputedStyleDeclaration> CSSComputedStyleDeclaration::create(Element& element, const std::optional<Style::PseudoElementIdentifier>& pseudoElementIdentifier)
{
return adoptRef(*new CSSComputedStyleDeclaration(element, allowVisitedStyle));
return adoptRef(*new CSSComputedStyleDeclaration(element, pseudoElementIdentifier));
}

Ref<CSSComputedStyleDeclaration> CSSComputedStyleDeclaration::create(Element& element, std::optional<PseudoId> pseudoId)
Ref<CSSComputedStyleDeclaration> CSSComputedStyleDeclaration::createEmpty(Element& element)
{
return adoptRef(*new CSSComputedStyleDeclaration(element, pseudoId));
return adoptRef(*new CSSComputedStyleDeclaration(element, IsEmpty::Yes));
}

String CSSComputedStyleDeclaration::cssText() const
Expand All @@ -90,16 +101,16 @@ ExceptionOr<void> CSSComputedStyleDeclaration::setCssText(const String&)
// https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle#Notes
RefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, ComputedStyleExtractor::UpdateLayout updateLayout) const
{
if (!isExposed(propertyID, settings()) || !m_pseudoElementSpecifier)
if (!isExposed(propertyID, settings()) || m_isEmpty)
return nullptr;
return ComputedStyleExtractor(m_element.ptr(), m_allowVisitedStyle, *m_pseudoElementSpecifier).propertyValue(propertyID, updateLayout);
return ComputedStyleExtractor(m_element.ptr(), m_allowVisitedStyle, m_pseudoElementIdentifier).propertyValue(propertyID, updateLayout);
}

Ref<MutableStyleProperties> CSSComputedStyleDeclaration::copyProperties() const
{
if (!m_pseudoElementSpecifier)
if (m_isEmpty)
return MutableStyleProperties::create();
return ComputedStyleExtractor(m_element.ptr(), m_allowVisitedStyle, *m_pseudoElementSpecifier).copyProperties();
return ComputedStyleExtractor(m_element.ptr(), m_allowVisitedStyle, m_pseudoElementIdentifier).copyProperties();
}

const Settings* CSSComputedStyleDeclaration::settings() const
Expand All @@ -114,7 +125,7 @@ const FixedVector<CSSPropertyID>& CSSComputedStyleDeclaration::exposedComputedCS

String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) const
{
if (!m_pseudoElementSpecifier)
if (m_isEmpty)
return emptyString(); // FIXME: Should this be null instead, as it is in StyleProperties::getPropertyValue?

auto canUseShorthandSerializerForPropertyValue = [&]() {
Expand All @@ -129,7 +140,7 @@ String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) c
}
};
if (isShorthand(propertyID) && canUseShorthandSerializerForPropertyValue())
return serializeShorthandValue({ m_element.ptr(), m_allowVisitedStyle, *m_pseudoElementSpecifier }, propertyID);
return serializeShorthandValue({ m_element.ptr(), m_allowVisitedStyle, m_pseudoElementIdentifier }, propertyID);

auto value = getPropertyCSSValue(propertyID);
if (!value)
Expand All @@ -139,12 +150,12 @@ String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) c

unsigned CSSComputedStyleDeclaration::length() const
{
if (!m_pseudoElementSpecifier)
if (m_isEmpty)
return 0;

ComputedStyleExtractor::updateStyleIfNeededForProperty(m_element.get(), CSSPropertyCustom);

auto* style = m_element->computedStyle(*m_pseudoElementSpecifier);
auto* style = m_element->computedStyle(m_pseudoElementIdentifier);
if (!style)
return 0;

Expand All @@ -153,7 +164,7 @@ unsigned CSSComputedStyleDeclaration::length() const

String CSSComputedStyleDeclaration::item(unsigned i) const
{
if (!m_pseudoElementSpecifier)
if (m_isEmpty)
return String();

if (i >= length())
Expand All @@ -162,7 +173,7 @@ String CSSComputedStyleDeclaration::item(unsigned i) const
if (i < exposedComputedCSSPropertyIDs().size())
return nameString(exposedComputedCSSPropertyIDs().at(i));

auto* style = m_element->computedStyle(*m_pseudoElementSpecifier);
auto* style = m_element->computedStyle(m_pseudoElementIdentifier);
if (!style)
return String();

Expand Down Expand Up @@ -191,11 +202,11 @@ CSSRule* CSSComputedStyleDeclaration::cssRules() const

RefPtr<DeprecatedCSSOMValue> CSSComputedStyleDeclaration::getPropertyCSSValue(const String& propertyName)
{
if (!m_pseudoElementSpecifier)
if (m_isEmpty)
return nullptr;

if (isCustomPropertyName(propertyName)) {
auto value = ComputedStyleExtractor(m_element.ptr(), m_allowVisitedStyle, *m_pseudoElementSpecifier).customPropertyValue(AtomString { propertyName });
auto value = ComputedStyleExtractor(m_element.ptr(), m_allowVisitedStyle, m_pseudoElementIdentifier).customPropertyValue(AtomString { propertyName });
if (!value)
return nullptr;
return value->createDeprecatedCSSOMWrapper(*this);
Expand All @@ -212,11 +223,11 @@ RefPtr<DeprecatedCSSOMValue> CSSComputedStyleDeclaration::getPropertyCSSValue(co

String CSSComputedStyleDeclaration::getPropertyValue(const String &propertyName)
{
if (!m_pseudoElementSpecifier)
if (m_isEmpty)
return String();

if (isCustomPropertyName(propertyName))
return ComputedStyleExtractor(m_element.ptr(), m_allowVisitedStyle, *m_pseudoElementSpecifier).customPropertyText(AtomString { propertyName });
return ComputedStyleExtractor(m_element.ptr(), m_allowVisitedStyle, m_pseudoElementIdentifier).customPropertyText(AtomString { propertyName });

CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID)
Expand Down
17 changes: 12 additions & 5 deletions Source/WebCore/css/CSSComputedStyleDeclaration.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "CSSStyleDeclaration.h"
#include "ComputedStyleExtractor.h"
#include "PseudoElementIdentifier.h"
#include "RenderStyleConstants.h"
#include <wtf/FixedVector.h>
#include <wtf/IsoMalloc.h>
Expand All @@ -36,8 +37,11 @@ class MutableStyleProperties;
class CSSComputedStyleDeclaration final : public CSSStyleDeclaration, public RefCounted<CSSComputedStyleDeclaration> {
WTF_MAKE_ISO_ALLOCATED_EXPORT(CSSComputedStyleDeclaration, WEBCORE_EXPORT);
public:
WEBCORE_EXPORT static Ref<CSSComputedStyleDeclaration> create(Element&, bool allowVisitedStyle);
static Ref<CSSComputedStyleDeclaration> create(Element&, std::optional<PseudoId>);
enum class AllowVisited : bool { No, Yes };
WEBCORE_EXPORT static Ref<CSSComputedStyleDeclaration> create(Element&, AllowVisited);
static Ref<CSSComputedStyleDeclaration> create(Element&, const std::optional<Style::PseudoElementIdentifier>&);
static Ref<CSSComputedStyleDeclaration> createEmpty(Element&);

WEBCORE_EXPORT virtual ~CSSComputedStyleDeclaration();

void ref() final { RefCounted::ref(); }
Expand All @@ -46,8 +50,10 @@ class CSSComputedStyleDeclaration final : public CSSStyleDeclaration, public Ref
String getPropertyValue(CSSPropertyID) const;

private:
CSSComputedStyleDeclaration(Element&, bool allowVisitedStyle);
CSSComputedStyleDeclaration(Element&, std::optional<PseudoId>);
enum class IsEmpty : bool { No, Yes };
CSSComputedStyleDeclaration(Element&, AllowVisited);
CSSComputedStyleDeclaration(Element&, IsEmpty);
CSSComputedStyleDeclaration(Element&, const std::optional<Style::PseudoElementIdentifier>&);

// CSSOM functions. Don't make these public.
CSSRule* parentRule() const final;
Expand All @@ -73,7 +79,8 @@ class CSSComputedStyleDeclaration final : public CSSStyleDeclaration, public Ref
const FixedVector<CSSPropertyID>& exposedComputedCSSPropertyIDs() const;

mutable Ref<Element> m_element;
std::optional<PseudoId> m_pseudoElementSpecifier { PseudoId::None };
std::optional<Style::PseudoElementIdentifier> m_pseudoElementIdentifier { std::nullopt };
bool m_isEmpty { false };
bool m_allowVisitedStyle { false };
};

Expand Down
Loading

0 comments on commit 741f7b1

Please sign in to comment.