Changeset 87006 in webkit


Ignore:
Timestamp:
May 20, 2011 5:52:40 PM (13 years ago)
Author:
jchaffraix@webkit.org
Message:

2011-05-20 Kulanthaivel Palanichamy <kulanthaivel@codeaurora.org>

Reviewed by Simon Fraser.

If both border-radius and box-shadow applied, shadow is not fully visible
https://bugs.webkit.org/show_bug.cgi?id=59577

  • fast/css/box-shadow-and-border-radius.html: Added.
  • platform/qt/fast/css/box-shadow-and-border-radius-expected.png: Added.
  • platform/qt/fast/css/box-shadow-and-border-radius-expected.txt: Added.
  • platform/win/fast/css/box-shadow-and-border-radius-expected.png: Added.
  • platform/win/fast/css/box-shadow-and-border-radius-expected.txt: Added.

2011-05-20 Kulanthaivel Palanichamy <kulanthaivel@codeaurora.org>

Reviewed by Simon Fraser.

If both border-radius and box-shadow applied, shadow is not fully visible
https://bugs.webkit.org/show_bug.cgi?id=59577

The current implementation of RoundedIntRect::inflateWithRadii() inflates
its rect size and corner radii out of sync. This leads to validation failure in
Path::addRoundedRect() and results in ignoring radii in the path.
When this invalid path is used to clip out the rounded corner box before painting
the box shadow, the entire rectangle is clipped out without the corner radii.

This patch implements RoundedIntRect::inflateWithRadii() properly to inflate
rounded rect radii based on inflate ratios of rect size.

Test: fast/css/box-shadow-and-border-radius.html

  • platform/graphics/RoundedIntRect.cpp: (WebCore::RoundedIntRect::inflateWithRadii):
  • platform/graphics/RoundedIntRect.h:
Location:
trunk
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r87004 r87006  
     12011-05-20  Kulanthaivel Palanichamy  <kulanthaivel@codeaurora.org>
     2
     3        Reviewed by Simon Fraser.
     4
     5        If both border-radius and box-shadow applied, shadow is not fully visible
     6        https://bugs.webkit.org/show_bug.cgi?id=59577
     7
     8        * fast/css/box-shadow-and-border-radius.html: Added.
     9        * platform/qt/fast/css/box-shadow-and-border-radius-expected.png: Added.
     10        * platform/qt/fast/css/box-shadow-and-border-radius-expected.txt: Added.
     11        * platform/win/fast/css/box-shadow-and-border-radius-expected.png: Added.
     12        * platform/win/fast/css/box-shadow-and-border-radius-expected.txt: Added.
     13
    1142011-05-20  Kenneth Russell  <kbr@google.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r87001 r87006  
     12011-05-20  Kulanthaivel Palanichamy  <kulanthaivel@codeaurora.org>
     2
     3        Reviewed by Simon Fraser.
     4
     5        If both border-radius and box-shadow applied, shadow is not fully visible
     6        https://bugs.webkit.org/show_bug.cgi?id=59577
     7
     8        The current implementation of RoundedIntRect::inflateWithRadii() inflates
     9        its rect size and corner radii out of sync. This leads to validation failure in
     10        Path::addRoundedRect() and results in ignoring radii in the path.
     11        When this invalid path is used to clip out the rounded corner box before painting
     12        the box shadow, the entire rectangle is clipped out without the corner radii.
     13
     14        This patch implements RoundedIntRect::inflateWithRadii() properly to inflate
     15        rounded rect radii based on inflate ratios of rect size.
     16
     17        Test: fast/css/box-shadow-and-border-radius.html
     18
     19        * platform/graphics/RoundedIntRect.cpp:
     20        (WebCore::RoundedIntRect::inflateWithRadii):
     21        * platform/graphics/RoundedIntRect.h:
     22
    1232011-05-20  Michael Nordman  <michaeln@google.com>
    224
  • trunk/Source/WebCore/platform/graphics/RoundedIntRect.cpp

    r84273 r87006  
    7676}
    7777
     78void RoundedIntRect::inflateWithRadii(int size)
     79{
     80    IntRect old = m_rect;
     81
     82    m_rect.inflate(size);
     83    // Considering the inflation factor of shorter size to scale the radii seems appropriate here
     84    float factor;
     85    if (m_rect.width() < m_rect.height())
     86        factor = old.width() ? (float)m_rect.width() / old.width() : 0;
     87    else
     88        factor = old.height() ? (float)m_rect.height() / old.height() : 0;
     89
     90    m_radii.scale(factor);
     91}
     92
    7893void RoundedIntRect::Radii::includeLogicalEdges(const RoundedIntRect::Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
    7994{
  • trunk/Source/WebCore/platform/graphics/RoundedIntRect.h

    r84273 r87006  
    8787    void move(const IntSize& size) { m_rect.move(size); }
    8888    void inflate(int size) { m_rect.inflate(size);  }
    89     void inflateWithRadii(int size) { m_rect.inflate(size); m_radii.expand(size); }
     89    void inflateWithRadii(int size);
    9090    void expandRadii(int size) { m_radii.expand(size); }
    9191    void shrinkRadii(int size) { m_radii.shrink(size); }
Note: See TracChangeset for help on using the changeset viewer.