WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch and layout tests (without compile-time guard)
Bug141477_NoCompileGuard_1.patch (text/plain), 29.18 KB, created by
Daniel Bates
on 2017-07-31 14:05:39 PDT
(
hide
)
Description:
Patch and layout tests (without compile-time guard)
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2017-07-31 14:05:39 PDT
Size:
29.18 KB
patch
obsolete
>From ec6bea34813a44ec52b0c7c1019e3e8246f06b45 Mon Sep 17 00:00:00 2001 >From: Daniel Bates <dabates@apple.com> >Date: Mon, 31 Jul 2017 09:39:32 -0700 >Subject: [PATCH] Support ::marker pseudo-element > https://bugs.webkit.org/show_bug.cgi?id=141477 > >Reviewed by NOBODY (OOPS!). > >Source/WebCore: > >Implements the ::marker pseudo element as per the CSS Pseudo-Element Module Level 4 >spec., <https://drafts.csswg.org/css-pseudo-4> (Editor's Draft, 24 July 2017). > >The ::marker pseudo element is a convenience pseudo element that allows a person to >style the appearance of a list item marker. For example, to render all list item >markers in bolded, blue text you would define a stylesheet with the following content: > >li::marker { > color: blue; > font-weight: bold; >} > >and this could be applied to a page that contains markup of the form: > ><ol> > <li>Item 1</li> > <li>Item 2</li> > ... > <li>Item N-1</li> > <li>Item N</li> ></ol> > >Formerly to the achieve the same effect you would need to use a stylesheet of the form: > >li { > color: blue; > font-weight: bold; >} > >.list-item-content { > all: initial; >} > >and then write your markup to have the form: > ><ol> > <li><span class="list-item-content">Item 1</span></li> > <li><span class="list-item-content">Item 2</span></li> > ... > <li><span class="list-item-content">Item N-1</span></li> > <li><span class="list-item-content">Item N</span></li> ></ol> > >The ::marker pseudo element only supports stylizing all font properties and the color property >of a list item marker. > >Tests: fast/lists/list-marker-with-display.html > http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements.html > http/wpt/css/css-pseudo-4/marker-color.html > http/wpt/css/css-pseudo-4/marker-font-properties.html > http/wpt/css/css-pseudo-4/marker-inherit-values.html > >* css/CSSSelector.cpp: >(WebCore::CSSSelector::pseudoId): Return the pseudo id for the ::marker pseudo element. >* css/CSSSelector.h: Add enumerator PseudoElementMarker to the pseudo element enum. >* css/RuleSet.cpp: >(WebCore::determinePropertyWhitelistType): Return whitelist type PropertyWhitelistMarker for ::marker >so that we match rules against the acceptable rules for ::marker. >* css/RuleSet.h: Add enumerator PropertyWhitelistMarker to the property whitelist type enum. >* css/SelectorPseudoElementTypeMap.in: Add "marker" to the list of pseudo element types. >* css/StyleResolver.cpp: >(WebCore::isValidMarkerStyleProperty): Determines if the specified CSS property is valid inside ::marker. >(WebCore::StyleResolver::CascadedProperties::addMatch): Only recognize CSS properties in the content block >of ::marker that match the ::marker whitelist policy. >* rendering/RenderListItem.cpp: >(WebCore::RenderListItem::computeMarkerStyle): Computes the style object for the list item marker. We >apply the user-agent style to the marker here as opposed to defining ::marker in the UA sheet as per >the spec. as an optimization to avoid having the style resolver apply the pseudo element to all elements. >For now, we always inherit style from the originating element (list item). Added FIXME to selectively >inherit styles. >(WebCore::RenderListItem::styleDidChange): Always apply the list marker style to the list marker renderer. >* rendering/RenderListItem.h: >* rendering/style/RenderStyleConstants.h: Add pseudo ID for the ::marker pseudo element. > >LayoutTests: > >Add tests that check we respect ::marker when rendering the list item marker. I will >submit all the tests in http/wpt/css/css-pseudo-4 to the Web Platform Tests repository >shortly and then import them into the WebKit repository in a subsequent commit. > >* fast/lists/list-marker-with-display-expected.html: Added. >* fast/lists/list-marker-with-display.html: Added. >* http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements-expected.html: Added. >* http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements.html: Added. >* http/wpt/css/css-pseudo-4/marker-color-expected.html: Added. >* http/wpt/css/css-pseudo-4/marker-color.html: Added. >* http/wpt/css/css-pseudo-4/marker-font-properties-expected.html: Added. >* http/wpt/css/css-pseudo-4/marker-font-properties.html: Added. >* http/wpt/css/css-pseudo-4/marker-inherit-values-expected.html: Added. >* http/wpt/css/css-pseudo-4/marker-inherit-values.html: Added. >--- > LayoutTests/ChangeLog | 22 ++++++ > .../lists/list-marker-with-display-expected.html | 16 +++++ > .../fast/lists/list-marker-with-display.html | 20 ++++++ > .../marker-and-other-pseudo-elements-expected.html | 24 +++++++ > .../marker-and-other-pseudo-elements.html | 41 +++++++++++ > .../css/css-pseudo-4/marker-color-expected.html | 20 ++++++ > .../http/wpt/css/css-pseudo-4/marker-color.html | 27 ++++++++ > .../marker-font-properties-expected.html | 24 +++++++ > .../css/css-pseudo-4/marker-font-properties.html | 29 ++++++++ > .../marker-inherit-values-expected.html | 24 +++++++ > .../css/css-pseudo-4/marker-inherit-values.html | 40 +++++++++++ > Source/WebCore/ChangeLog | 81 ++++++++++++++++++++++ > Source/WebCore/css/CSSSelector.cpp | 2 + > Source/WebCore/css/CSSSelector.h | 1 + > Source/WebCore/css/RuleSet.cpp | 8 +-- > Source/WebCore/css/RuleSet.h | 1 + > Source/WebCore/css/SelectorPseudoElementTypeMap.in | 1 + > Source/WebCore/css/StyleResolver.cpp | 31 +++++++++ > Source/WebCore/rendering/RenderListItem.cpp | 37 +++++++--- > Source/WebCore/rendering/RenderListItem.h | 2 + > .../WebCore/rendering/style/RenderStyleConstants.h | 2 +- > 21 files changed, 439 insertions(+), 14 deletions(-) > create mode 100644 LayoutTests/fast/lists/list-marker-with-display-expected.html > create mode 100644 LayoutTests/fast/lists/list-marker-with-display.html > create mode 100644 LayoutTests/http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements-expected.html > create mode 100644 LayoutTests/http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements.html > create mode 100644 LayoutTests/http/wpt/css/css-pseudo-4/marker-color-expected.html > create mode 100644 LayoutTests/http/wpt/css/css-pseudo-4/marker-color.html > create mode 100644 LayoutTests/http/wpt/css/css-pseudo-4/marker-font-properties-expected.html > create mode 100644 LayoutTests/http/wpt/css/css-pseudo-4/marker-font-properties.html > create mode 100644 LayoutTests/http/wpt/css/css-pseudo-4/marker-inherit-values-expected.html > create mode 100644 LayoutTests/http/wpt/css/css-pseudo-4/marker-inherit-values.html > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 5d4ee2c00d0..99aa16e51bc 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,25 @@ >+2017-07-31 Daniel Bates <dabates@apple.com> >+ >+ Support ::marker pseudo-element >+ https://bugs.webkit.org/show_bug.cgi?id=141477 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add tests that check we respect ::marker when rendering the list item marker. I will >+ submit all the tests in http/wpt/css/css-pseudo-4 to the Web Platform Tests repository >+ shortly and then import them into the WebKit repository in a subsequent commit. >+ >+ * fast/lists/list-marker-with-display-expected.html: Added. >+ * fast/lists/list-marker-with-display.html: Added. >+ * http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements-expected.html: Added. >+ * http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements.html: Added. >+ * http/wpt/css/css-pseudo-4/marker-color-expected.html: Added. >+ * http/wpt/css/css-pseudo-4/marker-color.html: Added. >+ * http/wpt/css/css-pseudo-4/marker-font-properties-expected.html: Added. >+ * http/wpt/css/css-pseudo-4/marker-font-properties.html: Added. >+ * http/wpt/css/css-pseudo-4/marker-inherit-values-expected.html: Added. >+ * http/wpt/css/css-pseudo-4/marker-inherit-values.html: Added. >+ > 2017-07-31 Yusuke Suzuki <utatane.tea@gmail.com> > > [JSC] Support optional catch binding >diff --git a/LayoutTests/fast/lists/list-marker-with-display-expected.html b/LayoutTests/fast/lists/list-marker-with-display-expected.html >new file mode 100644 >index 00000000000..0494ddb9ec3 >--- /dev/null >+++ b/LayoutTests/fast/lists/list-marker-with-display-expected.html >@@ -0,0 +1,16 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<style> >+div { >+ color: green; >+ display: list-item; >+ left: 40px; >+ position: absolute; >+} >+</style> >+</head> >+<body> >+<div>PASS</div> >+</body> >+</html> >diff --git a/LayoutTests/fast/lists/list-marker-with-display.html b/LayoutTests/fast/lists/list-marker-with-display.html >new file mode 100644 >index 00000000000..fd509f06853 >--- /dev/null >+++ b/LayoutTests/fast/lists/list-marker-with-display.html >@@ -0,0 +1,20 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<style> >+div { >+ color: green; >+ display: list-item; >+ left: 40px; >+ position: absolute; >+} >+ >+div::marker { >+ display: list-item; /* Should be ignored. */ >+} >+</style> >+</head> >+<body> >+<div>PASS</div> >+</body> >+</html> >diff --git a/LayoutTests/http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements-expected.html b/LayoutTests/http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements-expected.html >new file mode 100644 >index 00000000000..796acbf7598 >--- /dev/null >+++ b/LayoutTests/http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements-expected.html >@@ -0,0 +1,24 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta charset="utf-8"> >+<title>CSS Test: ::marker interaction with ::before, ::after, and ::first-letter pseudo elements reference file</title> >+<link rel="author" title="Daniel Bates" href="mailto:dbates@webkit.org"> >+<style> >+li { >+ color: green; >+ font-size: 20px; >+} >+ >+.first-letter { >+ color: white; >+ background-color: green; >+} >+</style> >+</head> >+<body> >+<ol> >+ <li><span class="first-letter">P</span>ASSED if the list marker is green.</li> >+</ol> >+</body> >+</html> >diff --git a/LayoutTests/http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements.html b/LayoutTests/http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements.html >new file mode 100644 >index 00000000000..3607ea418c5 >--- /dev/null >+++ b/LayoutTests/http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements.html >@@ -0,0 +1,41 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta charset="utf-8"> >+<title>CSS Test: ::marker interaction with ::before, ::after, and ::first-letter pseudo elements</title> >+<link rel="author" title="Daniel Bates" href="mailto:dbates@webkit.org"> >+<link ref="match" href="marker-and-other-pseudo-elements-expected.html"> >+<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#marker-pseudo"> >+<meta name="assert" content="Tests ::marker interaction with ::before, ::after, and ::first-letter pseudo elements"> >+<style> >+li { >+ color: red; >+ font-size: 20px; >+} >+ >+li::before { >+ color: green; >+ content: "PA"; >+} >+ >+li::after { >+ color: green; >+ content: "SSED if the list marker is green."; >+} >+ >+li::marker { >+ color: green; >+} >+ >+li::first-letter { >+ color: white; >+ background-color: green; >+} >+</style> >+</head> >+<body> >+<ol> >+ <li></li> >+</ol> >+</body> >+</html> >diff --git a/LayoutTests/http/wpt/css/css-pseudo-4/marker-color-expected.html b/LayoutTests/http/wpt/css/css-pseudo-4/marker-color-expected.html >new file mode 100644 >index 00000000000..f2269f7f78b >--- /dev/null >+++ b/LayoutTests/http/wpt/css/css-pseudo-4/marker-color-expected.html >@@ -0,0 +1,20 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta charset="utf-8"> >+<title>CSS Test: ::marker formatting with color property reference file</title> >+<link rel="author" title="Daniel Bates" href="mailto:dbates@webkit.org"> >+<style> >+li { >+ color: green; >+ font-size: 40px; >+ list-style-type: square; >+} >+</style> >+</head> >+<body> >+<ol> >+ <li><!-- The list marker should be a green square.--></li> >+</ol> >+</body> >+</html> >diff --git a/LayoutTests/http/wpt/css/css-pseudo-4/marker-color.html b/LayoutTests/http/wpt/css/css-pseudo-4/marker-color.html >new file mode 100644 >index 00000000000..d1bd5df8240 >--- /dev/null >+++ b/LayoutTests/http/wpt/css/css-pseudo-4/marker-color.html >@@ -0,0 +1,27 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta charset="utf-8"> >+<title>CSS Test: ::marker formatting with color property</title> >+<link rel="author" title="Daniel Bates" href="mailto:dbates@webkit.org"> >+<link ref="match" href="marker-color-expected.html"> >+<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#marker-pseudo"> >+<meta name="assert" content="Tests ::marker rendering with color property"> >+<style> >+li { >+ color: red; >+ font-size: 40px; >+ list-style-type: square; >+} >+ >+li::marker { >+ color: green; >+} >+</style> >+</head> >+<body> >+<ol> >+ <li><!-- The list marker should be a green square.--></li> >+</ol> >+</body> >+</html> >diff --git a/LayoutTests/http/wpt/css/css-pseudo-4/marker-font-properties-expected.html b/LayoutTests/http/wpt/css/css-pseudo-4/marker-font-properties-expected.html >new file mode 100644 >index 00000000000..093674d81b2 >--- /dev/null >+++ b/LayoutTests/http/wpt/css/css-pseudo-4/marker-font-properties-expected.html >@@ -0,0 +1,24 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta charset="utf-8"> >+<title>CSS Test: ::marker formatting with font properties reference file</title> >+<link rel="author" title="Daniel Bates" href="mailto:dbates@webkit.org"> >+<style> >+li { >+ font-family: sans-serif; >+ font-size: 24px; >+ font-style: italic; >+ font-variant: small-caps; >+ font-weight: bold; >+ list-style-type: lower-alpha; >+ font-variant-numeric: tabular-nums; >+} >+</style> >+</head> >+<body> >+<ol> >+ <li></li> >+</ol> >+</body> >+</html> >diff --git a/LayoutTests/http/wpt/css/css-pseudo-4/marker-font-properties.html b/LayoutTests/http/wpt/css/css-pseudo-4/marker-font-properties.html >new file mode 100644 >index 00000000000..32b14390b0e >--- /dev/null >+++ b/LayoutTests/http/wpt/css/css-pseudo-4/marker-font-properties.html >@@ -0,0 +1,29 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta charset="utf-8"> >+<title>CSS Test: ::marker formatting with font properties</title> >+<link rel="author" title="Daniel Bates" href="mailto:dbates@webkit.org"> >+<link ref="match" href="marker-font-properties-expected.html"> >+<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#marker-pseudo"> >+<meta name="assert" content="Tests ::marker rendering with font properties"> >+<style> >+li { >+ list-style-type: lower-alpha; >+} >+ >+li::marker { >+ font-family: sans-serif; >+ font-size: 24px; >+ font-style: italic; >+ font-variant: small-caps; >+ font-weight: bold; >+} >+</style> >+</head> >+<body> >+<ol> >+ <li><span style="font-size: 24px"><!-- FIXME: Needed to ensure consistent baseline position with expected result (why?). --></span></li> >+</ol> >+</body> >+</html> >diff --git a/LayoutTests/http/wpt/css/css-pseudo-4/marker-inherit-values-expected.html b/LayoutTests/http/wpt/css/css-pseudo-4/marker-inherit-values-expected.html >new file mode 100644 >index 00000000000..6cce146ab3f >--- /dev/null >+++ b/LayoutTests/http/wpt/css/css-pseudo-4/marker-inherit-values-expected.html >@@ -0,0 +1,24 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta charset="utf-8"> >+<title>CSS Test: ::marker inherits values from originating element reference file</title> >+<link rel="author" title="Daniel Bates" href="mailto:dbates@webkit.org"> >+<style> >+li { >+ color: green; >+ font-family: sans-serif; >+ font-size: x-large; >+ font-style: italic; >+ font-variant: small-caps; >+ font-weight: bold; >+ list-style-type: lower-alpha; >+} >+</style> >+</head> >+<body> >+<ol> >+ <li></li> >+</ol> >+</body> >+</html> >diff --git a/LayoutTests/http/wpt/css/css-pseudo-4/marker-inherit-values.html b/LayoutTests/http/wpt/css/css-pseudo-4/marker-inherit-values.html >new file mode 100644 >index 00000000000..46a7222fb71 >--- /dev/null >+++ b/LayoutTests/http/wpt/css/css-pseudo-4/marker-inherit-values.html >@@ -0,0 +1,40 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta charset="utf-8"> >+<title>CSS Test: ::marker inherits values from originating element</title> >+<link rel="author" title="Daniel Bates" href="mailto:dbates@webkit.org"> >+<link ref="match" href="marker-inherit-values-expected.html"> >+<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#marker-pseudo"> >+<meta name="assert" content="Tests ::marker inherits values from originating element"> >+<style> >+ol { >+ color: red; >+} >+ >+li { /* Originating element */ >+ color: green; >+ font-family: sans-serif; >+ font-size: x-large; >+ font-style: italic; >+ font-variant: small-caps; >+ font-weight: bold; >+ list-style-type: lower-alpha; >+} >+ >+li::marker { >+ color: inherit; >+ font-family: inherit; >+ font-size: inherit; >+ font-style: inherit; >+ font-variant: inherit; >+ font-weight: inherit; >+} >+</style> >+</head> >+<body> >+<ol> >+ <li></li> >+</ol> >+</body> >+</html> >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c1d43b4a1e1..2ea5579f632 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,84 @@ >+2017-07-31 Daniel Bates <dabates@apple.com> >+ >+ Support ::marker pseudo-element >+ https://bugs.webkit.org/show_bug.cgi?id=141477 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Implements the ::marker pseudo element as per the CSS Pseudo-Element Module Level 4 >+ spec., <https://drafts.csswg.org/css-pseudo-4> (Editor's Draft, 24 July 2017). >+ >+ The ::marker pseudo element is a convenience pseudo element that allows a person to >+ style the appearance of a list item marker. For example, to render all list item >+ markers in bolded, blue text you would define a stylesheet with the following content: >+ >+ li::marker { >+ color: blue; >+ font-weight: bold; >+ } >+ >+ and this could be applied to a page that contains markup of the form: >+ >+ <ol> >+ <li>Item 1</li> >+ <li>Item 2</li> >+ ... >+ <li>Item N-1</li> >+ <li>Item N</li> >+ </ol> >+ >+ Formerly to the achieve the same effect you would need to use a stylesheet of the form: >+ >+ li { >+ color: blue; >+ font-weight: bold; >+ } >+ >+ .list-item-content { >+ all: initial; >+ } >+ >+ and then write your markup to have the form: >+ >+ <ol> >+ <li><span class="list-item-content">Item 1</span></li> >+ <li><span class="list-item-content">Item 2</span></li> >+ ... >+ <li><span class="list-item-content">Item N-1</span></li> >+ <li><span class="list-item-content">Item N</span></li> >+ </ol> >+ >+ The ::marker pseudo element only supports stylizing all font properties and the color property >+ of a list item marker. >+ >+ Tests: fast/lists/list-marker-with-display.html >+ http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements.html >+ http/wpt/css/css-pseudo-4/marker-color.html >+ http/wpt/css/css-pseudo-4/marker-font-properties.html >+ http/wpt/css/css-pseudo-4/marker-inherit-values.html >+ >+ * css/CSSSelector.cpp: >+ (WebCore::CSSSelector::pseudoId): Return the pseudo id for the ::marker pseudo element. >+ * css/CSSSelector.h: Add enumerator PseudoElementMarker to the pseudo element enum. >+ * css/RuleSet.cpp: >+ (WebCore::determinePropertyWhitelistType): Return whitelist type PropertyWhitelistMarker for ::marker >+ so that we match rules against the acceptable rules for ::marker. >+ * css/RuleSet.h: Add enumerator PropertyWhitelistMarker to the property whitelist type enum. >+ * css/SelectorPseudoElementTypeMap.in: Add "marker" to the list of pseudo element types. >+ * css/StyleResolver.cpp: >+ (WebCore::isValidMarkerStyleProperty): Determines if the specified CSS property is valid inside ::marker. >+ (WebCore::StyleResolver::CascadedProperties::addMatch): Only recognize CSS properties in the content block >+ of ::marker that match the ::marker whitelist policy. >+ * rendering/RenderListItem.cpp: >+ (WebCore::RenderListItem::computeMarkerStyle): Computes the style object for the list item marker. We >+ apply the user-agent style to the marker here as opposed to defining ::marker in the UA sheet as per >+ the spec. as an optimization to avoid having the style resolver apply the pseudo element to all elements. >+ For now, we always inherit style from the originating element (list item). Added FIXME to selectively >+ inherit styles. >+ (WebCore::RenderListItem::styleDidChange): Always apply the list marker style to the list marker renderer. >+ * rendering/RenderListItem.h: >+ * rendering/style/RenderStyleConstants.h: Add pseudo ID for the ::marker pseudo element. >+ > 2017-07-31 Matt Lewis <jlewis3@apple.com> > > Unreviewed, rolling out r220060. >diff --git a/Source/WebCore/css/CSSSelector.cpp b/Source/WebCore/css/CSSSelector.cpp >index 2eb0d04b89e..daccd478e03 100644 >--- a/Source/WebCore/css/CSSSelector.cpp >+++ b/Source/WebCore/css/CSSSelector.cpp >@@ -275,6 +275,8 @@ PseudoId CSSSelector::pseudoId(PseudoElementType type) > return FIRST_LETTER; > case PseudoElementSelection: > return SELECTION; >+ case PseudoElementMarker: >+ return MARKER; > case PseudoElementBefore: > return BEFORE; > case PseudoElementAfter: >diff --git a/Source/WebCore/css/CSSSelector.h b/Source/WebCore/css/CSSSelector.h >index 4bfc2465943..a6c82925cf9 100644 >--- a/Source/WebCore/css/CSSSelector.h >+++ b/Source/WebCore/css/CSSSelector.h >@@ -174,6 +174,7 @@ namespace WebCore { > #endif > PseudoElementFirstLetter, > PseudoElementFirstLine, >+ PseudoElementMarker, > PseudoElementResizer, > PseudoElementScrollbar, > PseudoElementScrollbarButton, >diff --git a/Source/WebCore/css/RuleSet.cpp b/Source/WebCore/css/RuleSet.cpp >index 91b63f89add..e4f79f08d33 100644 >--- a/Source/WebCore/css/RuleSet.cpp >+++ b/Source/WebCore/css/RuleSet.cpp >@@ -139,14 +139,14 @@ static inline PropertyWhitelistType determinePropertyWhitelistType(const AddRule > { > if (addRuleFlags & RuleIsInRegionRule) > return PropertyWhitelistRegion; >-#if ENABLE(VIDEO_TRACK) > for (const CSSSelector* component = selector; component; component = component->tagHistory()) { >+#if ENABLE(VIDEO_TRACK) > if (component->match() == CSSSelector::PseudoElement && (component->pseudoElementType() == CSSSelector::PseudoElementCue || component->value() == TextTrackCue::cueShadowPseudoId())) > return PropertyWhitelistCue; >- } >-#else >- UNUSED_PARAM(selector); > #endif >+ if (component->match() == CSSSelector::PseudoElement && component->pseudoElementType() == CSSSelector::PseudoElementMarker) >+ return PropertyWhitelistMarker; >+ } > return PropertyWhitelistNone; > } > >diff --git a/Source/WebCore/css/RuleSet.h b/Source/WebCore/css/RuleSet.h >index 6fa4c425158..11b33024880 100644 >--- a/Source/WebCore/css/RuleSet.h >+++ b/Source/WebCore/css/RuleSet.h >@@ -39,6 +39,7 @@ enum AddRuleFlags { > > enum PropertyWhitelistType { > PropertyWhitelistNone = 0, >+ PropertyWhitelistMarker, > PropertyWhitelistRegion, > #if ENABLE(VIDEO_TRACK) > PropertyWhitelistCue >diff --git a/Source/WebCore/css/SelectorPseudoElementTypeMap.in b/Source/WebCore/css/SelectorPseudoElementTypeMap.in >index abe2818cbb9..243345fab1e 100644 >--- a/Source/WebCore/css/SelectorPseudoElementTypeMap.in >+++ b/Source/WebCore/css/SelectorPseudoElementTypeMap.in >@@ -5,6 +5,7 @@ cue > #endif > first-letter > first-line >+marker > placeholder, PseudoElementWebKitCustom > -webkit-input-placeholder, PseudoElementWebKitCustomLegacyPrefixed > -webkit-resizer >diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp >index 6eabcb1567a..7e7a183c9dc 100644 >--- a/Source/WebCore/css/StyleResolver.cpp >+++ b/Source/WebCore/css/StyleResolver.cpp >@@ -1473,6 +1473,35 @@ inline bool isValidVisitedLinkProperty(CSSPropertyID id) > return false; > } > >+// https://www.w3.org/TR/css-pseudo-4/#marker-pseudo (Editor's Draft, 25 July 2017) >+static inline bool isValidMarkerStyleProperty(CSSPropertyID id) >+{ >+ switch (id) { >+ case CSSPropertyColor: >+ case CSSPropertyFontFamily: >+ case CSSPropertyFontFeatureSettings: >+ case CSSPropertyFontSize: >+ case CSSPropertyFontStretch: >+ case CSSPropertyFontStyle: >+ case CSSPropertyFontSynthesis: >+ case CSSPropertyFontVariantAlternates: >+ case CSSPropertyFontVariantCaps: >+ case CSSPropertyFontVariantEastAsian: >+ case CSSPropertyFontVariantLigatures: >+ case CSSPropertyFontVariantNumeric: >+ case CSSPropertyFontVariantPosition: >+ case CSSPropertyFontWeight: >+#if ENABLE(VARIATION_FONTS) >+ case CSSPropertyFontOpticalSizing: >+ case CSSPropertyFontVariationSettings: >+#endif >+ return true; >+ default: >+ break; >+ } >+ return false; >+} >+ > // http://dev.w3.org/csswg/css3-regions/#the-at-region-style-rule > // FIXME: Add incremental support for other region styling properties. > static inline bool isValidRegionStyleProperty(CSSPropertyID id) >@@ -2152,6 +2181,8 @@ void StyleResolver::CascadedProperties::addMatch(const MatchResult& matchResult, > if (propertyWhitelistType == PropertyWhitelistCue && !isValidCueStyleProperty(propertyID)) > continue; > #endif >+ if (propertyWhitelistType == PropertyWhitelistMarker && !isValidMarkerStyleProperty(propertyID)) >+ continue; > > if (shouldApplyPropertyInParseOrder(propertyID)) > setDeferred(propertyID, *current.value(), matchedProperties.linkMatchType, cascadeLevel, matchedProperties.styleScopeOrdinal); >diff --git a/Source/WebCore/rendering/RenderListItem.cpp b/Source/WebCore/rendering/RenderListItem.cpp >index b650779d1ba..bfafb37e68d 100644 >--- a/Source/WebCore/rendering/RenderListItem.cpp >+++ b/Source/WebCore/rendering/RenderListItem.cpp >@@ -24,6 +24,7 @@ > #include "config.h" > #include "RenderListItem.h" > >+#include "CSSFontSelector.h" > #include "ElementTraversal.h" > #include "HTMLNames.h" > #include "HTMLOListElement.h" >@@ -72,6 +73,29 @@ void RenderListItem::willBeDestroyed() > RenderBlockFlow::willBeDestroyed(); > } > >+RenderStyle RenderListItem::computeMarkerStyle() const >+{ >+ // The marker always inherits from the list item, regardless of where it might end >+ // up (e.g., in some deeply nested line box). See CSS3 spec. >+ // FIXME: The marker should only inherit all font properties and the color property >+ // according to the CSS Pseudo-Elements Module Level 4 spec. >+ // >+ // Although the CSS Pseudo-Elements Module Level 4 spec. saids to add ::marker to the UA sheet >+ // we apply it here as an optimization because it only applies to markers. That is, it does not >+ // apply to all elements. >+ RenderStyle parentStyle = RenderStyle::clone(style()); >+ auto fontDescription = style().fontDescription(); >+ fontDescription.setVariantNumericSpacing(FontVariantNumericSpacing::TabularNumbers); >+ parentStyle.setFontDescription(fontDescription); >+ parentStyle.fontCascade().update(&document().fontSelector()); >+ >+ if (auto markerStyle = getCachedPseudoStyle(MARKER, &parentStyle)) >+ return RenderStyle::clone(*markerStyle); >+ auto markerStyle = RenderStyle::create(); >+ markerStyle.inheritFrom(parentStyle); >+ return markerStyle; >+} >+ > void RenderListItem::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) > { > RenderBlockFlow::styleDidChange(diff, oldStyle); >@@ -84,17 +108,12 @@ void RenderListItem::styleDidChange(StyleDifference diff, const RenderStyle* old > return; > } > >- auto newStyle = RenderStyle::create(); >- // The marker always inherits from the list item, regardless of where it might end >- // up (e.g., in some deeply nested line box). See CSS3 spec. >- newStyle.inheritFrom(style()); >- if (!m_marker) { >+ auto newStyle = computeMarkerStyle(); >+ if (m_marker) >+ m_marker->setStyle(WTFMove(newStyle)); >+ else { > m_marker = createRenderer<RenderListMarker>(*this, WTFMove(newStyle)).leakPtr(); > m_marker->initializeStyle(); >- } else { >- // Do not alter our marker's style unless our style has actually changed. >- if (diff != StyleDifferenceEqual) >- m_marker->setStyle(WTFMove(newStyle)); > } > } > >diff --git a/Source/WebCore/rendering/RenderListItem.h b/Source/WebCore/rendering/RenderListItem.h >index c094e3c13dd..8c191184038 100644 >--- a/Source/WebCore/rendering/RenderListItem.h >+++ b/Source/WebCore/rendering/RenderListItem.h >@@ -86,6 +86,8 @@ private: > void updateValueNow() const; > void explicitValueChanged(); > >+ RenderStyle computeMarkerStyle() const; >+ > int m_explicitValue; > RenderListMarker* m_marker; > mutable int m_value; >diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h >index 0d4c075860a..bb99ac64e93 100644 >--- a/Source/WebCore/rendering/style/RenderStyleConstants.h >+++ b/Source/WebCore/rendering/style/RenderStyleConstants.h >@@ -77,7 +77,7 @@ enum StyleDifferenceContextSensitiveProperty { > // Static pseudo styles. Dynamic ones are produced on the fly. > enum PseudoId : unsigned char { > // The order must be NOP ID, public IDs, and then internal IDs. >- NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, SCROLLBAR, >+ NOPSEUDO, FIRST_LINE, FIRST_LETTER, MARKER, BEFORE, AFTER, SELECTION, SCROLLBAR, > // Internal IDs follow: > SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER, > AFTER_LAST_INTERNAL_PSEUDOID, >-- >2.13.2 (Apple Git-90) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 141477
:
316407
|
316473
|
316475
|
316476
|
316479
|
316490
|
316491
|
316493
|
316786
|
316787
|
316788
|
316790
|
316791
|
316792
|
316793
| 316800