Bug 1639664 - Allow 'opacity' on ::first-letter/::first-line pseudos. r=emilio
authorMats Palmgren <mats@mozilla.com>
Thu, 21 May 2020 21:13:10 +0000
changeset 531531 b249a6de576d8dc9959cd65ac43bec227499f5c1
parent 531530 04a1388fc17d77914e3196c7616ec8f25754ef3a
child 531532 edddd94f6da24b685987ed9243c616adc7807586
push id37440
push userabutkovits@mozilla.com
push dateFri, 22 May 2020 09:43:16 +0000
treeherdermozilla-central@fbf71e4d2e21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1639664
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1639664 - Allow 'opacity' on ::first-letter/::first-line pseudos. r=emilio Differential Revision: https://phabricator.services.mozilla.com/D76387
layout/style/test/property_database.js
servo/components/style/properties/data.py
testing/web-platform/meta/css/css-pseudo/first-letter-allowed-properties.html.ini
testing/web-platform/tests/css/css-pseudo/first-letter-opacity-001-not-ref.html
testing/web-platform/tests/css/css-pseudo/first-letter-opacity-001-ref.html
testing/web-platform/tests/css/css-pseudo/first-letter-opacity-001.html
testing/web-platform/tests/css/css-pseudo/first-line-opacity-001-not-ref.html
testing/web-platform/tests/css/css-pseudo/first-line-opacity-001-ref.html
testing/web-platform/tests/css/css-pseudo/first-line-opacity-001.html
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -6749,16 +6749,18 @@ var gCSSProperties = {
       "left top 15px",
       "left 10px top",
     ],
   },
   opacity: {
     domProp: "opacity",
     inherited: false,
     type: CSS_TYPE_LONGHAND,
+    applies_to_first_letter: true,
+    applies_to_first_line: true,
     applies_to_placeholder: true,
     applies_to_cue: true,
     initial_values: [
       "1",
       "17",
       "397.376",
       "3e1",
       "3e+1",
--- a/servo/components/style/properties/data.py
+++ b/servo/components/style/properties/data.py
@@ -683,16 +683,17 @@ class PropertyRestrictions:
     def spec(data, spec_path):
         return [p.name for p in data.longhands if spec_path in p.spec]
 
     # https://drafts.csswg.org/css-pseudo/#first-letter-styling
     @staticmethod
     def first_letter(data):
         props = set([
             "color",
+            "opacity",
             "float",
             "initial-letter",
 
             # Kinda like css-fonts?
             "-moz-osx-font-smoothing",
 
             # Kinda like css-text?
             "-webkit-text-stroke-width",
@@ -717,16 +718,17 @@ class PropertyRestrictions:
         return props
 
     # https://drafts.csswg.org/css-pseudo/#first-line-styling
     @staticmethod
     def first_line(data):
         props = set([
             # Per spec.
             "color",
+            "opacity",
 
             # Kinda like css-fonts?
             "-moz-osx-font-smoothing",
 
             # Kinda like css-text?
             "-webkit-text-stroke-width",
             "-webkit-text-fill-color",
             "-webkit-text-stroke-color",
--- a/testing/web-platform/meta/css/css-pseudo/first-letter-allowed-properties.html.ini
+++ b/testing/web-platform/meta/css/css-pseudo/first-letter-allowed-properties.html.ini
@@ -13,19 +13,16 @@
 
   [fontVariationSettings should be applied to first-letter pseudo elements.]
     expected:
       if (processor == "x86") and (os == "win"): FAIL
 
   [margin should be applied to first-letter pseudo elements.]
     expected: FAIL
 
-  [opacity should be applied to first-letter pseudo elements.]
-    expected: FAIL
-
   [padding should be applied to first-letter pseudo elements.]
     expected: FAIL
 
   [font should be applied to first-letter pseudo elements.]
     expected: FAIL
 
   [borderRadius should be applied to first-letter pseudo elements.]
     expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-pseudo/first-letter-opacity-001-not-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Reference mismatch: ::first-letter supports opacity.</title>
+<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1639664">
+</head>
+<body>
+  <p>First</p>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-pseudo/first-letter-opacity-001-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Reference: ::first-letter supports opacity.</title>
+<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1639664">
+<link rel="mismatch" href="first-letter-opacity-001-not-ref.html">
+  <style>
+    fl {
+      opacity: 0;
+    }
+  </style>
+</head>
+<body>
+  <p><fl>F</fl>irst</p>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-pseudo/first-letter-opacity-001.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Test: ::first-letter supports opacity.</title>
+<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1639664">
+<link rel="match" href="first-letter-opacity-001-ref.html">
+<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-letter-styling">
+  <style>
+    p::first-letter {
+      opacity: 0;
+    }
+  </style>
+</head>
+<body>
+  <p>First</p>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-pseudo/first-line-opacity-001-not-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Reference mismatch: ::first-line supports opacity.</title>
+<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1639664">
+</head>
+<body>
+  <p>First<br>Second</p>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-pseudo/first-line-opacity-001-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Reference: ::first-line supports opacity.</title>
+<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1639664">
+<link rel="mismatch" href="first-line-opacity-001-not-ref.html">
+  <style>
+    fl {
+      opacity: 0;
+    }
+  </style>
+</head>
+<body>
+  <p><fl>First</fl><br>Second</p>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-pseudo/first-line-opacity-001.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Test: ::first-line supports opacity.</title>
+<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1639664">
+<link rel="match" href="first-line-opacity-001-ref.html">
+<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-line-styling">
+  <style>
+    p::first-line {
+      opacity: 0;
+    }
+  </style>
+</head>
+<body>
+  <p>First<br>Second</p>
+</body>
+</html>