Closed Bug 641770 Opened 13 years ago Closed 13 years ago

Image element with position:fixed is drawn on scroll bar

Categories

(Core :: Graphics, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

VERIFIED FIXED
Tracking Status
blocking2.0 --- -

People

(Reporter: alice0775, Assigned: roc)

References

Details

(Keywords: regression, testcase)

Attachments

(4 files, 1 obsolete file)

Attached file sample html
Build Identifier:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b13pre) Gecko/20110314 Firefox/4.0b13pre ID:20110314030412

This was originally reported by http://bugzilla.mozilla.gr.jp/show_bug.cgi?id=6787

Image element with position:fixed is drawn on scroll bar.

Reproducible: Always

Steps to Reproduce:
1. Start Minefield with new profile
2. Open attached sample html
3.

Actual Results:
 Image element with position:fixed is drawn on scroll bar

Expected Results:
 Image element with position:fixed sgould not be drawn on scroll bar

Regression window:
Works:
http://hg.mozilla.org/mozilla-central/rev/16d3af58499c
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b10pre) Gecko/20110116 Firefox/4.0b10pre ID:20110117133144
Fails:
http://hg.mozilla.org/mozilla-central/rev/aa611c72c337
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b10pre) Gecko/20110115 Firefox/4.0b10pre ID:20110117140637
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=16d3af58499c&tochange=aa611c72c337
Attached image screenshot
In local build,
build from d41e933f589a : fails
build from 16d3af58499c : works
Regressed by:
d41e933f589a	Matt Woodrow — Bug 586683 - Part 4 - Move images into a separate ImageLayer when they are the only item in a ThebesLayer. r=roc a=blocking2.0
Blocks: 586683
Assignee: nobody → matt.woodrow+bugzilla
roc, can we ship with this?
blocking2.0: --- → ?
I think we can ship with this, but should fix it!
blocking2.0: ? → -
Roc: renominate this, please, if you disagree with our assertion, but we didn't think it was bad enough to block. Joe thought it might represent a deeper and worse bug in Layers, though.
I agree we can ship with this. It's almost certainly not a deep layers bug.
The bug is simply that we don't clip a layerized image, at all. Oops. Fortunately it can't escape from the Web page because the page is in a container layer that is clipped.
My reftest for this bug exposed this other layers bug.
Assignee: matt.woodrow+bugzilla → roc
Attachment #519524 - Flags: review?(bas.schouten)
Comment on attachment 519524 [details] [diff] [review]
Fix MarkLeafLayersCoveredByOpaque

>+// aClipRect and aRegoin are in that global coordinate system.

aRegoin
Comment on attachment 519525 [details] [diff] [review]
Set clip rect on layerized images

 nsRefPtr<ImageContainer>
 ContainerState::ThebesLayerData::CanOptimizeImageLayer(LayerManager* aManager)
 {
-  if (!mImage) {
+  if (!mImage || !mImageClip.mRoundedClipRects.IsEmpty()) {
     return nsnull;
   }
 
   return mImage->GetContainer(aManager);
 }

Should we do the IsRectClippedByRoundedCorner & RemoveRoundedCorners dance here?
 
 void
 ContainerStat

     if (imageContainer) {
       nsRefPtr<ImageLayer> imageLayer = CreateOrRecycleImageLayer();
       imageLayer->SetContainer(imageContainer);
       data->mImage->ConfigureLayer(imageLayer);
+      if (data->mImageClip.mHaveClipRect) {
+        nsPresContext* presContext = mContainerFrame->PresContext();
+        nscoord appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
+        nsIntRect clip = data->mImageClip.mClipRect.ToNearestPixels(appUnitsPerDevPixel);
+        imageLayer->IntersectClipRect(
+          data->mImageClip.mClipRect.ToNearestPixels(appUnitsPerDevPixel));
+      }
       layer = imageLayer;

Assert no rounded rects in the clip here?
(In reply to comment #11)
> Should we do the IsRectClippedByRoundedCorner & RemoveRoundedCorners dance
> here?

Let's not bother. When layers can clip to rounded corners, we won't be doing this anyway.

>  void
>  ContainerStat
> 
>      if (imageContainer) {
>        nsRefPtr<ImageLayer> imageLayer = CreateOrRecycleImageLayer();
>        imageLayer->SetContainer(imageContainer);
>        data->mImage->ConfigureLayer(imageLayer);
> +      if (data->mImageClip.mHaveClipRect) {
> +        nsPresContext* presContext = mContainerFrame->PresContext();
> +        nscoord appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
> +        nsIntRect clip =
> data->mImageClip.mClipRect.ToNearestPixels(appUnitsPerDevPixel);
> +        imageLayer->IntersectClipRect(
> +          data->mImageClip.mClipRect.ToNearestPixels(appUnitsPerDevPixel));
> +      }
>        layer = imageLayer;
> 
> Assert no rounded rects in the clip here?

OK.
Attached patch v2Splinter Review
Attachment #519525 - Attachment is obsolete: true
Attachment #519525 - Flags: review?(tnikkel)
Attachment #519544 - Flags: review?(tnikkel)
Attachment #519544 - Flags: review?(tnikkel) → review+
Comment on attachment 519524 [details] [diff] [review]
Fix MarkLeafLayersCoveredByOpaque

>From: Robert O'Callahan <robert@ocallahan.org>
>Bug 641770. Ensure that the cliprect for a layer is interpreted in the coordinate system of its container in MarkLeafLayersCoveredByOpaque. r=bas
>
>diff --git a/gfx/layers/basic/BasicLayers.cpp b/gfx/layers/basic/BasicLayers.cpp
>--- a/gfx/layers/basic/BasicLayers.cpp
>+++ b/gfx/layers/basic/BasicLayers.cpp
>@@ -1237,42 +1237,49 @@ TransformIntRect(nsIntRect& aRect, const
>   gfxRect gr = gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
>   gr = aMatrix.TransformBounds(gr);
>   aRect = (*aRoundMethod)(gr);
> }
> 
> // This implementation assumes that GetEffectiveTransform transforms
> // all layers to the same coordinate system. It can't be used as is
> // by accelerated layers because of intermediate surfaces.
>+// aClipRect and aRegoin are in that global coordinate system.

typo nit: aRegion
Attachment #519524 - Flags: review?(bas.schouten) → review+
Whiteboard: [needs landing]
Whiteboard: [needs landing] → [needs landing][not-ready-for-cedar]
http://hg.mozilla.org/mozilla-central/rev/2622ae93dfe8
http://hg.mozilla.org/mozilla-central/rev/c96c353c9d5e
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [needs landing][not-ready-for-cedar]
Verified with  Mozilla/5.0 (Windows NT 6.1; rv:2.2a1pre) Gecko/20110404 Firefox/4.2a1pre
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: