Bug 140477

Summary: RenderLayerCompositor: Strange comparison of opacity to boolean.
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: Layout and RenderingAssignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, commit-queue, dino, esprehn+autocc, glenn, kondapallykalyan, simon.fraser, thorton
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 138448    
Bug Blocks:    
Attachments:
Description Flags
Patch simon.fraser: review+

Brent Fulgham
Reported 2015-01-14 16:23:47 PST
I receive the following warning when I build. Reviewing the line in question reveals that we are comparing a boolean (the return value of "ancestorBacking->graphicsLayer->drawsContents()") to the float returned by the style's opacity property. This seems very strange. At the very least, we should do some casting here to make it clear that this is intentional (if it is). if (newStyle.opacity() != ancestorBacking->graphicsLayer()->drawsContent()) return true; Where: opacity is a float drawsContent is a boolean.
Attachments
Patch (1.56 KB, patch)
2015-01-15 14:56 PST, Brent Fulgham
simon.fraser: review+
Brent Fulgham
Comment 1 2015-01-14 16:28:12 PST
Based on Bug 138448, it looks like this was an intentional comparison, but I think a cast would make it clear that this is desired behavior.
Simon Fraser (smfr)
Comment 2 2015-01-14 16:35:57 PST
Agreed it's odd. Would be fine to clarify.
Brent Fulgham
Comment 3 2015-01-14 16:40:54 PST
I neglected to include the compiler error: 18>c:\projects\webkit\opensource\source\webcore\rendering\RenderLayerCompositor.cpp(888): warning C4805: '!=' : unsafe mix of type 'float' and type 'bool' in operation (..\rendering\RenderingAllInOne.cpp)
Brent Fulgham
Comment 4 2015-01-15 08:40:08 PST
This code is checking for non-zero opacity.
Brent Fulgham
Comment 5 2015-01-15 14:56:37 PST
Brent Fulgham
Comment 6 2015-01-15 18:18:37 PST
Note You need to log in before you can comment on or make changes to this bug.