Backed out changeset d33544f0d8e6 (bug 1528451) for Assertion failure: IsResolved ...nsStyleStruct.h failures CLOSED TREE

--HG--
extra : rebase_source : 7cb6575b90f503100bbe1b5d07a9f072b8f350d4
This commit is contained in:
Ciure Andrei 2019-02-19 12:44:44 +02:00
Родитель 9214b9fd29
Коммит bdd1cad961
5 изменённых файлов: 23 добавлений и 79 удалений

Просмотреть файл

@ -2811,6 +2811,13 @@ bool RestyleManager::ProcessPostTraversal(Element* aElement,
if (wasRestyled && oldOrDisplayContentsStyle) {
MOZ_ASSERT(styleFrame || isDisplayContents);
// Note that upToDateContext could be the same as oldOrDisplayContentsStyle,
// but it doesn't matter, since the only point of it is calling
// TriggerImageLoads on the relevant structs, and those don't matter for
// display: contents.
upToDateContext->StartImageLoads(*mPresContext->Document(),
oldOrDisplayContentsStyle);
// We want to walk all the continuations here, even the ones with different
// styles. In practice, the only reason we get continuations with different
// styles here is ::first-line (::first-letter never affects element

Просмотреть файл

@ -588,6 +588,7 @@ void nsFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
NS_FRAME_MAY_BE_TRANSFORMED |
NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN));
} else {
mComputedStyle->StartImageLoads(*PresContext()->Document());
PresContext()->ConstructedFrame();
}
if (GetParent()) {
@ -846,9 +847,11 @@ static void CompareLayers(
}
static void AddAndRemoveImageAssociations(
ImageLoader& aImageLoader,
nsFrame* aFrame, const nsStyleImageLayers* aOldLayers,
const nsStyleImageLayers* aNewLayers) {
ImageLoader* imageLoader =
aFrame->PresContext()->Document()->StyleImageLoader();
// If the old context had a background-image image, or mask-image image,
// and new context does not have the same image, clear the image load
// notifier (which keeps the image loading, if it still is) for the frame.
@ -859,14 +862,14 @@ static void AddAndRemoveImageAssociations(
// interval.)
if (aOldLayers && aFrame->HasImageRequest()) {
CompareLayers(aOldLayers, aNewLayers,
[&](imgRequestProxy* aReq) {
aImageLoader.DisassociateRequestFromFrame(aReq, aFrame);
[&imageLoader, aFrame](imgRequestProxy* aReq) {
imageLoader->DisassociateRequestFromFrame(aReq, aFrame);
});
}
CompareLayers(aNewLayers, aOldLayers,
[&](imgRequestProxy* aReq) {
aImageLoader.AssociateRequestToFrame(aReq, aFrame, 0);
[&imageLoader, aFrame](imgRequestProxy* aReq) {
imageLoader->AssociateRequestToFrame(aReq, aFrame, 0);
});
}
@ -1039,32 +1042,16 @@ void nsIFrame::MarkNeedsDisplayItemRebuild() {
}
}
Document* doc = PresContext()->Document();
ImageLoader* imageLoader = doc->StyleImageLoader();
// Continuing text frame doesn't initialize its continuation pointer before
// reaching here for the first time, so we have to exclude text frames. This
// doesn't affect correctness because text can't match selectors.
//
// FIXME(emilio): We should consider fixing that.
const bool isNonTextFirstContinuation =
!IsTextFrame() && !GetPrevContinuation();
if (isNonTextFirstContinuation) {
mComputedStyle->StartImageLoads(*doc);
}
// TODO(emilio): Can we avoid doing some / all of this when
// isNonTextFirstContinuation is false? We should consider doing this just for
// primary frames and pseudos.
const nsStyleImageLayers* oldLayers =
aOldComputedStyle ? &aOldComputedStyle->StyleBackground()->mImage
: nullptr;
const nsStyleImageLayers* newLayers = &StyleBackground()->mImage;
AddAndRemoveImageAssociations(*imageLoader, this, oldLayers, newLayers);
AddAndRemoveImageAssociations(this, oldLayers, newLayers);
oldLayers =
aOldComputedStyle ? &aOldComputedStyle->StyleSVGReset()->mMask : nullptr;
newLayers = &StyleSVGReset()->mMask;
AddAndRemoveImageAssociations(*imageLoader, this, oldLayers, newLayers);
AddAndRemoveImageAssociations(this, oldLayers, newLayers);
if (aOldComputedStyle) {
// Detect style changes that should trigger a scroll anchor adjustment
@ -1139,6 +1126,7 @@ void nsIFrame::MarkNeedsDisplayItemRebuild() {
}
}
ImageLoader* imageLoader = PresContext()->Document()->StyleImageLoader();
imgIRequest* oldBorderImage =
aOldComputedStyle
? aOldComputedStyle->StyleBorder()->GetBorderImageRequest()
@ -1186,8 +1174,11 @@ void nsIFrame::MarkNeedsDisplayItemRebuild() {
}
// SVGObserverUtils::GetEffectProperties() asserts that we only invoke it with
// the first continuation so we need to check that in advance.
if (isNonTextFirstContinuation) {
// the first continuation so we need to check that in advance. Continuing text
// frame doesn't initialize its continuation pointer before reaching here for
// the first time, so we have to exclude text frames. This doesn't affect
// correctness because text nodes themselves shouldn't have effects applied.
if (!IsTextFrame() && !GetPrevContinuation()) {
// Kick off loading of external SVG resources referenced from properties if
// any. This currently includes filter, clip-path, and mask.
SVGObserverUtils::InitiateResourceDocLoads(this);

Просмотреть файл

@ -1,24 +0,0 @@
<!doctype html>
<title>CSS Test: ::first-letter correctly applies background-image dynamically</title>
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
<link rel="author" href="https://mozilla.org" title="Mozilla">
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-letter-styling">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1528451">
<link rel="match" href="first-letter-background-image-ref.html">
<style>
div::first-letter {
color: lime;
}
div.image::first-letter {
/* Lime background */
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M/wHwAEBgIApD5fRAAAAABJRU5ErkJggg==');
}
</style>
<div>
A letter
</div>
<script>
let div = document.querySelector("div");
getComputedStyle(div).color;
div.classList.add('image');
</script>

Просмотреть файл

@ -1,13 +0,0 @@
<!doctype html>
<title>CSS Test Reference</title>
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
<link rel="author" href="https://mozilla.org" title="Mozilla">
<style>
div::first-letter {
color: lime;
background-color: lime;
}
</style>
<div>
A letter
</div>

Просмотреть файл

@ -1,17 +0,0 @@
<!doctype html>
<title>CSS Test: ::first-letter correctly applies background-image</title>
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
<link rel="author" href="https://mozilla.org" title="Mozilla">
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-letter-styling">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1528451">
<link rel="match" href="first-letter-background-image-ref.html">
<style>
div::first-letter {
color: lime;
/* Lime background */
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M/wHwAEBgIApD5fRAAAAABJRU5ErkJggg==');
}
</style>
<div>
A letter
</div>