Bug 1742411 - Prefer content property to img src on image elements. r=dholbert
Given the compat reports in bug 1484928, I don't think it's worth keeping the current behavior. Our behavior should match other browsers now. Rather than making content: url() work everywhere even for otherwise-replaced elements, just special-case this since that's what other browsers seem to do. Differential Revision: https://phabricator.services.mozilla.com/D131797
This commit is contained in:
@@ -1432,19 +1432,6 @@ static void MoveChildrenTo(nsIFrame* aOldParent, nsContainerFrame* aNewParent,
|
||||
}
|
||||
}
|
||||
|
||||
static bool ShouldCreateImageFrameForContent(const Element& aElement,
|
||||
ComputedStyle& aStyle) {
|
||||
if (aElement.IsRootOfNativeAnonymousSubtree()) {
|
||||
return false;
|
||||
}
|
||||
auto& content = aStyle.StyleContent()->mContent;
|
||||
if (!content.IsItems()) {
|
||||
return false;
|
||||
}
|
||||
Span<const StyleContentItem> items = content.AsItems().AsSpan();
|
||||
return items.Length() == 1 && items[0].IsImage();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsCSSFrameConstructor::nsCSSFrameConstructor(Document* aDocument,
|
||||
@@ -5341,7 +5328,7 @@ nsCSSFrameConstructor::FindElementData(const Element& aElement,
|
||||
|
||||
// Check for 'content: <image-url>' on the element (which makes us ignore
|
||||
// 'display' values other than 'none' or 'contents').
|
||||
if (ShouldCreateImageFrameForContent(aElement, aStyle)) {
|
||||
if (nsImageFrame::ShouldCreateImageFrameForContent(aElement, aStyle)) {
|
||||
static const FrameConstructionData sImgData =
|
||||
SIMPLE_FCDATA(NS_NewImageFrameForContentProperty);
|
||||
return &sImgData;
|
||||
|
||||
Reference in New Issue
Block a user