Changeset 248743 in webkit


Ignore:
Timestamp:
Aug 15, 2019 1:49:56 PM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r248722. rdar://problem/54360866

Negative size box with border radius causes hang under WebCore::approximateAsRegion
https://bugs.webkit.org/show_bug.cgi?id=200769
<rdar://problem/53380674>

Reviewed by Alex Christensen.

Source/WebCore:

If a box's width or height computes negative the rounded border rect will also be negative.
This caused near-infinite loop during rounded border region approximation.

Test: fast/css/border-radius-negative-size.html

  • platform/graphics/RoundedRect.cpp: (WebCore::approximateAsRegion):

Bail out if the region is empty (which includes negative sizes).
For safety also limit the number of rectangles we generate for corner arc approximation.

LayoutTests:

  • fast/css/border-radius-negative-size-expected.txt: Added.
  • fast/css/border-radius-negative-size.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248722 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-608-branch
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-608-branch/LayoutTests/ChangeLog

    r248724 r248743  
     12019-08-15  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r248722. rdar://problem/54360866
     4
     5    Negative size box with border radius causes hang under WebCore::approximateAsRegion
     6    https://bugs.webkit.org/show_bug.cgi?id=200769
     7    <rdar://problem/53380674>
     8   
     9    Reviewed by Alex Christensen.
     10   
     11    Source/WebCore:
     12   
     13    If a box's width or height computes negative the rounded border rect will also be negative.
     14    This caused near-infinite loop during rounded border region approximation.
     15   
     16    Test: fast/css/border-radius-negative-size.html
     17   
     18    * platform/graphics/RoundedRect.cpp:
     19    (WebCore::approximateAsRegion):
     20   
     21    Bail out if the region is empty (which includes negative sizes).
     22    For safety also limit the number of rectangles we generate for corner arc approximation.
     23   
     24    LayoutTests:
     25   
     26    * fast/css/border-radius-negative-size-expected.txt: Added.
     27    * fast/css/border-radius-negative-size.html: Added.
     28   
     29   
     30    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248722 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     31
     32    2019-08-15  Antti Koivisto  <antti@apple.com>
     33
     34            Negative size box with border radius causes hang under WebCore::approximateAsRegion
     35            https://bugs.webkit.org/show_bug.cgi?id=200769
     36            <rdar://problem/53380674>
     37
     38            Reviewed by Alex Christensen.
     39
     40            * fast/css/border-radius-negative-size-expected.txt: Added.
     41            * fast/css/border-radius-negative-size.html: Added.
     42
    1432019-08-15  Alan Coon  <alancoon@apple.com>
    244
  • branches/safari-608-branch/Source/WebCore/ChangeLog

    r248723 r248743  
     12019-08-15  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r248722. rdar://problem/54360866
     4
     5    Negative size box with border radius causes hang under WebCore::approximateAsRegion
     6    https://bugs.webkit.org/show_bug.cgi?id=200769
     7    <rdar://problem/53380674>
     8   
     9    Reviewed by Alex Christensen.
     10   
     11    Source/WebCore:
     12   
     13    If a box's width or height computes negative the rounded border rect will also be negative.
     14    This caused near-infinite loop during rounded border region approximation.
     15   
     16    Test: fast/css/border-radius-negative-size.html
     17   
     18    * platform/graphics/RoundedRect.cpp:
     19    (WebCore::approximateAsRegion):
     20   
     21    Bail out if the region is empty (which includes negative sizes).
     22    For safety also limit the number of rectangles we generate for corner arc approximation.
     23   
     24    LayoutTests:
     25   
     26    * fast/css/border-radius-negative-size-expected.txt: Added.
     27    * fast/css/border-radius-negative-size.html: Added.
     28   
     29   
     30    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248722 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     31
     32    2019-08-15  Antti Koivisto  <antti@apple.com>
     33
     34            Negative size box with border radius causes hang under WebCore::approximateAsRegion
     35            https://bugs.webkit.org/show_bug.cgi?id=200769
     36            <rdar://problem/53380674>
     37
     38            Reviewed by Alex Christensen.
     39
     40            If a box's width or height computes negative the rounded border rect will also be negative.
     41            This caused near-infinite loop during rounded border region approximation.
     42
     43            Test: fast/css/border-radius-negative-size.html
     44
     45            * platform/graphics/RoundedRect.cpp:
     46            (WebCore::approximateAsRegion):
     47
     48            Bail out if the region is empty (which includes negative sizes).
     49            For safety also limit the number of rectangles we generate for corner arc approximation.
     50
    1512019-08-15  Alan Coon  <alancoon@apple.com>
    252
  • branches/safari-608-branch/Source/WebCore/platform/graphics/RoundedRect.cpp

    r243680 r248743  
    311311    Region region;
    312312
     313    if (roundedRect.isEmpty())
     314        return region;
     315
    313316    auto& rect = roundedRect.rect();
    314317    region.unite(enclosingIntRect(rect));
     
    333336        auto count = (arcLengthFactor + (stepLength / 2)) / stepLength;
    334337
     338        constexpr auto maximumCount = 20u;
     339        count = std::min(maximumCount, count);
     340
    335341        for (auto i = 0u; i < count; ++i) {
    336342            auto angle = fromAngle + (i + 1) * (toAngle - fromAngle) / (count + 1);
Note: See TracChangeset for help on using the changeset viewer.