On Jun 27, 2011, at 1:55 AM, Simon Fraser wrote:

> This should go into a bug.

Agreed.

> On Jun 26, 2011, at 4:12 PM, Brent Fulgham wrote:
> 
>> While investigating a separate issue, I noticed that I was hitting an 
>> assertion in the Cairo drawing layer because it was attempting to use an 
>> invalid HBITMAP created in the WebNodeHighlight::update method.  The 
>> underlying issue was that the CreateDIBSection function was failing, because 
>> it was being requested to create a section of zero height.
>> 
>> I think the following change would be safe for the CoreGraphics and Cairo 
>> ports, but wanted to see if anyone knew of a reason why it would be bad to 
>> exit early in the case of a zero height (or zero width) paint region.
>> 
>> $ svn diff
>> Index: win/WebNodeHighlight.cpp
>> ===================================================================
>> --- win/WebNodeHighlight.cpp    (revision 89759)
>> +++ win/WebNodeHighlight.cpp    (working copy)
>> @@ -145,10 +145,14 @@
>>    size.cx = webViewRect.right - webViewRect.left;
>>    size.cy = webViewRect.bottom - webViewRect.top;
>> 
>> +    if (!size.cx || !size.cy)
>> +        return;
>> +
>>    BitmapInfo bitmapInfo = BitmapInfo::createBottomUp(IntSize(size));
>> 
>>    void* pixels = 0;
>>    OwnPtr<HBITMAP> hbmp = adoptPtr(::CreateDIBSection(hdc, &bitmapInfo, 
>> DIB_RG
>> B_COLORS, &pixels, 0, 0));
>> +    ASSERT_WITH_MESSAGE(hbmp.get(), "::CreateDIBSection failed with error 
>> %lu",
>> ::GetLastError());
>> 
>>    ::SelectObject(hdc, hbmp.get());

I don't see any reason why this would be bad.

-Adam

_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to