Bug 23090

Summary: Redraw issue with width and opacity change
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: Layout and RenderingAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: hyatt, mitz
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
Testcase
none
Patch, testcase, changelog
none
Improved patch darin: review+

Simon Fraser (smfr)
Reported 2009-01-03 10:49:24 PST
The attached testcase shows that a block with width and opacity changing at the same time shows a redraw issue which leaves an area where the element used to be un-repainted.
Attachments
Testcase (732 bytes, text/html)
2009-01-03 10:50 PST, Simon Fraser (smfr)
no flags
Patch, testcase, changelog (6.07 KB, patch)
2009-01-03 12:20 PST, Simon Fraser (smfr)
no flags
Improved patch (6.07 KB, patch)
2009-01-03 19:11 PST, Simon Fraser (smfr)
darin: review+
Simon Fraser (smfr)
Comment 1 2009-01-03 10:50:44 PST
Created attachment 26392 [details] Testcase
Simon Fraser (smfr)
Comment 2 2009-01-03 10:51:48 PST
Seems to be an issue only when the element toggles between having a layer (opacity < 1) and no layer (opacity == 1).
Simon Fraser (smfr)
Comment 3 2009-01-03 12:20:06 PST
Created attachment 26393 [details] Patch, testcase, changelog
Darin Adler
Comment 4 2009-01-03 18:39:53 PST
Comment on attachment 26393 [details] Patch, testcase, changelog > + } else if (m_style->hasTransform() != newStyle->hasTransform() || > + m_style->hasOpacity() != newStyle->hasOpacity()) { > + // If we don't have a layer yet, but we are going to get one because of a transform or opacity change, then > // we need to repaint the old position of the object The comment is right, but the code is wrong. This will decide to repaint something that already has a layer if its opacity is going to change. Can we do a better check that gets this right? We want to repaint if "gets own layer" is going to change, so that's what we should be checking.
Simon Fraser (smfr)
Comment 5 2009-01-03 19:03:11 PST
(In reply to comment #4) > (From update of attachment 26393 [details] [review]) > > + } else if (m_style->hasTransform() != newStyle->hasTransform() || > > + m_style->hasOpacity() != newStyle->hasOpacity()) { > > + // If we don't have a layer yet, but we are going to get one because of a transform or opacity change, then > > // we need to repaint the old position of the object > > The comment is right, but the code is wrong. This will decide to repaint > something that already has a layer if its opacity is going to change. Can we do > a better check that gets this right? We want to repaint if "gets own layer" is > going to change, so that's what we should be checking. This is in a !hasLayer() clause, so it will actually do the right thing. However, I will tidy up the logic.
Simon Fraser (smfr)
Comment 6 2009-01-03 19:11:16 PST
Created attachment 26400 [details] Improved patch
Darin Adler
Comment 7 2009-01-03 20:44:11 PST
Comment on attachment 26400 [details] Improved patch > + bool hasOpacity() const { return rareNonInheritedData->opacity < 1; } I'm not a huge fan of this name for the function. What this function means is that you have non-standard opacity, non-opaque opacity. It says nothing about whether you have any CSS opacity rules, for example. You could have one saying opacity: 1. But the real problem is it doesn't make sense to say that a fully opaque object with an opacity of "1" does not have opacity. I'd suggest just saying opacity() < 1 at the call site, or coming up with a better name for this helper function. r=me with or without a change to that
Simon Fraser (smfr)
Comment 8 2009-01-04 10:40:06 PST
I changed it to test opacity() < 1 at the call site. Committing to http://svn.webkit.org/repository/webkit/trunk ... M LayoutTests/ChangeLog A LayoutTests/fast/repaint/create-layer-repaint.html A LayoutTests/platform/mac/fast/repaint/create-layer-repaint-expected.checksum A LayoutTests/platform/mac/fast/repaint/create-layer-repaint-expected.png A LayoutTests/platform/mac/fast/repaint/create-layer-repaint-expected.txt M WebCore/ChangeLog M WebCore/rendering/RenderObject.cpp Committed r39588
Note You need to log in before you can comment on or make changes to this bug.