Bug 64584 - Avoid rounded rect corner-drawing overhead if no corners are visible
Summary: Avoid rounded rect corner-drawing overhead if no corners are visible
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh Intel OS X 10.6
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-14 23:21 PDT by Ian Henderson
Modified: 2011-07-15 12:27 PDT (History)
2 users (show)

See Also:


Attachments
proposed patch (9.96 KB, patch)
2011-07-14 23:31 PDT, Ian Henderson
simon.fraser: review-
simon.fraser: commit-queue-
Details | Formatted Diff | Diff
test case (465 bytes, text/html)
2011-07-15 11:14 PDT, Ian Henderson
no flags Details
updated patch (10.32 KB, patch)
2011-07-15 11:25 PDT, Ian Henderson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Henderson 2011-07-14 23:21:19 PDT
We fall into a slow path when drawing a border for an element with nonzero border-radius.  If the rounded corners are outside the clip rect, however, we can set their radius to zero without visual effect.
Comment 1 Ian Henderson 2011-07-14 23:31:56 PDT
Created attachment 100939 [details]
proposed patch
Comment 2 Ian Henderson 2011-07-15 00:02:55 PDT
<rdar://problem/9326550>
Comment 3 Simon Fraser (smfr) 2011-07-15 08:31:03 PDT
Comment on attachment 100939 [details]
proposed patch

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

Let's see one more version. I'd also like to see an interactive testcase attached to the bug (maybe a roundrect inside a scrollable overflow region) so that behavior can be checked manually.

> Source/WebCore/ChangeLog:8
> +        No new tests, behavior is unaffected.

Well, behavior is affected, but not in a way that should affect visible rendering.

> Source/WebCore/rendering/RenderBoxModelObject.cpp:1425
> +    // If one of the corners falls outside the clip region, pretend it has no radius.

The comment should mention that this is done for performance reasons.

> Source/WebCore/rendering/RenderBoxModelObject.cpp:1450
> +        outerBorder.setRadii(adjustedOuterRadii);

You could avoid setting this if you didn't change any corners. I think you should also skip this entire block if rect is entirely inside the clip.
Comment 4 Ian Henderson 2011-07-15 11:14:01 PDT
Created attachment 101007 [details]
test case

Here's a test case—normal, dotted, and dashed borders with positive border-radius in overflow: scroll divs.
Comment 5 Ian Henderson 2011-07-15 11:25:27 PDT
Created attachment 101011 [details]
updated patch

Addressed Simon's comments and moved the corner-adjusting code into a separate static function.
Comment 6 Simon Fraser (smfr) 2011-07-15 11:31:08 PDT
Comment on attachment 101011 [details]
updated patch

Nice.
Comment 7 WebKit Review Bot 2011-07-15 12:27:43 PDT
Comment on attachment 101011 [details]
updated patch

Clearing flags on attachment: 101011

Committed r91090: <http://trac.webkit.org/changeset/91090>
Comment 8 WebKit Review Bot 2011-07-15 12:27:48 PDT
All reviewed patches have been landed.  Closing bug.