mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1605473 - Implement 'content: none' for ::marker. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D111707
This commit is contained in:
parent
815b68c3c8
commit
c019c6f680
@ -1692,7 +1692,9 @@ void nsCSSFrameConstructor::CreateGeneratedContentItem(
|
||||
|
||||
ServoStyleSet* styleSet = mPresShell->StyleSet();
|
||||
|
||||
// Probe for the existence of the pseudo-element
|
||||
// Probe for the existence of the pseudo-element.
|
||||
// |ProbePseudoElementStyle| checks the relevant properties for the pseudo.
|
||||
// It only returns a non-null value if the pseudo should exist.
|
||||
RefPtr<ComputedStyle> pseudoStyle = styleSet->ProbePseudoElementStyle(
|
||||
aOriginatingElement, aPseudoElement, &aStyle);
|
||||
if (!pseudoStyle) {
|
||||
@ -1720,10 +1722,6 @@ void nsCSSFrameConstructor::CreateGeneratedContentItem(
|
||||
MOZ_ASSERT_UNREACHABLE("unexpected aPseudoElement");
|
||||
}
|
||||
|
||||
// |ProbePseudoElementStyle| checked the 'display' property and the
|
||||
// |ContentCount()| of the 'content' property for us, and for ::marker
|
||||
// also that we have either a 'list-style-type' or 'list-style-image'
|
||||
// non-initial value in case we have no 'content'.
|
||||
RefPtr<NodeInfo> nodeInfo = mDocument->NodeInfoManager()->GetNodeInfo(
|
||||
elemName, nullptr, kNameSpaceID_None, nsINode::ELEMENT_NODE);
|
||||
RefPtr<Element> container;
|
||||
|
@ -7419,8 +7419,9 @@ bool nsBlockFrame::MarkerIsEmpty() const {
|
||||
"should only care when we have an outside ::marker");
|
||||
nsIFrame* marker = GetMarker();
|
||||
const nsStyleList* list = marker->StyleList();
|
||||
return list->mCounterStyle.IsNone() && list->mListStyleImage.IsNone() &&
|
||||
marker->StyleContent()->ContentCount() == 0;
|
||||
return marker->StyleContent()->mContent.IsNone() ||
|
||||
(list->mCounterStyle.IsNone() && list->mListStyleImage.IsNone() &&
|
||||
marker->StyleContent()->ContentCount() == 0);
|
||||
}
|
||||
|
||||
void nsBlockFrame::ReflowOutsideMarker(nsIFrame* aMarkerFrame,
|
||||
|
@ -677,27 +677,35 @@ bool ServoStyleSet::GeneratedContentPseudoExists(
|
||||
if (!aParentStyle.StyleDisplay()->IsListItem()) {
|
||||
return false;
|
||||
}
|
||||
const auto& content = aPseudoStyle.StyleContent()->mContent;
|
||||
// ::marker does not exist if 'content' is 'none' (this trumps
|
||||
// any 'list-style-type' or 'list-style-image' values).
|
||||
if (content.IsNone()) {
|
||||
return false;
|
||||
}
|
||||
// ::marker only exist if we have 'content' or at least one of
|
||||
// 'list-style-type' or 'list-style-image'.
|
||||
if (aPseudoStyle.StyleList()->mCounterStyle.IsNone() &&
|
||||
aPseudoStyle.StyleList()->mListStyleImage.IsNone() &&
|
||||
aPseudoStyle.StyleContent()->ContentCount() == 0) {
|
||||
content.IsNormal()) {
|
||||
return false;
|
||||
}
|
||||
// display:none is equivalent to not having the pseudo-element at all.
|
||||
// display:none is equivalent to not having a pseudo at all.
|
||||
if (aPseudoStyle.StyleDisplay()->mDisplay == StyleDisplay::None) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// For :before and :after pseudo-elements, having display: none or no
|
||||
// 'content' property is equivalent to not having the pseudo-element
|
||||
// at all.
|
||||
// For ::before and ::after pseudo-elements, no 'content' items is
|
||||
// equivalent to not having the pseudo-element at all.
|
||||
if (type == PseudoStyleType::before || type == PseudoStyleType::after) {
|
||||
if (aPseudoStyle.StyleDisplay()->mDisplay == StyleDisplay::None) {
|
||||
if (!aPseudoStyle.StyleContent()->mContent.IsItems()) {
|
||||
return false;
|
||||
}
|
||||
if (!aPseudoStyle.StyleContent()->ContentCount()) {
|
||||
MOZ_ASSERT(aPseudoStyle.StyleContent()->ContentCount() > 0,
|
||||
"IsItems() implies we have at least one item");
|
||||
// display:none is equivalent to not having a pseudo at all.
|
||||
if (aPseudoStyle.StyleDisplay()->mDisplay == StyleDisplay::None) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -831,10 +831,11 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||
fn adjust_for_marker_pseudo(&mut self) {
|
||||
use crate::values::computed::font::{FontFamily, FontSynthesis};
|
||||
use crate::values::computed::text::{LetterSpacing, WordSpacing};
|
||||
use crate::values::computed::counters::{Content};
|
||||
|
||||
let is_legacy_marker = self.style.pseudo.map_or(false, |p| p.is_marker()) &&
|
||||
self.style.get_counters().ineffective_content_property() &&
|
||||
self.style.get_list().clone_list_style_type().is_bullet();
|
||||
self.style.get_list().clone_list_style_type().is_bullet() &&
|
||||
self.style.get_counters().clone_content() == Content::Normal;
|
||||
if !is_legacy_marker {
|
||||
return;
|
||||
}
|
||||
|
@ -27,15 +27,16 @@ impl ToResolvedValue for computed::Content {
|
||||
.style
|
||||
.pseudo()
|
||||
.map_or(false, |p| p.is_before_or_after());
|
||||
let is_marker = context
|
||||
.style
|
||||
.pseudo()
|
||||
.map_or(false, |p| p.is_marker());
|
||||
|
||||
match self {
|
||||
Self::Normal if is_before_or_after => Self::None,
|
||||
// For now, make `content: none` compute to `normal` on other
|
||||
// elements, as we don't respect it.
|
||||
//
|
||||
// FIXME(emilio, bug 1605473): for marker this should be preserved
|
||||
// and respected, probably.
|
||||
Self::None if !is_before_or_after => Self::Normal,
|
||||
// For now, make `content: none` compute to `normal` for elements
|
||||
// other than ::before, ::after and ::marker, as we don't respect it.
|
||||
Self::None if !is_before_or_after && !is_marker => Self::Normal,
|
||||
other => other,
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
[marker-computed-content.html]
|
||||
[Computed 'content' for non-list-item ::marker, variant none]
|
||||
expected: FAIL
|
||||
|
||||
[Computed 'content' for list-item ::marker, variant none]
|
||||
expected: FAIL
|
||||
|
@ -1,4 +0,0 @@
|
||||
[marker-computed-size.html]
|
||||
[::marker with no box due to 'content']
|
||||
expected: FAIL
|
||||
|
@ -1,2 +0,0 @@
|
||||
[marker-content-019.html]
|
||||
expected: FAIL
|
Loading…
Reference in New Issue
Block a user