Title: [290559] trunk
- Revision
- 290559
- Author
- [email protected]
- Date
- 2022-02-27 06:10:58 -0800 (Sun, 27 Feb 2022)
Log Message
Optimize StyleSharingResolver inert checks
https://bugs.webkit.org/show_bug.cgi?id=237235
Reviewed by Youenn Fablet.
Source/WebCore:
inert is an boolean attribute, the only thing that matters for the StyleAdjuster
inertness adjustment is the presence of the attribute, not its value. E.g.
`inert=false` is the same as `inert=inert` or `inert=true`.
This saves getting and comparing values for those attributes, and also allows
`inert=inert` and `inert=true` or `inert=false` to start sharing style.
* style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::canShareStyleWithElement const):
LayoutTests:
Add small test that style sharing is not wrongly applied.
* fast/css/inert-style-sharing-expected.html: Added.
* fast/css/inert-style-sharing.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (290558 => 290559)
--- trunk/LayoutTests/ChangeLog 2022-02-27 12:06:16 UTC (rev 290558)
+++ trunk/LayoutTests/ChangeLog 2022-02-27 14:10:58 UTC (rev 290559)
@@ -1,5 +1,17 @@
2022-02-27 Tim Nguyen <[email protected]>
+ Optimize StyleSharingResolver inert checks
+ https://bugs.webkit.org/show_bug.cgi?id=237235
+
+ Reviewed by Youenn Fablet.
+
+ Add small test that style sharing is not wrongly applied.
+
+ * fast/css/inert-style-sharing-expected.html: Added.
+ * fast/css/inert-style-sharing.html: Added.
+
+2022-02-27 Tim Nguyen <[email protected]>
+
Re-import inert and <dialog> WPT
https://bugs.webkit.org/show_bug.cgi?id=237243
Added: trunk/LayoutTests/fast/css/inert-style-sharing-expected.html (0 => 290559)
--- trunk/LayoutTests/fast/css/inert-style-sharing-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css/inert-style-sharing-expected.html 2022-02-27 14:10:58 UTC (rev 290559)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<div>node</div>
+<div>inert node</div>
+<div>inert node</div>
+<div>inert node</div>
+<div style="background: blue">inert node</div>
+
+<div id="result">node</div>
Added: trunk/LayoutTests/fast/css/inert-style-sharing.html (0 => 290559)
--- trunk/LayoutTests/fast/css/inert-style-sharing.html (rev 0)
+++ trunk/LayoutTests/fast/css/inert-style-sharing.html 2022-02-27 14:10:58 UTC (rev 290559)
@@ -0,0 +1,21 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ InertAttributeEnabled=true ] -->
+<div>node</div>
+<div inert>inert node</div>
+<div inert>inert node</div>
+<div inert>inert node</div>
+<div inert="foo">inert node</div>
+
+<div id="result"></div>
+
+<style>
+div[inert="foo"] {
+ background: blue;
+}
+</style>
+
+<script>
+// Test that inertness is properly applied, by checking only the non-inert node is selected
+document.execCommand('SelectAll');
+result.textContent = window.getSelection().toString().trim();
+window.getSelection().removeAllRanges();
+</script>
Modified: trunk/Source/WebCore/ChangeLog (290558 => 290559)
--- trunk/Source/WebCore/ChangeLog 2022-02-27 12:06:16 UTC (rev 290558)
+++ trunk/Source/WebCore/ChangeLog 2022-02-27 14:10:58 UTC (rev 290559)
@@ -1,3 +1,20 @@
+2022-02-27 Tim Nguyen <[email protected]>
+
+ Optimize StyleSharingResolver inert checks
+ https://bugs.webkit.org/show_bug.cgi?id=237235
+
+ Reviewed by Youenn Fablet.
+
+ inert is an boolean attribute, the only thing that matters for the StyleAdjuster
+ inertness adjustment is the presence of the attribute, not its value. E.g.
+ `inert=false` is the same as `inert=inert` or `inert=true`.
+
+ This saves getting and comparing values for those attributes, and also allows
+ `inert=inert` and `inert=true` or `inert=false` to start sharing style.
+
+ * style/StyleSharingResolver.cpp:
+ (WebCore::Style::SharingResolver::canShareStyleWithElement const):
+
2022-02-27 Youenn Fablet <[email protected]>
Simplify CVPixelBuffer data copies in SharedVideoFrameInfo
Modified: trunk/Source/WebCore/style/StyleSharingResolver.cpp (290558 => 290559)
--- trunk/Source/WebCore/style/StyleSharingResolver.cpp 2022-02-27 12:06:16 UTC (rev 290558)
+++ trunk/Source/WebCore/style/StyleSharingResolver.cpp 2022-02-27 14:10:58 UTC (rev 290559)
@@ -281,10 +281,9 @@
return false;
if (candidateElement.elementData() != element.elementData()) {
+ // Attributes that are optimized as "common attribute selectors".
if (candidateElement.attributeWithoutSynchronization(HTMLNames::readonlyAttr) != element.attributeWithoutSynchronization(HTMLNames::readonlyAttr))
return false;
- if (m_document.settings().inertAttributeEnabled() && candidateElement.attributeWithoutSynchronization(HTMLNames::inertAttr) != element.attributeWithoutSynchronization(HTMLNames::inertAttr))
- return false;
if (candidateElement.isSVGElement()) {
if (candidateElement.getAttribute(HTMLNames::typeAttr) != element.getAttribute(HTMLNames::typeAttr))
return false;
@@ -292,6 +291,10 @@
if (candidateElement.attributeWithoutSynchronization(HTMLNames::typeAttr) != element.attributeWithoutSynchronization(HTMLNames::typeAttr))
return false;
}
+
+ // Elements that may get StyleAdjuster's inert attribute adjustment.
+ if (m_document.settings().inertAttributeEnabled() && candidateElement.hasAttributeWithoutSynchronization(HTMLNames::inertAttr) != element.hasAttributeWithoutSynchronization(HTMLNames::inertAttr))
+ return false;
}
if (candidateElement.matchesValidPseudoClass() != element.matchesValidPseudoClass())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes