Title: [293011] trunk/Source/WebCore
Revision
293011
Author
[email protected]
Date
2022-04-19 02:28:57 -0700 (Tue, 19 Apr 2022)

Log Message

Clean up Element::isFocusableWithoutResolvingFullStyle()
https://bugs.webkit.org/show_bug.cgi?id=239028

Reviewed by Antti Koivisto.

* dom/Element.cpp:
(WebCore::Element::isFocusableWithoutResolvingFullStyle const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293010 => 293011)


--- trunk/Source/WebCore/ChangeLog	2022-04-19 08:48:16 UTC (rev 293010)
+++ trunk/Source/WebCore/ChangeLog	2022-04-19 09:28:57 UTC (rev 293011)
@@ -1,3 +1,13 @@
+2022-04-19  Tim Nguyen  <[email protected]>
+
+        Clean up Element::isFocusableWithoutResolvingFullStyle()
+        https://bugs.webkit.org/show_bug.cgi?id=239028
+
+        Reviewed by Antti Koivisto.
+
+        * dom/Element.cpp:
+        (WebCore::Element::isFocusableWithoutResolvingFullStyle const):
+
 2022-04-18  Zan Dobersek  <[email protected]>
 
         Remove the PlatformMediaEngineClassName macro

Modified: trunk/Source/WebCore/dom/Element.cpp (293010 => 293011)


--- trunk/Source/WebCore/dom/Element.cpp	2022-04-19 08:48:16 UTC (rev 293010)
+++ trunk/Source/WebCore/dom/Element.cpp	2022-04-19 09:28:57 UTC (rev 293011)
@@ -3557,8 +3557,16 @@
 
 bool Element::isFocusableWithoutResolvingFullStyle() const
 {
+    auto isFocusableStyle = [](const RenderStyle* style) {
+        return style
+            && style->display() != DisplayType::None
+            && style->display() != DisplayType::Contents
+            && style->visibility() == Visibility::Visible
+            && !style->effectiveInert();
+    };
+
     if (renderStyle() || hasValidStyle())
-        return renderStyle() && renderStyle()->visibility() == Visibility::Visible && !renderStyle()->effectiveInert();
+        return isFocusableStyle(renderStyle());
 
     auto computedStyleForElement = [](Element& element) -> const RenderStyle* {
         auto* style = element.hasNodeFlag(NodeFlag::IsComputedStyleInvalidFlag) ? nullptr : element.existingComputedStyle();
@@ -3567,15 +3575,9 @@
 
     // Compute style in yet unstyled subtree.
     auto* style = computedStyleForElement(const_cast<Element&>(*this));
-    if (!style)
+    if (!isFocusableStyle(style))
         return false;
 
-    if (style->display() == DisplayType::None || style->display() == DisplayType::Contents)
-        return false;
-
-    if (style->visibility() != Visibility::Visible || style->effectiveInert())
-        return false;
-
     for (auto& element : composedTreeAncestors(const_cast<Element&>(*this))) {
         auto* style = computedStyleForElement(element);
         if (!style || style->display() == DisplayType::None)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to