Bug 1484967 [wpt PR 12588] - Don't do whitespace re-attachment for ::first-letter., a=testonly
authorRune Lillesveen <futhark@chromium.org>
Fri, 24 Aug 2018 12:55:18 +0000
changeset 482095 19f6b50906ea0f6c8e5a279d65491a647edd1a67
parent 482094 6754584c2bd7a64c1148119050a52d5a52360619
child 482096 a0efed7d5de39bc4861d9e6fdf7a22be75391d99
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewerstestonly
bugs1484967, 12588, 876150, 1183231, 584866
milestone63.0a1
Bug 1484967 [wpt PR 12588] - Don't do whitespace re-attachment for ::first-letter., a=testonly Automatic update from web-platform-testsDon't do whitespace re-attachment for ::first-letter. If we have a white-space node before the text node with the first letter, we would try to re-attach the white-space node with an incorrect previous in-flow LayoutObject because we attach the ::first-letter after all children have been attached, not where the ::first-letter would end up in the layout tree. We don't need to re-attach whitespace after ::first-letter because: * We always create a remaining LayoutTextFragment for the text node which contains the first formatted letter. Wether the remaining text consists of white-space or is even empty. * If the LayoutObject sibling following first-letter+remaining-text consists of white-space, it would have gotten a LayoutObject when attaching the LayoutText for the text node where the first-letter comes from. That is, we will always have a LayoutObject for a white-space LayoutText sibling of a first-letter LayoutObject. Split out a separate method for ::first-letter for less complexity and cost with which WhitespaceAttacher to use. Bug: 876150 Change-Id: Ib1f34f0ba596d5fa5f1c7fcbd7c75550dd4f9d12 Reviewed-on: https://chromium-review.googlesource.com/1183231 Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Cr-Commit-Position: refs/heads/master@{#584866} -- wpt-commits: 05f0eb425c0283275fae1fc8f2af437ecf7bf49b wpt-pr: 12588
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/css/css-pseudo/first-letter-and-whitespace-ref.html
testing/web-platform/tests/css/css-pseudo/first-letter-and-whitespace.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -128362,16 +128362,28 @@
       [
        "/css/css-pseudo/first-letter-block-to-inline-ref.html",
        "=="
       ]
      ],
      {}
     ]
    ],
+   "css/css-pseudo/first-letter-and-whitespace.html": [
+    [
+     "/css/css-pseudo/first-letter-and-whitespace.html",
+     [
+      [
+       "/css/css-pseudo/first-letter-and-whitespace-ref.html",
+       "=="
+      ]
+     ],
+     {}
+    ]
+   ],
    "css/css-pseudo/first-letter-block-to-inline.html": [
     [
      "/css/css-pseudo/first-letter-block-to-inline.html",
      [
       [
        "/css/css-pseudo/first-letter-block-to-inline-ref.html",
        "=="
       ]
@@ -256309,16 +256321,21 @@
      {}
     ]
    ],
    "css/css-pseudo/first-letter-004-ref.html": [
     [
      {}
     ]
    ],
+   "css/css-pseudo/first-letter-and-whitespace-ref.html": [
+    [
+     {}
+    ]
+   ],
    "css/css-pseudo/first-letter-block-to-inline-ref.html": [
     [
      {}
     ]
    ],
    "css/css-pseudo/first-letter-opacity-float-001-ref.html": [
     [
      {}
@@ -540548,16 +540565,24 @@
   "css/css-pseudo/first-letter-004.html": [
    "9079126d3a6f7e1f70e4f5004450fa50b40862fd",
    "reftest"
   ],
   "css/css-pseudo/first-letter-and-sibling-display-change.html": [
    "29bdc5bbbe8ed4c1f4082dabbd7116325ed6e933",
    "reftest"
   ],
+  "css/css-pseudo/first-letter-and-whitespace-ref.html": [
+   "d193306fe45064d281bd22e87ed50e6e1988db71",
+   "support"
+  ],
+  "css/css-pseudo/first-letter-and-whitespace.html": [
+   "a10612ac9731a7ecdf07416df23e802c131b7570",
+   "reftest"
+  ],
   "css/css-pseudo/first-letter-block-to-inline-ref.html": [
    "5c777f1a92e373042ffbfeb5604cc665013663f7",
    "support"
   ],
   "css/css-pseudo/first-letter-block-to-inline.html": [
    "94f27e6a6665ab1024e1c6367c46a6976a4eec24",
    "reftest"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-pseudo/first-letter-and-whitespace-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Reference File</title>
+<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org">
+<p>Pass if no space between "A", space between "B".</p>
+<div><span style="float:left">A</span>A</div>
+<div><span style="float:left">A</span>A</div>
+<div>B B</div>
+<div>B B</div>
+<div>AAB B</div>
+<div>AAB B</div>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-pseudo/first-letter-and-whitespace.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Test: White-spaces around floated ::first-letter</title>
+<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org">
+<link rel="match" href="first-letter-and-whitespace-ref.html">
+<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-letter-styling">
+<meta name="assert" content="Test checks that white-spaces are correctly rendered for floated ::first-letter changes">
+<style>
+  div::first-letter {
+    color: black;
+  }
+  .floatLetter::first-letter {
+    float: left;
+  }
+</style>
+<p>Pass if no space between "A", space between "B".</p>
+<div id="t1"> <!---->AA</div>
+<div id="t2"> <!---->A<!----> <!---->A</div>
+<div id="t3" class="floatLetter">  <!---->B<!----> <!---->B</div>
+<div id="t4" class="floatLetter">  <!---->B <!---->B</div>
+<div id="t5" class="floatLetter">  <!---->AAB<!----> <!---->B</div>
+<div id="t6" class="floatLetter">  <!---->AAB<!----> B</div>
+<script>
+  document.body.offsetTop;
+  t1.className = "floatLetter";
+  t2.className = "floatLetter";
+  t3.className = "";
+  t4.className = "";
+  t5.className = "";
+  t6.className = "";
+</script>