Changeset 163156 in webkit


Ignore:
Timestamp:
Jan 30, 2014 9:41:46 PM (10 years ago)
Author:
Alan Bujtas
Message:

Subpixel rendering: Make RoundedRect layout unit aware.
https://bugs.webkit.org/show_bug.cgi?id=127779

Reviewed by Simon Fraser.

In order to draw hairline borders, RoundedRect needs to be
LayoutUnit based.

No change in behavior.

  • platform/graphics/GraphicsContext.cpp:

(WebCore::GraphicsContext::fillRoundedRect):

  • platform/graphics/GraphicsContext.h:
  • platform/graphics/RoundedRect.cpp:

(WebCore::RoundedRect::Radii::scale):
(WebCore::RoundedRect::Radii::expand):
(WebCore::RoundedRect::inflateWithRadii):
(WebCore::RoundedRect::RoundedRect):
(WebCore::RoundedRect::intersectsQuad):

  • platform/graphics/RoundedRect.h:

(WebCore::RoundedRect::Radii::Radii):
(WebCore::RoundedRect::Radii::setTopLeft):
(WebCore::RoundedRect::Radii::setTopRight):
(WebCore::RoundedRect::Radii::setBottomLeft):
(WebCore::RoundedRect::Radii::setBottomRight):
(WebCore::RoundedRect::Radii::topLeft):
(WebCore::RoundedRect::Radii::topRight):
(WebCore::RoundedRect::Radii::bottomLeft):
(WebCore::RoundedRect::Radii::bottomRight):
(WebCore::RoundedRect::Radii::expand):
(WebCore::RoundedRect::Radii::shrink):
(WebCore::RoundedRect::rect):
(WebCore::RoundedRect::setRect):
(WebCore::RoundedRect::move):
(WebCore::RoundedRect::inflate):
(WebCore::RoundedRect::expandRadii):
(WebCore::RoundedRect::shrinkRadii):

  • platform/graphics/ShadowBlur.cpp:

(WebCore::ScratchBuffer::setCachedShadowValues):
(WebCore::ScratchBuffer::setCachedInsetShadowValues):
(WebCore::computeSliceSizesFromRadii):
(WebCore::ShadowBlur::templateSize):
(WebCore::ShadowBlur::drawRectShadow):
(WebCore::ShadowBlur::drawInsetShadow):
(WebCore::ShadowBlur::drawRectShadowWithoutTiling):
(WebCore::ShadowBlur::drawInsetShadowWithoutTiling):
(WebCore::ShadowBlur::drawInsetShadowWithTiling):
(WebCore::ShadowBlur::drawRectShadowWithTiling):
(WebCore::ShadowBlur::drawLayerPieces):
(WebCore::ShadowBlur::beginShadowLayer):

  • platform/graphics/ShadowBlur.h:
  • platform/graphics/cairo/GraphicsContextCairo.cpp:

(WebCore::GraphicsContext::clipOut):
(WebCore::GraphicsContext::fillRoundedRect):
(WebCore::GraphicsContext::fillRectWithRoundedHole):

  • platform/graphics/cg/GraphicsContextCG.cpp:

(WebCore::GraphicsContext::platformInit):

  • platform/graphics/wince/GraphicsContextWinCE.cpp:

(WebCore::GraphicsContext::clipOut):
(WebCore::GraphicsContext::fillRoundedRect):

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::paintOneBorderSide):
(WebCore::calculateSideRect):
(WebCore::RenderBoxModelObject::paintBorderSides):
(WebCore::RenderBoxModelObject::paintBorder):
(WebCore::RenderBoxModelObject::clipBorderSidePolygon):
(WebCore::calculateSideRectIncludingInner):
(WebCore::calculateAdjustedInnerBorder):
(WebCore::areaCastingShadowInHole):
(WebCore::RenderBoxModelObject::paintBoxShadow):

  • rendering/RenderBoxModelObject.h:
  • rendering/RenderThemeSafari.cpp:

(WebCore::RenderThemeSafari::paintMenuListButtonGradients):
(WebCore::RenderThemeSafari::paintSliderTrack):

Location:
trunk/Source/WebCore
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r163155 r163156  
     12014-01-30  Zalan Bujtas  <zalan@apple.com>
     2
     3        Subpixel rendering: Make RoundedRect layout unit aware.
     4        https://bugs.webkit.org/show_bug.cgi?id=127779
     5
     6        Reviewed by Simon Fraser.
     7
     8        In order to draw hairline borders, RoundedRect needs to be
     9        LayoutUnit based.
     10
     11        No change in behavior.
     12
     13        * platform/graphics/GraphicsContext.cpp:
     14        (WebCore::GraphicsContext::fillRoundedRect):
     15        * platform/graphics/GraphicsContext.h:
     16        * platform/graphics/RoundedRect.cpp:
     17        (WebCore::RoundedRect::Radii::scale):
     18        (WebCore::RoundedRect::Radii::expand):
     19        (WebCore::RoundedRect::inflateWithRadii):
     20        (WebCore::RoundedRect::RoundedRect):
     21        (WebCore::RoundedRect::intersectsQuad):
     22        * platform/graphics/RoundedRect.h:
     23        (WebCore::RoundedRect::Radii::Radii):
     24        (WebCore::RoundedRect::Radii::setTopLeft):
     25        (WebCore::RoundedRect::Radii::setTopRight):
     26        (WebCore::RoundedRect::Radii::setBottomLeft):
     27        (WebCore::RoundedRect::Radii::setBottomRight):
     28        (WebCore::RoundedRect::Radii::topLeft):
     29        (WebCore::RoundedRect::Radii::topRight):
     30        (WebCore::RoundedRect::Radii::bottomLeft):
     31        (WebCore::RoundedRect::Radii::bottomRight):
     32        (WebCore::RoundedRect::Radii::expand):
     33        (WebCore::RoundedRect::Radii::shrink):
     34        (WebCore::RoundedRect::rect):
     35        (WebCore::RoundedRect::setRect):
     36        (WebCore::RoundedRect::move):
     37        (WebCore::RoundedRect::inflate):
     38        (WebCore::RoundedRect::expandRadii):
     39        (WebCore::RoundedRect::shrinkRadii):
     40        * platform/graphics/ShadowBlur.cpp:
     41        (WebCore::ScratchBuffer::setCachedShadowValues):
     42        (WebCore::ScratchBuffer::setCachedInsetShadowValues):
     43        (WebCore::computeSliceSizesFromRadii):
     44        (WebCore::ShadowBlur::templateSize):
     45        (WebCore::ShadowBlur::drawRectShadow):
     46        (WebCore::ShadowBlur::drawInsetShadow):
     47        (WebCore::ShadowBlur::drawRectShadowWithoutTiling):
     48        (WebCore::ShadowBlur::drawInsetShadowWithoutTiling):
     49        (WebCore::ShadowBlur::drawInsetShadowWithTiling):
     50        (WebCore::ShadowBlur::drawRectShadowWithTiling):
     51        (WebCore::ShadowBlur::drawLayerPieces):
     52        (WebCore::ShadowBlur::beginShadowLayer):
     53        * platform/graphics/ShadowBlur.h:
     54        * platform/graphics/cairo/GraphicsContextCairo.cpp:
     55        (WebCore::GraphicsContext::clipOut):
     56        (WebCore::GraphicsContext::fillRoundedRect):
     57        (WebCore::GraphicsContext::fillRectWithRoundedHole):
     58        * platform/graphics/cg/GraphicsContextCG.cpp:
     59        (WebCore::GraphicsContext::platformInit):
     60        * platform/graphics/wince/GraphicsContextWinCE.cpp:
     61        (WebCore::GraphicsContext::clipOut):
     62        (WebCore::GraphicsContext::fillRoundedRect):
     63        * rendering/RenderBoxModelObject.cpp:
     64        (WebCore::RenderBoxModelObject::paintOneBorderSide):
     65        (WebCore::calculateSideRect):
     66        (WebCore::RenderBoxModelObject::paintBorderSides):
     67        (WebCore::RenderBoxModelObject::paintBorder):
     68        (WebCore::RenderBoxModelObject::clipBorderSidePolygon):
     69        (WebCore::calculateSideRectIncludingInner):
     70        (WebCore::calculateAdjustedInnerBorder):
     71        (WebCore::areaCastingShadowInHole):
     72        (WebCore::RenderBoxModelObject::paintBoxShadow):
     73        * rendering/RenderBoxModelObject.h:
     74        * rendering/RenderThemeSafari.cpp:
     75        (WebCore::RenderThemeSafari::paintMenuListButtonGradients):
     76        (WebCore::RenderThemeSafari::paintSliderTrack):
     77
    1782014-01-30  Martin Robinson  <mrobinson@igalia.com>
    279
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r161589 r163156  
    772772void GraphicsContext::fillRoundedRect(const RoundedRect& rect, const Color& color, ColorSpace colorSpace, BlendMode blendMode)
    773773{
    774 
    775774    if (rect.isRounded()) {
    776775        setCompositeOperation(compositeOperation(), blendMode);
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r162579 r163156  
    295295        void fillRect(const FloatRect&, Gradient&);
    296296        void fillRect(const FloatRect&, const Color&, ColorSpace, CompositeOperator, BlendMode = BlendModeNormal);
    297         void fillRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color&, ColorSpace);
     297        void fillRoundedRect(const FloatRect&, const FloatSize& topLeft, const FloatSize& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight, const Color&, ColorSpace);
    298298        void fillRoundedRect(const RoundedRect&, const Color&, ColorSpace, BlendMode = BlendModeNormal);
    299         void fillRectWithRoundedHole(const IntRect&, const RoundedRect& roundedHoleRect, const Color&, ColorSpace);
     299        void fillRectWithRoundedHole(const FloatRect&, const RoundedRect& roundedHoleRect, const Color&, ColorSpace);
    300300
    301301        void clearRect(const FloatRect&);
     
    333333        void clipRoundedRect(const FloatRect&, const FloatSize& topLeft, const FloatSize& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight);
    334334
    335         void clipOut(const IntRect&);
     335        void clipOut(const FloatRect&);
    336336        void clipOutRoundedRect(const RoundedRect&);
    337337        void clipPath(const Path&, WindRule);
  • trunk/Source/WebCore/platform/graphics/RoundedRect.cpp

    r159027 r163156  
    2929#include "RoundedRect.h"
    3030
     31#include "LayoutRect.h"
     32#include "LayoutUnit.h"
     33
    3134#include <algorithm>
    3235
     
    4649    m_topLeft.scale(factor);
    4750    if (!m_topLeft.width() || !m_topLeft.height())
    48         m_topLeft = IntSize();
     51        m_topLeft = LayoutSize();
    4952    m_topRight.scale(factor);
    5053    if (!m_topRight.width() || !m_topRight.height())
    51         m_topRight = IntSize();
     54        m_topRight = LayoutSize();
    5255    m_bottomLeft.scale(factor);
    5356    if (!m_bottomLeft.width() || !m_bottomLeft.height())
    54         m_bottomLeft = IntSize();
     57        m_bottomLeft = LayoutSize();
    5558    m_bottomRight.scale(factor);
    5659    if (!m_bottomRight.width() || !m_bottomRight.height())
    57         m_bottomRight = IntSize();
    58 
    59 }
    60 
    61 void RoundedRect::Radii::expand(int topWidth, int bottomWidth, int leftWidth, int rightWidth)
     60        m_bottomRight = LayoutSize();
     61
     62}
     63
     64void RoundedRect::Radii::expand(const LayoutUnit& topWidth, const LayoutUnit& bottomWidth, const LayoutUnit& leftWidth, const LayoutUnit& rightWidth)
    6265{
    6366    if (m_topLeft.width() > 0 && m_topLeft.height() > 0) {
    64         m_topLeft.setWidth(std::max<int>(0, m_topLeft.width() + leftWidth));
    65         m_topLeft.setHeight(std::max<int>(0, m_topLeft.height() + topWidth));
     67        m_topLeft.setWidth(std::max<LayoutUnit>(0, m_topLeft.width() + leftWidth));
     68        m_topLeft.setHeight(std::max<LayoutUnit>(0, m_topLeft.height() + topWidth));
    6669    }
    6770    if (m_topRight.width() > 0 && m_topRight.height() > 0) {
    68         m_topRight.setWidth(std::max<int>(0, m_topRight.width() + rightWidth));
    69         m_topRight.setHeight(std::max<int>(0, m_topRight.height() + topWidth));
     71        m_topRight.setWidth(std::max<LayoutUnit>(0, m_topRight.width() + rightWidth));
     72        m_topRight.setHeight(std::max<LayoutUnit>(0, m_topRight.height() + topWidth));
    7073    }
    7174    if (m_bottomLeft.width() > 0 && m_bottomLeft.height() > 0) {
    72         m_bottomLeft.setWidth(std::max<int>(0, m_bottomLeft.width() + leftWidth));
    73         m_bottomLeft.setHeight(std::max<int>(0, m_bottomLeft.height() + bottomWidth));
     75        m_bottomLeft.setWidth(std::max<LayoutUnit>(0, m_bottomLeft.width() + leftWidth));
     76        m_bottomLeft.setHeight(std::max<LayoutUnit>(0, m_bottomLeft.height() + bottomWidth));
    7477    }
    7578    if (m_bottomRight.width() > 0 && m_bottomRight.height() > 0) {
    76         m_bottomRight.setWidth(std::max<int>(0, m_bottomRight.width() + rightWidth));
    77         m_bottomRight.setHeight(std::max<int>(0, m_bottomRight.height() + bottomWidth));
    78     }
    79 }
    80 
    81 void RoundedRect::inflateWithRadii(int size)
    82 {
    83     IntRect old = m_rect;
     79        m_bottomRight.setWidth(std::max<LayoutUnit>(0, m_bottomRight.width() + rightWidth));
     80        m_bottomRight.setHeight(std::max<LayoutUnit>(0, m_bottomRight.height() + bottomWidth));
     81    }
     82}
     83
     84void RoundedRect::inflateWithRadii(const LayoutUnit& size)
     85{
     86    LayoutRect old = m_rect;
    8487
    8588    m_rect.inflate(size);
     
    132135}
    133136
    134 RoundedRect::RoundedRect(int x, int y, int width, int height)
     137RoundedRect::RoundedRect(const LayoutUnit& x, const LayoutUnit& y, const LayoutUnit& width, const LayoutUnit& height)
    135138    : m_rect(x, y, width, height)
    136139{
    137140}
    138141
    139 RoundedRect::RoundedRect(const IntRect& rect, const Radii& radii)
     142RoundedRect::RoundedRect(const LayoutRect& rect, const Radii& radii)
    140143    : m_rect(rect)
    141144    , m_radii(radii)
     
    143146}
    144147
    145 RoundedRect::RoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight)
     148RoundedRect::RoundedRect(const LayoutRect& rect, const LayoutSize& topLeft, const LayoutSize& topRight, const LayoutSize& bottomLeft, const LayoutSize& bottomRight)
    146149    : m_rect(rect)
    147150    , m_radii(topLeft, topRight, bottomLeft, bottomRight)
     
    187190        return false;
    188191
    189     const IntSize& topLeft = m_radii.topLeft();
     192    const LayoutSize& topLeft = m_radii.topLeft();
    190193    if (!topLeft.isEmpty()) {
    191194        FloatRect rect(m_rect.x(), m_rect.y(), topLeft.width(), topLeft.height());
     
    198201    }
    199202
    200     const IntSize& topRight = m_radii.topRight();
     203    const LayoutSize& topRight = m_radii.topRight();
    201204    if (!topRight.isEmpty()) {
    202205        FloatRect rect(m_rect.maxX() - topRight.width(), m_rect.y(), topRight.width(), topRight.height());
     
    209212    }
    210213
    211     const IntSize& bottomLeft = m_radii.bottomLeft();
     214    const LayoutSize& bottomLeft = m_radii.bottomLeft();
    212215    if (!bottomLeft.isEmpty()) {
    213216        FloatRect rect(m_rect.x(), m_rect.maxY() - bottomLeft.height(), bottomLeft.width(), bottomLeft.height());
     
    220223    }
    221224
    222     const IntSize& bottomRight = m_radii.bottomRight();
     225    const LayoutSize& bottomRight = m_radii.bottomRight();
    223226    if (!bottomRight.isEmpty()) {
    224227        FloatRect rect(m_rect.maxX() - bottomRight.width(), m_rect.maxY() - bottomRight.height(), bottomRight.width(), bottomRight.height());
  • trunk/Source/WebCore/platform/graphics/RoundedRect.h

    r145870 r163156  
    2929
    3030#include "FloatQuad.h"
    31 #include "IntRect.h"
     31#include "LayoutRect.h"
     32#include "LayoutSize.h"
    3233
    3334namespace WebCore {
    3435
     36class LayoutUnit;
    3537
    3638class RoundedRect {
     
    3941    public:
    4042        Radii() {}
    41         Radii(const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight)
     43        Radii(const LayoutSize& topLeft, const LayoutSize& topRight, const LayoutSize& bottomLeft, const LayoutSize& bottomRight)
    4244            : m_topLeft(topLeft)
    4345            , m_topRight(topRight)
     
    4749        }
    4850
    49         void setTopLeft(const IntSize& size) { m_topLeft = size; }
    50         void setTopRight(const IntSize& size) { m_topRight = size; }
    51         void setBottomLeft(const IntSize& size) { m_bottomLeft = size; }
    52         void setBottomRight(const IntSize& size) { m_bottomRight = size; }
    53         const IntSize& topLeft() const { return m_topLeft; }
    54         const IntSize& topRight() const { return m_topRight; }
    55         const IntSize& bottomLeft() const { return m_bottomLeft; }
    56         const IntSize& bottomRight() const { return m_bottomRight; }
     51        void setTopLeft(const LayoutSize& size) { m_topLeft = size; }
     52        void setTopRight(const LayoutSize& size) { m_topRight = size; }
     53        void setBottomLeft(const LayoutSize& size) { m_bottomLeft = size; }
     54        void setBottomRight(const LayoutSize& size) { m_bottomRight = size; }
     55        const LayoutSize& topLeft() const { return m_topLeft; }
     56        const LayoutSize& topRight() const { return m_topRight; }
     57        const LayoutSize& bottomLeft() const { return m_bottomLeft; }
     58        const LayoutSize& bottomRight() const { return m_bottomRight; }
    5759
    5860        bool isZero() const;
     
    6264
    6365        void scale(float factor);
    64         void expand(int topWidth, int bottomWidth, int leftWidth, int rightWidth);
    65         void expand(int size) { expand(size, size, size, size); }
    66         void shrink(int topWidth, int bottomWidth, int leftWidth, int rightWidth) { expand(-topWidth, -bottomWidth, -leftWidth, -rightWidth); }
    67         void shrink(int size) { shrink(size, size, size, size); }
     66        void expand(const LayoutUnit& topWidth, const LayoutUnit& bottomWidth, const LayoutUnit& leftWidth, const LayoutUnit& rightWidth);
     67        void expand(const LayoutUnit& size) { expand(size, size, size, size); }
     68        void shrink(const LayoutUnit& topWidth, const LayoutUnit& bottomWidth, const LayoutUnit& leftWidth, const LayoutUnit& rightWidth) { expand(-topWidth, -bottomWidth, -leftWidth, -rightWidth); }
     69        void shrink(const LayoutUnit& size) { shrink(size, size, size, size); }
    6870
    6971    private:
    70         IntSize m_topLeft;
    71         IntSize m_topRight;
    72         IntSize m_bottomLeft;
    73         IntSize m_bottomRight;
     72        LayoutSize m_topLeft;
     73        LayoutSize m_topRight;
     74        LayoutSize m_bottomLeft;
     75        LayoutSize m_bottomRight;
    7476    };
    7577
    76     explicit RoundedRect(const IntRect&, const Radii& = Radii());
    77     RoundedRect(int x, int y, int width, int height);
    78     RoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
     78    explicit RoundedRect(const LayoutRect&, const Radii& = Radii());
     79    RoundedRect(const LayoutUnit&, const LayoutUnit&, const LayoutUnit& width, const LayoutUnit& height);
     80    RoundedRect(const LayoutRect&, const LayoutSize& topLeft, const LayoutSize& topRight, const LayoutSize& bottomLeft, const LayoutSize& bottomRight);
    7981
    80     const IntRect& rect() const { return m_rect; }
     82    const LayoutRect& rect() const { return m_rect; }
    8183    const Radii& radii() const { return m_radii; }
    8284    bool isRounded() const { return !m_radii.isZero(); }
    8385    bool isEmpty() const { return m_rect.isEmpty(); }
    8486
    85     void setRect(const IntRect& rect) { m_rect = rect; }
     87    void setRect(const LayoutRect& rect) { m_rect = rect; }
    8688    void setRadii(const Radii& radii) { m_radii = radii; }
    8789
    88     void move(const IntSize& size) { m_rect.move(size); }
    89     void inflate(int size) { m_rect.inflate(size);  }
    90     void inflateWithRadii(int size);
    91     void expandRadii(int size) { m_radii.expand(size); }
    92     void shrinkRadii(int size) { m_radii.shrink(size); }
     90    void move(const LayoutSize& size) { m_rect.move(size); }
     91    void inflate(const LayoutUnit& size) { m_rect.inflate(size);  }
     92    void inflateWithRadii(const LayoutUnit& size);
     93    void expandRadii(const LayoutUnit& size) { m_radii.expand(size); }
     94    void shrinkRadii(const LayoutUnit& size) { m_radii.shrink(size); }
    9395
    9496    void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
     
    103105
    104106private:
    105     IntRect m_rect;
     107    LayoutRect m_rect;
    106108    Radii m_radii;
    107109};
  • trunk/Source/WebCore/platform/graphics/ShadowBlur.cpp

    r161014 r163156  
    8484    }
    8585
    86     bool setCachedShadowValues(const FloatSize& radius, const Color& color, ColorSpace colorSpace, const FloatRect& shadowRect, const RoundedRect::Radii& radii, const FloatSize& layerSize)
     86    bool setCachedShadowValues(const FloatSize& radius, const Color& color, ColorSpace colorSpace, const FloatRect& shadowRect, const FloatRoundedRect::Radii& radii, const FloatSize& layerSize)
    8787    {
    8888        if (!m_lastWasInset && m_lastRadius == radius && m_lastColor == color && m_lastColorSpace == colorSpace && m_lastShadowRect == shadowRect &&  m_lastRadii == radii && m_lastLayerSize == layerSize)
     
    100100    }
    101101
    102     bool setCachedInsetShadowValues(const FloatSize& radius, const Color& color, ColorSpace colorSpace, const FloatRect& bounds, const FloatRect& shadowRect, const RoundedRect::Radii& radii)
     102    bool setCachedInsetShadowValues(const FloatSize& radius, const Color& color, ColorSpace colorSpace, const FloatRect& bounds, const FloatRect& shadowRect, const FloatRoundedRect::Radii& radii)
    103103    {
    104104        if (m_lastWasInset && m_lastRadius == radius && m_lastColor == color && m_lastColorSpace == colorSpace && m_lastInsetBounds == bounds && shadowRect == m_lastShadowRect && radii == m_lastRadii)
     
    148148    FloatRect m_lastInsetBounds;
    149149    FloatRect m_lastShadowRect;
    150     RoundedRect::Radii m_lastRadii;
     150    FloatRoundedRect::Radii m_lastRadii;
    151151    Color m_lastColor;
    152152    ColorSpace m_lastColorSpace;
     
    483483}
    484484
    485 static void computeSliceSizesFromRadii(const IntSize& twiceRadius, const RoundedRect::Radii& radii, int& leftSlice, int& rightSlice, int& topSlice, int& bottomSlice)
     485static void computeSliceSizesFromRadii(const IntSize& twiceRadius, const FloatRoundedRect::Radii& radii, int& leftSlice, int& rightSlice, int& topSlice, int& bottomSlice)
    486486{
    487487    leftSlice = twiceRadius.width() + std::max(radii.topLeft().width(), radii.bottomLeft().width());
     
    492492}
    493493
    494 IntSize ShadowBlur::templateSize(const IntSize& radiusPadding, const RoundedRect::Radii& radii) const
     494IntSize ShadowBlur::templateSize(const IntSize& radiusPadding, const FloatRoundedRect::Radii& radii) const
    495495{
    496496    const int templateSideLength = 1;
     
    510510}
    511511
    512 void ShadowBlur::drawRectShadow(GraphicsContext* graphicsContext, const FloatRect& shadowedRect, const RoundedRect::Radii& radii)
     512void ShadowBlur::drawRectShadow(GraphicsContext* graphicsContext, const FloatRect& shadowedRect, const FloatRoundedRect::Radii& radii)
    513513{
    514514    IntRect layerRect = calculateLayerBoundingRect(graphicsContext, shadowedRect, graphicsContext->clipBounds());
     
    537537}
    538538
    539 void ShadowBlur::drawInsetShadow(GraphicsContext* graphicsContext, const FloatRect& rect, const FloatRect& holeRect, const RoundedRect::Radii& holeRadii)
     539void ShadowBlur::drawInsetShadow(GraphicsContext* graphicsContext, const FloatRect& rect, const FloatRect& holeRect, const FloatRoundedRect::Radii& holeRadii)
    540540{
    541541    IntRect layerRect = calculateLayerBoundingRect(graphicsContext, rect, graphicsContext->clipBounds());
     
    564564}
    565565
    566 void ShadowBlur::drawRectShadowWithoutTiling(GraphicsContext* graphicsContext, const FloatRect& shadowedRect, const RoundedRect::Radii& radii, const IntRect& layerRect)
     566void ShadowBlur::drawRectShadowWithoutTiling(GraphicsContext* graphicsContext, const FloatRect& shadowedRect, const FloatRoundedRect::Radii& radii, const IntRect& layerRect)
    567567{
    568568    m_layerImage = ScratchBuffer::shared().getScratchBuffer(layerRect.size());
     
    599599}
    600600
    601 void ShadowBlur::drawInsetShadowWithoutTiling(GraphicsContext* graphicsContext, const FloatRect& rect, const FloatRect& holeRect, const RoundedRect::Radii& holeRadii, const IntRect& layerRect)
     601void ShadowBlur::drawInsetShadowWithoutTiling(GraphicsContext* graphicsContext, const FloatRect& rect, const FloatRect& holeRect, const FloatRoundedRect::Radii& holeRadii, const IntRect& layerRect)
    602602{
    603603    m_layerImage = ScratchBuffer::shared().getScratchBuffer(layerRect.size());
     
    672672 */
    673673
    674 void ShadowBlur::drawInsetShadowWithTiling(GraphicsContext* graphicsContext, const FloatRect& rect, const FloatRect& holeRect, const RoundedRect::Radii& radii, const IntSize& templateSize, const IntSize& edgeSize)
     674void ShadowBlur::drawInsetShadowWithTiling(GraphicsContext* graphicsContext, const FloatRect& rect, const FloatRect& holeRect, const FloatRoundedRect::Radii& radii, const IntSize& templateSize, const IntSize& edgeSize)
    675675{
    676676    m_layerImage = ScratchBuffer::shared().getScratchBuffer(templateSize);
     
    737737}
    738738
    739 void ShadowBlur::drawRectShadowWithTiling(GraphicsContext* graphicsContext, const FloatRect& shadowedRect, const RoundedRect::Radii& radii, const IntSize& templateSize, const IntSize& edgeSize)
     739void ShadowBlur::drawRectShadowWithTiling(GraphicsContext* graphicsContext, const FloatRect& shadowedRect, const FloatRoundedRect::Radii& radii, const IntSize& templateSize, const IntSize& edgeSize)
    740740{
    741741    m_layerImage = ScratchBuffer::shared().getScratchBuffer(templateSize);
     
    782782}
    783783
    784 void ShadowBlur::drawLayerPieces(GraphicsContext* graphicsContext, const FloatRect& shadowBounds, const RoundedRect::Radii& radii, const IntSize& bufferPadding, const IntSize& templateSize, ShadowDirection direction)
     784void ShadowBlur::drawLayerPieces(GraphicsContext* graphicsContext, const FloatRect& shadowBounds, const FloatRoundedRect::Radii& radii, const IntSize& bufferPadding, const IntSize& templateSize, ShadowDirection direction)
    785785{
    786786    const IntSize twiceRadius = IntSize(bufferPadding.width() * 2, bufferPadding.height() * 2);
     
    894894    // We reset the scratch buffer values here, because the buffer will no longer contain
    895895    // data from any previous rectangle or inset shadows drawn via the tiling path.
    896     ScratchBuffer::shared().setCachedShadowValues(FloatSize(), Color::black, ColorSpaceDeviceRGB, IntRect(), RoundedRect::Radii(), m_layerSize);
     896    ScratchBuffer::shared().setCachedShadowValues(FloatSize(), Color::black, ColorSpaceDeviceRGB, IntRect(), FloatRoundedRect::Radii(), m_layerSize);
    897897    m_layerImage = ScratchBuffer::shared().getScratchBuffer(layerRect.size());
    898898
  • trunk/Source/WebCore/platform/graphics/ShadowBlur.h

    r147750 r163156  
    3333#include "ColorSpace.h"
    3434#include "FloatRect.h"
    35 #include "RoundedRect.h"
     35#include "FloatRoundedRect.h"
    3636#include <wtf/Noncopyable.h>
    3737
     
    6464    void endShadowLayer(GraphicsContext*);
    6565
    66     void drawRectShadow(GraphicsContext*, const FloatRect&, const RoundedRect::Radii&);
    67     void drawInsetShadow(GraphicsContext*, const FloatRect&, const FloatRect& holeRect, const RoundedRect::Radii& holeRadii);
     66    void drawRectShadow(GraphicsContext*, const FloatRect&, const FloatRoundedRect::Radii&);
     67    void drawInsetShadow(GraphicsContext*, const FloatRect&, const FloatRect& holeRect, const FloatRoundedRect::Radii& holeRadii);
    6868
    6969    void blurLayerImage(unsigned char*, const IntSize&, int stride);
     
    8686   
    8787    IntRect calculateLayerBoundingRect(GraphicsContext*, const FloatRect& layerArea, const IntRect& clipRect);
    88     IntSize templateSize(const IntSize& blurredEdgeSize, const RoundedRect::Radii&) const;
     88    IntSize templateSize(const IntSize& blurredEdgeSize, const FloatRoundedRect::Radii&) const;
    8989
    90     void drawRectShadowWithoutTiling(GraphicsContext*, const FloatRect&, const RoundedRect::Radii&, const IntRect& layerRect);
    91     void drawRectShadowWithTiling(GraphicsContext*, const FloatRect&, const RoundedRect::Radii&, const IntSize& shadowTemplateSize, const IntSize& blurredEdgeSize);
     90    void drawRectShadowWithoutTiling(GraphicsContext*, const FloatRect&, const FloatRoundedRect::Radii&, const IntRect& layerRect);
     91    void drawRectShadowWithTiling(GraphicsContext*, const FloatRect&, const FloatRoundedRect::Radii&, const IntSize& shadowTemplateSize, const IntSize& blurredEdgeSize);
    9292
    93     void drawInsetShadowWithoutTiling(GraphicsContext*, const FloatRect&, const FloatRect& holeRect, const RoundedRect::Radii&, const IntRect& layerRect);
    94     void drawInsetShadowWithTiling(GraphicsContext*, const FloatRect&, const FloatRect& holeRect, const RoundedRect::Radii&, const IntSize& shadowTemplateSize, const IntSize& blurredEdgeSize);
     93    void drawInsetShadowWithoutTiling(GraphicsContext*, const FloatRect&, const FloatRect& holeRect, const FloatRoundedRect::Radii&, const IntRect& layerRect);
     94    void drawInsetShadowWithTiling(GraphicsContext*, const FloatRect&, const FloatRect& holeRect, const FloatRoundedRect::Radii&, const IntSize& shadowTemplateSize, const IntSize& blurredEdgeSize);
    9595   
    96     void drawLayerPieces(GraphicsContext*, const FloatRect& shadowBounds, const RoundedRect::Radii&, const IntSize& roundedRadius, const IntSize& templateSize, ShadowDirection);
     96    void drawLayerPieces(GraphicsContext*, const FloatRect& shadowBounds, const FloatRoundedRect::Radii&, const IntSize& roundedRadius, const IntSize& templateSize, ShadowDirection);
    9797   
    9898    void blurShadowBuffer(const IntSize& templateSize);
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r162579 r163156  
    10131013}
    10141014
    1015 void GraphicsContext::clipOut(const IntRect& r)
     1015void GraphicsContext::clipOut(const FloatRect& r)
    10161016{
    10171017    if (paintingDisabled())
     
    10291029}
    10301030
    1031 void GraphicsContext::fillRoundedRect(const IntRect& r, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color, ColorSpace)
     1031void GraphicsContext::fillRoundedRect(const FloatRect& r, const FloatSize& topLeft, const FloatSize& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight, const Color& color, ColorSpace)
    10321032{
    10331033    if (paintingDisabled())
     
    10351035
    10361036    if (hasShadow())
    1037         platformContext()->shadowBlur().drawRectShadow(this, r, RoundedRect::Radii(topLeft, topRight, bottomLeft, bottomRight));
     1037        platformContext()->shadowBlur().drawRectShadow(this, r, FloatRoundedRect::Radii(topLeft, topRight, bottomLeft, bottomRight));
    10381038
    10391039    cairo_t* cr = platformContext()->cr();
     
    10471047}
    10481048
    1049 void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const RoundedRect& roundedHoleRect, const Color& color, ColorSpace)
     1049void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const RoundedRect& roundedHoleRect, const Color& color, ColorSpace)
    10501050{
    10511051    if (paintingDisabled() || !color.isValid())
  • trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

    r162907 r163156  
    847847}
    848848
    849 void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color, ColorSpace colorSpace)
     849void GraphicsContext::fillRoundedRect(const FloatRect& rect, const FloatSize& topLeft, const FloatSize& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight, const Color& color, ColorSpace colorSpace)
    850850{
    851851    if (paintingDisabled())
     
    866866
    867867        ShadowBlur contextShadow(m_state);
    868         contextShadow.drawRectShadow(this, rect, RoundedRect::Radii(topLeft, topRight, bottomLeft, bottomRight));
     868        contextShadow.drawRectShadow(this, rect, FloatRoundedRect::Radii(topLeft, topRight, bottomLeft, bottomRight));
    869869    }
    870870
     
    887887}
    888888
    889 void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const RoundedRect& roundedHoleRect, const Color& color, ColorSpace colorSpace)
     889void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const RoundedRect& roundedHoleRect, const Color& color, ColorSpace colorSpace)
    890890{
    891891    if (paintingDisabled())
     
    937937}
    938938
    939 void GraphicsContext::clipOut(const IntRect& rect)
     939void GraphicsContext::clipOut(const FloatRect& rect)
    940940{
    941941    if (paintingDisabled())
  • trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp

    r162579 r163156  
    899899}
    900900
    901 void GraphicsContext::clipOut(const IntRect& rect)
     901void GraphicsContext::clipOut(const FloatRect& rect)
    902902{
    903903    if (paintingDisabled())
     
    11511151    return IntPoint(rect.left + (rect.right - rect.left) / 2, rect.top + (rect.bottom - rect.top) / 2);
    11521152}
    1153 void GraphicsContext::fillRoundedRect(const IntRect& fillRect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& c, ColorSpace colorSpace)
     1153void GraphicsContext::fillRoundedRect(const FloatRect& fillRect, const FloatSize& topLeft, const FloatSize& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight, const Color& c, ColorSpace colorSpace)
    11541154{
    11551155    ScopeDCProvider dcProvider(m_data);
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r163079 r163156  
    16511651
    16521652void RenderBoxModelObject::paintOneBorderSide(GraphicsContext* graphicsContext, const RenderStyle* style, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
    1653     const IntRect& sideRect, BoxSide side, BoxSide adjacentSide1, BoxSide adjacentSide2, const BorderEdge edges[], const Path* path,
     1653    const LayoutRect& sideRect, BoxSide side, BoxSide adjacentSide1, BoxSide adjacentSide2, const BorderEdge edges[], const Path* path,
    16541654    BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor)
    16551655{
     
    16971697}
    16981698
    1699 static IntRect calculateSideRect(const RoundedRect& outerBorder, const BorderEdge edges[], int side)
    1700 {
    1701     IntRect sideRect = outerBorder.rect();
     1699static LayoutRect calculateSideRect(const RoundedRect& outerBorder, const BorderEdge edges[], int side)
     1700{
     1701    LayoutRect sideRect = outerBorder.rect();
    17021702    int width = edges[side].width;
    17031703
     
    17301730
    17311731    if (edges[BSTop].shouldRender() && includesEdge(edgeSet, BSTop)) {
    1732         IntRect sideRect = outerBorder.rect();
     1732        LayoutRect sideRect = outerBorder.rect();
    17331733        sideRect.setHeight(edges[BSTop].width + innerBorderAdjustment.y());
    17341734
     
    17381738
    17391739    if (edges[BSBottom].shouldRender() && includesEdge(edgeSet, BSBottom)) {
    1740         IntRect sideRect = outerBorder.rect();
     1740        LayoutRect sideRect = outerBorder.rect();
    17411741        sideRect.shiftYEdgeTo(sideRect.maxY() - edges[BSBottom].width - innerBorderAdjustment.y());
    17421742
     
    17461746
    17471747    if (edges[BSLeft].shouldRender() && includesEdge(edgeSet, BSLeft)) {
    1748         IntRect sideRect = outerBorder.rect();
     1748        LayoutRect sideRect = outerBorder.rect();
    17491749        sideRect.setWidth(edges[BSLeft].width + innerBorderAdjustment.x());
    17501750
     
    17541754
    17551755    if (edges[BSRight].shouldRender() && includesEdge(edgeSet, BSRight)) {
    1756         IntRect sideRect = outerBorder.rect();
     1756        LayoutRect sideRect = outerBorder.rect();
    17571757        sideRect.shiftXEdgeTo(sideRect.maxX() - edges[BSRight].width - innerBorderAdjustment.x());
    17581758
     
    18791879
    18801880            if (haveAllDoubleEdges) {
    1881                 IntRect innerThirdRect = outerBorder.rect();
    1882                 IntRect outerThirdRect = outerBorder.rect();
     1881                LayoutRect innerThirdRect = outerBorder.rect();
     1882                LayoutRect outerThirdRect = outerBorder.rect();
    18831883                for (int side = BSTop; side <= BSLeft; ++side) {
    18841884                    int outerWidth;
     
    19341934                const BorderEdge& currEdge = edges[i];
    19351935                if (currEdge.shouldRender()) {
    1936                     IntRect sideRect = calculateSideRect(outerBorder, edges, i);
     1936                    LayoutRect sideRect = calculateSideRect(outerBorder, edges, i);
    19371937                    path.addRect(sideRect);
    19381938                }
     
    22242224    firstQuad[0] = quad[0];
    22252225    firstQuad[1] = quad[1];
    2226     firstQuad[2] = side == BSTop || side == BSBottom ? FloatPoint(quad[3].x(), quad[2].y())
    2227         : FloatPoint(quad[2].x(), quad[3].y());
     2226    firstQuad[2] = side == BSTop || side == BSBottom ? FloatPoint(quad[3].x(), quad[2].y()) : FloatPoint(quad[2].x(), quad[3].y());
    22282227    firstQuad[3] = quad[3];
    22292228    graphicsContext->clipConvexPolygon(4, firstQuad, !firstEdgeMatches);
     
    22312230    FloatPoint secondQuad[4];
    22322231    secondQuad[0] = quad[0];
    2233     secondQuad[1] = side == BSTop || side == BSBottom ? FloatPoint(quad[0].x(), quad[1].y())
    2234         : FloatPoint(quad[1].x(), quad[0].y());
     2232    secondQuad[1] = side == BSTop || side == BSBottom ? FloatPoint(quad[0].x(), quad[1].y()) : FloatPoint(quad[1].x(), quad[0].y());
    22352233    secondQuad[2] = quad[2];
    22362234    secondQuad[3] = quad[3];
     
    22392237}
    22402238
    2241 static IntRect calculateSideRectIncludingInner(const RoundedRect& outerBorder, const BorderEdge edges[], BoxSide side)
    2242 {
    2243     IntRect sideRect = outerBorder.rect();
     2239static LayoutRect calculateSideRectIncludingInner(const RoundedRect& outerBorder, const BorderEdge edges[], BoxSide side)
     2240{
     2241    LayoutRect sideRect = outerBorder.rect();
    22442242    int width;
    22452243
     
    22722270    // for an edge is zero, so we can shift the arc towards the zero radius corner.
    22732271    RoundedRect::Radii newRadii = innerBorder.radii();
    2274     IntRect newRect = innerBorder.rect();
     2272    LayoutRect newRect = innerBorder.rect();
    22752273
    22762274    float overshoot;
     
    24662464}
    24672465
    2468 static inline IntRect areaCastingShadowInHole(const IntRect& holeRect, int shadowExtent, int shadowSpread, const IntSize& shadowOffset)
    2469 {
    2470     IntRect bounds(holeRect);
     2466static inline LayoutRect areaCastingShadowInHole(const LayoutRect& holeRect, int shadowExtent, int shadowSpread, const IntSize& shadowOffset)
     2467{
     2468    LayoutRect bounds(holeRect);
    24712469   
    24722470    bounds.inflate(shadowExtent);
     
    24752473        bounds.inflate(-shadowSpread);
    24762474   
    2477     IntRect offsetBounds = bounds;
     2475    LayoutRect offsetBounds = bounds;
    24782476    offsetBounds.move(-shadowOffset);
    24792477    return unionRect(bounds, offsetBounds);
     
    25572555                }
    25582556            } else {
    2559                 IntRect rectToClipOut = border.rect();
     2557                LayoutRect rectToClipOut = border.rect();
    25602558
    25612559                // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time
     
    26062604            Color fillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), 255);
    26072605
    2608             IntRect outerRect = areaCastingShadowInHole(border.rect(), shadowPaintingExtent, shadowSpread, shadowOffset);
     2606            LayoutRect outerRect = areaCastingShadowInHole(border.rect(), shadowPaintingExtent, shadowSpread, shadowOffset);
    26092607            RoundedRect roundedHole(holeRect, border.radii());
    26102608
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r163079 r163156  
    331331    void clipBorderSideForComplexInnerPath(GraphicsContext*, const RoundedRect&, const RoundedRect&, BoxSide, const class BorderEdge[]);
    332332    void paintOneBorderSide(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
    333                                 const IntRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacentSide2, const class BorderEdge[],
    334                                 const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor = 0);
     333        const LayoutRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacentSide2, const class BorderEdge[],
     334        const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor = 0);
    335335    void paintTranslucentBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, const IntPoint& innerBorderAdjustment,
    336336        const class BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false);
  • trunk/Source/WebCore/rendering/RenderThemeSafari.cpp

    r160226 r163156  
    779779    RetainPtr<CGShadingRef> rightShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(r.maxX(),  r.y()), CGPointMake(r.maxX() - radius, r.y()), mainFunction.get(), false, false));
    780780    paintInfo.context->save();
    781     CGContextClipToRect(context, bound.rect());
     781    CGContextClipToRect(context, r);
    782782    paintInfo.context->clipRoundedRect(bound);
    783783    CGContextDrawShading(context, mainShading.get());
     
    799799
    800800    paintInfo.context->save();
    801     CGContextClipToRect(context, bound.rect());
     801    CGContextClipToRect(context, r);
    802802    paintInfo.context->clipRoundedRect(bound);
    803803    CGContextDrawShading(context, leftShading.get());
     
    974974
    975975    paintInfo.context->save();
    976     CGContextClipToRect(context, bounds.rect());
     976    CGContextClipToRect(context, pixelSnappedIntRect(bounds.rect()));
    977977
    978978    struct CGFunctionCallbacks mainCallbacks = { 0, TrackGradientInterpolate, NULL };
Note: See TracChangeset for help on using the changeset viewer.