Bug 1787072 - Avoid useless reframes setting the src attribute of a broken image that already has an image frame. r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D155533
This commit is contained in:
Emilio Cobos Álvarez
2022-09-02 09:39:38 +00:00
parent c3d57cc78d
commit d8341bcf96
9 changed files with 144 additions and 68 deletions

View File

@@ -3515,7 +3515,9 @@ nsCSSFrameConstructor::FindGeneratedImageData(const Element& aElement,
const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindImgData(const Element& aElement,
ComputedStyle& aStyle) {
if (!nsImageFrame::ShouldCreateImageFrameFor(aElement, aStyle)) {
if (nsImageFrame::ImageFrameTypeFor(aElement, aStyle) !=
nsImageFrame::ImageFrameType::ForElementRequest) {
// content: url gets handled by the generic code-path.
return nullptr;
}
@@ -3527,7 +3529,8 @@ nsCSSFrameConstructor::FindImgData(const Element& aElement,
const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindImgControlData(const Element& aElement,
ComputedStyle& aStyle) {
if (!nsImageFrame::ShouldCreateImageFrameFor(aElement, aStyle)) {
if (nsImageFrame::ImageFrameTypeFor(aElement, aStyle) !=
nsImageFrame::ImageFrameType::ForElementRequest) {
return nullptr;
}
@@ -5356,7 +5359,8 @@ 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 (nsImageFrame::ShouldCreateImageFrameForContent(aElement, aStyle)) {
if (nsImageFrame::ShouldCreateImageFrameForContentProperty(aElement,
aStyle)) {
static constexpr FrameConstructionData sImgData(
NS_NewImageFrameForContentProperty);
return &sImgData;