-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a4199c
commit b91e293
Showing
18 changed files
with
151 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
use crate::context::LayoutContext; | ||
use crate::dom_traversal::{NodeAndStyleInfo, NodeExt, PseudoElementContentItem}; | ||
use crate::replaced::ReplacedContent; | ||
use style::properties::longhands::list_style_type::computed_value::T as ListStyleType; | ||
use style::properties::style_structs; | ||
use style::values::computed::url::UrlOrNone; | ||
|
||
/// https://drafts.csswg.org/css-lists/#content-property | ||
pub(crate) fn make_marker<'dom, Node>( | ||
context: &LayoutContext, | ||
info: &NodeAndStyleInfo<Node>, | ||
) -> Option<Vec<PseudoElementContentItem>> | ||
where | ||
Node: NodeExt<'dom>, | ||
{ | ||
let style = info.style.get_list(); | ||
|
||
// https://drafts.csswg.org/css-lists/#marker-image | ||
let marker_image = || match &style.list_style_image { | ||
UrlOrNone::Url(url) => Some(vec![ | ||
PseudoElementContentItem::Replaced(ReplacedContent::from_image_url( | ||
info.node, context, url, | ||
)?), | ||
PseudoElementContentItem::Text(" ".into()), | ||
]), | ||
UrlOrNone::None => None, | ||
}; | ||
marker_image().or_else(|| { | ||
Some(vec![PseudoElementContentItem::Text( | ||
marker_string(style)?.into(), | ||
)]) | ||
}) | ||
} | ||
|
||
/// https://drafts.csswg.org/css-lists/#marker-string | ||
fn marker_string(style: &style_structs::List) -> Option<&'static str> { | ||
// FIXME: add support for counters and other style types | ||
match style.list_style_type { | ||
ListStyleType::None => None, | ||
ListStyleType::Disc => Some("• "), | ||
ListStyleType::Circle => Some("◦ "), | ||
ListStyleType::Square => Some("▪ "), | ||
ListStyleType::DisclosureOpen => Some("▾ "), | ||
ListStyleType::DisclosureClosed => Some("‣ "), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
tests/wpt/metadata-layout-2020/css/CSS2/generated-content/content-counter-001.xht.ini
This file was deleted.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
...s/wpt/metadata-layout-2020/css/CSS2/generated-content/multiple-content-values-001.xht.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[multiple-content-values-001.xht] | ||
expected: FAIL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
tests/wpt/metadata-layout-2020/css/CSS2/lists/list-style-019.xht.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[list-style-019.xht] | ||
expected: FAIL |
2 changes: 2 additions & 0 deletions
2
...pt/metadata-layout-2020/css/CSS2/margin-padding-clear/padding-left-applies-to-010.xht.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[padding-left-applies-to-010.xht] | ||
expected: FAIL |
2 changes: 0 additions & 2 deletions
2
tests/wpt/metadata-layout-2020/css/CSS2/syntax/characters-0080-009F-001.xht.ini
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
tests/wpt/mozilla/meta-layout-2020/css/list_style_image_sizing_a.html.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[list_style_image_sizing_a.html] | ||
expected: FAIL |
2 changes: 0 additions & 2 deletions
2
tests/wpt/mozilla/meta-layout-2020/css/list_style_position_a.html.ini
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
tests/wpt/mozilla/meta-layout-2020/css/list_style_type_a.html.ini
This file was deleted.
Oops, something went wrong.