Closed
Bug 1351015
Opened 9 years ago
Closed 8 years ago
stylo: Assertion range increased to 8 for image-rect/background-draw-nothing-malformed-images.html
Categories
(Core :: CSS Parsing and Computation, enhancement, P3)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: canova, Assigned: u459114)
References
Details
Attachments
(1 file)
Assertion range increased to 8 for image-rect/background-draw-nothing-malformed-images.html (in bug 1350714) because of a URL bug. It was pre-existing and probably -moz-image-rect made it discoverable. We should fix this URL bug and decrease this range to 6.
See also https://bugzilla.mozilla.org/show_bug.cgi?id=1350714#c6
Updated•9 years ago
|
Priority: -- → P3
#01: mozilla::nsImageRenderer::PrepareImage() (/home/cjcool/repository/mozilla-central-2/layout/painting/nsImageRenderer.cpp:151 (discriminator 1))
#02: nsCSSRendering::PrepareImageLayer(nsPresContext*, nsIFrame*, unsigned int, nsRect const&, nsRect const&, nsStyleImageLayers::Layer const&, bool*) (/home/cjcool/repository/mozilla-central-2/layout/painting/nsCSSRendering.cpp:311$
)
#03: nsDisplayBackgroundImage::GetInitData(nsDisplayListBuilder*, nsIFrame*, unsigned int, nsRect const&, nsStyleBackground const*, nsDisplayBackgroundImage::LayerizeFixed) (/home/cjcool/repository/mozilla-central-2/layout/painting/$
sDisplayList.cpp:2897)
#04: nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder*, nsIFrame*, nsRect const&, nsDisplayList*, bool, nsStyleContext*) (/home/cjcool/repository/mozilla-central-2/layout/painting/nsDisplayList.cpp:3159)
#05: nsFrame::DisplayBackgroundUnconditional(nsDisplayListBuilder*, nsDisplayListSet const&, bool) (/home/cjcool/repository/mozilla-central-2/layout/generic/nsFrame.cpp:2070)
#
It's not a stylo only bug. The reason is this HTML file use a melformed png
background-image: -moz-image-rect(url(../backgrounds/malformed.png), 0, 16, 16, 0);
nsStyleImage::ComputeActualCropRect()
{
nsIntSize imageSize;
imageContainer->GetWidth(&imageSize.width);
imageContainer->GetHeight(&imageSize.height);
if (imageSize.width <= 0 || imageSize.height <= 0) {
return false; << Return false, which make scense, since we can not get valid size from malformed.png
}
}
nsImageRenderer::PrepareImage()
{
bool success =
mImage->ComputeActualCropRect(actualCropRect, &isEntireImage);
NS_ASSERTION(success, "ComputeActualCropRect() should not fail here"); << of cause we will hit this assertion.
}
Comment 3•8 years ago
|
||
Yes, if it's the same assertion we had already (and just increasing the count), let's just annotate it and move on.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Attachment #8860504 -
Flags: review?(cam)
Comment 6•8 years ago
|
||
mozreview-review |
Comment on attachment 8860504 [details]
Bug 1351015 - Not assuming nsStyleImage::ComputeActualCropRect always return true.
https://reviewboard.mozilla.org/r/132514/#review136000
r=me with that assertion changed back to null check and return false.
::: layout/style/nsStyleStruct.cpp:2346
(Diff revision 2)
>
> bool
> nsStyleImage::ComputeActualCropRect(nsIntRect& aActualCropRect,
> bool* aIsEntireImage) const
> {
> - if (mType != eStyleImageType_Image) {
> + MOZ_ASSERT (mType == eStyleImageType_Image,
Nit: no space before "(".
::: layout/style/nsStyleStruct.cpp:2350
(Diff revision 2)
> imgRequestProxy* req = GetImageData();
> - if (!req) {
> - return false;
> + MOZ_ASSERT(req,
> + "req can not return null since mType is eStyleImageType_Image");
I think this assertion will not always be true. For example, nsStyleImageRequest::Resolve might have just returned true because we have a local reference (and so this isn't really a valid image). Also, if the URL was invalid in some way, ImageValue::Initialize will get null when it calls GetURI() (to pass it into ImageLoader::LoadImage), resulting in there being no imgRequestProxy for nsStyleImageRequest::Resolve to pull off the css::ImageValue.
Attachment #8860504 -
Flags: review?(cam) → review+
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 10•8 years ago
|
||
Pushed by cku@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6cf679052198
Not assuming nsStyleImage::ComputeActualCropRect always return true. r=heycam
Comment 12•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in
before you can comment on or make changes to this bug.
Description
•