From a86f7802c4d5b94a234ff1ef01857919e4096712 Mon Sep 17 00:00:00 2001 From: Xianzhu Wang Date: Fri, 19 Jul 2019 18:18:34 +0000 Subject: [PATCH] Bug 1564673 [wpt PR 17561] - Fix first line style caching issues, a=testonly Automatic update from web-platform-tests Fix first line style caching issues 1. Cache conflict issue: Previously calls to Element:: Element::CachedStyleForPseudoElement() with different second parameters caused cache conflict. The second call to it might get unwanted result that was cached with a different second parameter. Now remove the second parameter, and the function gets and caches the pseudo style only based on its own computed style. If a caller wants a pseudo style based on another style, the caller should call Element::UncachedStyleForPseudoElement() and manage cache by itself. 2. Under-invalidation on change Cached first line style needs invalidation in two cases: a) when the ::first-line style changes, we should invalidate all cached first line styles affected. b) when style of an inline element (which inherits ::first-line style) changes, as the inline element's style has higher priority than the inherited ::first-line style, even if the style doesn't change, we need to invalidate the cached kPseudoIdFirstLineInherited style if the new style is different from the inherited ::first-line style. Bug: 979054 Change-Id: Icffe68d5136349d12cce6e92d1d3bf153c28903a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1678878 Reviewed-by: Rune Lillesveen Commit-Queue: Xianzhu Wang Cr-Commit-Position: refs/heads/master@{#673574} -- wpt-commits: c0a3e93389bdcc9e8ad12d3988e4568d48b78c9d wpt-pr: 17561 --- ...t-line-change-inline-color-nested-ref.html | 2 ++ ...first-line-change-inline-color-nested.html | 23 +++++++++++++++++++ .../first-line-change-inline-color-ref.html | 2 ++ .../first-line-change-inline-color.html | 23 +++++++++++++++++++ .../first-line-on-ancestor-block-ref.html | 5 ++++ .../first-line-on-ancestor-block.html | 16 +++++++++++++ .../first-line-with-out-of-flow-ref.html | 5 ++++ .../first-line-with-out-of-flow.html | 20 ++++++++++++++++ 8 files changed, 96 insertions(+) create mode 100644 testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color-nested-ref.html create mode 100644 testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color-nested.html create mode 100644 testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color-ref.html create mode 100644 testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color.html create mode 100644 testing/web-platform/tests/css/css-pseudo/first-line-on-ancestor-block-ref.html create mode 100644 testing/web-platform/tests/css/css-pseudo/first-line-on-ancestor-block.html create mode 100644 testing/web-platform/tests/css/css-pseudo/first-line-with-out-of-flow-ref.html create mode 100644 testing/web-platform/tests/css/css-pseudo/first-line-with-out-of-flow.html diff --git a/testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color-nested-ref.html b/testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color-nested-ref.html new file mode 100644 index 000000000000..84becd9a78d1 --- /dev/null +++ b/testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color-nested-ref.html @@ -0,0 +1,2 @@ + +

Blue This text should be green. Blue

diff --git a/testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color-nested.html b/testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color-nested.html new file mode 100644 index 000000000000..4a58f1ea5b62 --- /dev/null +++ b/testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color-nested.html @@ -0,0 +1,23 @@ + + + + + +
+
+

Blue This text should be green. Blue

+
+
+ + diff --git a/testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color-ref.html b/testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color-ref.html new file mode 100644 index 000000000000..84becd9a78d1 --- /dev/null +++ b/testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color-ref.html @@ -0,0 +1,2 @@ + +

Blue This text should be green. Blue

diff --git a/testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color.html b/testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color.html new file mode 100644 index 000000000000..2a5be916b01d --- /dev/null +++ b/testing/web-platform/tests/css/css-pseudo/first-line-change-inline-color.html @@ -0,0 +1,23 @@ + + + + + +
+
+

Blue This text should be green. Blue

+
+
+ + diff --git a/testing/web-platform/tests/css/css-pseudo/first-line-on-ancestor-block-ref.html b/testing/web-platform/tests/css/css-pseudo/first-line-on-ancestor-block-ref.html new file mode 100644 index 000000000000..7193bf25eb88 --- /dev/null +++ b/testing/web-platform/tests/css/css-pseudo/first-line-on-ancestor-block-ref.html @@ -0,0 +1,5 @@ + +
+ This text should be green.
+ This text should be blue. +
diff --git a/testing/web-platform/tests/css/css-pseudo/first-line-on-ancestor-block.html b/testing/web-platform/tests/css/css-pseudo/first-line-on-ancestor-block.html new file mode 100644 index 000000000000..6b797107df80 --- /dev/null +++ b/testing/web-platform/tests/css/css-pseudo/first-line-on-ancestor-block.html @@ -0,0 +1,16 @@ + + + + +
+
+
+
+ This text should be green.
+ This text should be blue. +
+
+
+
diff --git a/testing/web-platform/tests/css/css-pseudo/first-line-with-out-of-flow-ref.html b/testing/web-platform/tests/css/css-pseudo/first-line-with-out-of-flow-ref.html new file mode 100644 index 000000000000..7193bf25eb88 --- /dev/null +++ b/testing/web-platform/tests/css/css-pseudo/first-line-with-out-of-flow-ref.html @@ -0,0 +1,5 @@ + +
+ This text should be green.
+ This text should be blue. +
diff --git a/testing/web-platform/tests/css/css-pseudo/first-line-with-out-of-flow.html b/testing/web-platform/tests/css/css-pseudo/first-line-with-out-of-flow.html new file mode 100644 index 000000000000..798ecf8264e2 --- /dev/null +++ b/testing/web-platform/tests/css/css-pseudo/first-line-with-out-of-flow.html @@ -0,0 +1,20 @@ + + + + +
+

+

+
+

+

+
+
+ This text should be green.
+ This text should be blue. +
+
+
+