Closed Bug 1008787 Opened 11 years ago Closed 11 years ago

Plugins should be clipped to the size layout expects them to be

Categories

(Core :: Layout, defect)

x86_64
Windows 8.1
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: bas.schouten, Assigned: bas.schouten)

Details

Attachments

(1 file, 3 obsolete files)

Plugins should be clipped to the size we expect their image to be. If we don't do this then a plugin with it's size asynchronously updating could display outside the bounds where layout expects it to be.
Attachment #8420731 - Flags: review?(matt.woodrow)
Updated to make GetLeafLayerFor work as advertised.
Attachment #8420731 - Attachment is obsolete: true
Attachment #8420731 - Flags: review?(matt.woodrow)
Attachment #8420746 - Flags: review?(roc)
Correct usage of nsIntRect::Intersect().
Attachment #8420746 - Attachment is obsolete: true
Attachment #8420746 - Flags: review?(roc)
Attachment #8420747 - Flags: review?(roc)
Comment on attachment 8420747 [details] [diff] [review] Clip plugins to their expected content size v3 Review of attachment 8420747 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/generic/nsObjectFrame.cpp @@ +1617,5 @@ > layer->SetBaseTransform(Matrix4x4::From2D(transform)); > layer->SetVisibleRegion(ThebesIntRect(IntRect(IntPoint(0, 0), size))); > + > + nsIntRect clipRect(p.x, p.y, size.width, size.height); > + layer->SetClipRect(&clipRect); It would be cleaner to just put this clip rect on the display item, then we wouldn't have to change FrameLayerBuilder. I'm pretty sure that's doable in nsObjectFrame::BuildDisplayList. Maybe we just need to remove DisplayListClipState::ASSUME_DRAWING_RESTRICTED_TO_CONTENT_RECT from DisplayListClipState::AutoClipContainingBlockDescendantsToContentBox there?
Attachment #8420747 - Flags: review?(roc) → review+
Comment on attachment 8420747 [details] [diff] [review] Clip plugins to their expected content size v3 Review of attachment 8420747 [details] [diff] [review]: ----------------------------------------------------------------- Sorry, didn't mean to r+ that
Attachment #8420747 - Flags: review+ → review-
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #3) > Comment on attachment 8420747 [details] [diff] [review] > Clip plugins to their expected content size v3 > > Review of attachment 8420747 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: layout/generic/nsObjectFrame.cpp > @@ +1617,5 @@ > > layer->SetBaseTransform(Matrix4x4::From2D(transform)); > > layer->SetVisibleRegion(ThebesIntRect(IntRect(IntPoint(0, 0), size))); > > + > > + nsIntRect clipRect(p.x, p.y, size.width, size.height); > > + layer->SetClipRect(&clipRect); > > It would be cleaner to just put this clip rect on the display item, then we > wouldn't have to change FrameLayerBuilder. I'm pretty sure that's doable in > nsObjectFrame::BuildDisplayList. Maybe we just need to remove > DisplayListClipState::ASSUME_DRAWING_RESTRICTED_TO_CONTENT_RECT from > DisplayListClipState::AutoClipContainingBlockDescendantsToContentBox there? Could be.. I'm all in favor, I just don't know any of this code so I merely did whatever it took to fix the bug :-). Fwiw, I found out GetOldLayer didn't clear the clipRect either so that at least would need fixing.
Attached patch Clip pluginsSplinter Review
I can't reproduce the failure locally, but confirmed that this clips the ImageLayer to the expected size of the plugin.
Attachment #8421447 - Flags: review?(roc)
Attachment #8420747 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: