Bug 92187

Summary: ASSERTION FAILED: !rect.isEmpty() : void WebCore::GraphicsContext::drawRect(const WebCore::IntRect &)
Product: WebKit Reporter: Dimitris Apostolou <dimitris.apostolou>
Component: WebCore JavaScriptAssignee: Julien Chaffraix <jchaffraix>
Status: CLOSED FIXED    
Severity: Normal CC: eric, jchaffraix, mitz, simon.fraser, webkit-bug-importer, webkit.review.bot
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac (Intel)   
OS: Other   
URL: http://www.yahoo.com
Attachments:
Description Flags
Proposed change. Add an |height| check too.
none
Proposed change v2: Renamed the variable and fixed another potential issue found by code inspection. none

Description Dimitris Apostolou 2012-07-24 17:53:26 PDT
r123549

Reproducibility: always

Steps:
http://www.yahoo.com

What happened:
ASSERTION FAILED: !rect.isEmpty()
/Users/rex/WebKit/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp(381) : void WebCore::GraphicsContext::drawRect(const WebCore::IntRect &)
1   0x1069a9350 WebCore::GraphicsContext::drawRect(WebCore::IntRect const&)
2   0x10750f722 WebCore::RenderObject::drawLineForBoxSide(WebCore::GraphicsContext*, int, int, int, int, WebCore::BoxSide, WebCore::Color, WebCore::EBorderStyle, int, int, bool)
3   0x1074355ca WebCore::RenderBoxModelObject::paintOneBorderSide(WebCore::GraphicsContext*, WebCore::RenderStyle const*, WebCore::RoundedRect const&, WebCore::RoundedRect const&, WebCore::IntRect const&, WebCore::BoxSide, WebCore::BoxSide, WebCore::BoxSide, WebCore::BorderEdge const*, WebCore::Path const*, WebCore::BackgroundBleedAvoidance, bool, bool, bool, WebCore::Color const*)
4   0x1074379a4 WebCore::RenderBoxModelObject::paintBorderSides(WebCore::GraphicsContext*, WebCore::RenderStyle const*, WebCore::RoundedRect const&, WebCore::RoundedRect const&, WebCore::BorderEdge const*, unsigned int, WebCore::BackgroundBleedAvoidance, bool, bool, bool, WebCore::Color const*)
5   0x107438d49 WebCore::RenderBoxModelObject::paintBorder(WebCore::PaintInfo const&, WebCore::FractionalLayoutRect const&, WebCore::RenderStyle const*, WebCore::BackgroundBleedAvoidance, bool, bool)
6   0x107410a4b WebCore::RenderBox::paintBoxDecorations(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&)
7   0x1073ac699 WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&)
8   0x1073a9c93 WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&)
9   0x1073ac118 WebCore::RenderBlock::paintChild(WebCore::RenderBox*, WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&, WebCore::PaintInfo&, bool)
10  0x1073abd97 WebCore::RenderBlock::paintChildren(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&, WebCore::PaintInfo&, bool)
11  0x1073abd1a WebCore::RenderBlock::paintContents(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&)
12  0x1073ac8a4 WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&)
13  0x1073a9c93 WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::FractionalLayoutPoint const&)
14  0x1074ac349 WebCore::RenderLayer::paintLayerContents(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::FractionalLayoutRect const&, unsigned int, WebCore::RenderObject*, WebCore::RenderRegion*, WTF::HashMap<WebCore::OverlapTestRequestClient*, WebCore::IntRect, WTF::PtrHash<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::IntRect> >*, unsigned int)
15  0x1074ab957 WebCore::RenderLayer::paintLayerContentsAndReflection(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::FractionalLayoutRect const&, unsigned int, WebCore::RenderObject*, WebCore::RenderRegion*, WTF::HashMap<WebCore::OverlapTestRequestClient*, WebCore::IntRect, WTF::PtrHash<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::IntRect> >*, unsigned int)
16  0x1074aafe8 WebCore::RenderLayer::paintLayer(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::FractionalLayoutRect const&, unsigned int, WebCore::RenderObject*, WebCore::RenderRegion*, WTF::HashMap<WebCore::OverlapTestRequestClient*, WebCore::IntRect, WTF::PtrHash<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::IntRect> >*, unsigned int)
17  0x1074ad348 WebCore::RenderLayer::paintList(WTF::Vector<WebCore::RenderLayer*, 0ul>*, WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::FractionalLayoutRect const&, unsigned int, WebCore::RenderObject*, WebCore::RenderRegion*, WTF::HashMap<WebCore::OverlapTestRequestClient*, WebCore::IntRect, WTF::PtrHash<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::IntRect> >*, unsigned int)
18  0x1074ac659 WebCore::RenderLayer::paintLayerContents(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::FractionalLayoutRect const&, unsigned int, WebCore::RenderObject*, WebCore::RenderRegion*, WTF::HashMap<WebCore::OverlapTestRequestClient*, WebCore::IntRect, WTF::PtrHash<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::IntRect> >*, unsigned int)
19  0x1074ab957 WebCore::RenderLayer::paintLayerContentsAndReflection(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::FractionalLayoutRect const&, unsigned int, WebCore::RenderObject*, WebCore::RenderRegion*, WTF::HashMap<WebCore::OverlapTestRequestClient*, WebCore::IntRect, WTF::PtrHash<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::IntRect> >*, unsigned int)
20  0x1074aafe8 WebCore::RenderLayer::paintLayer(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::FractionalLayoutRect const&, unsigned int, WebCore::RenderObject*, WebCore::RenderRegion*, WTF::HashMap<WebCore::OverlapTestRequestClient*, WebCore::IntRect, WTF::PtrHash<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::IntRect> >*, unsigned int)
21  0x1074ad348 WebCore::RenderLayer::paintList(WTF::Vector<WebCore::RenderLayer*, 0ul>*, WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::FractionalLayoutRect const&, unsigned int, WebCore::RenderObject*, WebCore::RenderRegion*, WTF::HashMap<WebCore::OverlapTestRequestClient*, WebCore::IntRect, WTF::PtrHash<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::IntRect> >*, unsigned int)
22  0x1074ac659 WebCore::RenderLayer::paintLayerContents(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::FractionalLayoutRect const&, unsigned int, WebCore::RenderObject*, WebCore::RenderRegion*, WTF::HashMap<WebCore::OverlapTestRequestClient*, WebCore::IntRect, WTF::PtrHash<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::OverlapTestRequestClient*>, WTF::HashTraits<WebCore::IntRect> >*, unsigned int)
23  0x1074c8bca WebCore::RenderLayerBacking::paintIntoLayer(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::IntRect const&, unsigned int, WebCore::GraphicsLayerPaintingPhase, WebCore::RenderObject*)
24  0x1074c8e84 WebCore::RenderLayerBacking::paintContents(WebCore::GraphicsLayer const*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, WebCore::IntRect const&)
25  0x1069b5420 WebCore::GraphicsLayer::paintGraphicsLayerContents(WebCore::GraphicsContext&, WebCore::IntRect const&)
26  0x1069bd8a0 WebCore::GraphicsLayerCA::platformCALayerPaintContents(WebCore::GraphicsContext&, WebCore::IntRect const&)
27  0x1069bd8e7 non-virtual thunk to WebCore::GraphicsLayerCA::platformCALayerPaintContents(WebCore::GraphicsContext&, WebCore::IntRect const&)
28  0x107a6acb7 __drawLayerContents_block_invoke_0
29  0x1048cb24b WKCALayerEnumerateRectsBeingDrawnWithBlock
30  0x107a6a54c drawLayerContents(CGContext*, CALayer*, WebCore::PlatformCALayer*)
31  0x1079c9e4b WebCore::TileCache::drawLayer(WebTileLayer*, CGContext*)

Expected result:
No assert failure.
Comment 1 Simon Fraser (smfr) 2012-07-26 11:50:17 PDT
Is this a regression from http://trac.webkit.org/changeset/123061 ?
Comment 2 Julien Chaffraix 2012-07-26 12:00:20 PDT
(In reply to comment #1)
> Is this a regression from http://trac.webkit.org/changeset/123061 ?

Yes, this change added the ASSERT but it means we were already doing something unneeded.
Comment 3 Simon Fraser (smfr) 2012-07-27 10:47:17 PDT
<rdar://problem/11909631>
Comment 4 Julien Chaffraix 2012-07-27 11:40:13 PDT
Created attachment 154999 [details]
Proposed change. Add an |height| check too.
Comment 5 Simon Fraser (smfr) 2012-07-27 11:51:10 PDT
Comment on attachment 154999 [details]
Proposed change. Add an |height| check too.

View in context: https://bugs.webkit.org/attachment.cgi?id=154999&action=review

> Source/WebCore/rendering/RenderObject.cpp:838
> +    int width = side == BSTop || side == BSBottom ? y2 - y1 : x2 - x1;
> +    int height = side == BSTop || side == BSBottom ? x2 - x1 : y2 - y1;

width and height are confusing here. Maybe rename 'width' to 'thickness', and 'height' to 'length'?

Maybe also use if (top or bottom) { thickness = ; height = } to make it more clear.
Comment 6 Julien Chaffraix 2012-07-27 15:47:26 PDT
Created attachment 155072 [details]
Proposed change v2: Renamed the variable and fixed another potential issue found by code inspection.
Comment 7 WebKit Review Bot 2012-07-30 10:24:30 PDT
Comment on attachment 155072 [details]
Proposed change v2: Renamed the variable and fixed another potential issue found by code inspection.

Clearing flags on attachment: 155072

Committed r124044: <http://trac.webkit.org/changeset/124044>
Comment 8 WebKit Review Bot 2012-07-30 10:24:34 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Dimitris Apostolou 2012-07-30 13:25:39 PDT
Verified with r124045