Changeset 163156 in webkit
- Timestamp:
- Jan 30, 2014 9:41:46 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r163155 r163156 1 2014-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 1 78 2014-01-30 Martin Robinson <mrobinson@igalia.com> 2 79 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r161589 r163156 772 772 void GraphicsContext::fillRoundedRect(const RoundedRect& rect, const Color& color, ColorSpace colorSpace, BlendMode blendMode) 773 773 { 774 775 774 if (rect.isRounded()) { 776 775 setCompositeOperation(compositeOperation(), blendMode); -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r162579 r163156 295 295 void fillRect(const FloatRect&, Gradient&); 296 296 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); 298 298 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); 300 300 301 301 void clearRect(const FloatRect&); … … 333 333 void clipRoundedRect(const FloatRect&, const FloatSize& topLeft, const FloatSize& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight); 334 334 335 void clipOut(const IntRect&);335 void clipOut(const FloatRect&); 336 336 void clipOutRoundedRect(const RoundedRect&); 337 337 void clipPath(const Path&, WindRule); -
trunk/Source/WebCore/platform/graphics/RoundedRect.cpp
r159027 r163156 29 29 #include "RoundedRect.h" 30 30 31 #include "LayoutRect.h" 32 #include "LayoutUnit.h" 33 31 34 #include <algorithm> 32 35 … … 46 49 m_topLeft.scale(factor); 47 50 if (!m_topLeft.width() || !m_topLeft.height()) 48 m_topLeft = IntSize();51 m_topLeft = LayoutSize(); 49 52 m_topRight.scale(factor); 50 53 if (!m_topRight.width() || !m_topRight.height()) 51 m_topRight = IntSize();54 m_topRight = LayoutSize(); 52 55 m_bottomLeft.scale(factor); 53 56 if (!m_bottomLeft.width() || !m_bottomLeft.height()) 54 m_bottomLeft = IntSize();57 m_bottomLeft = LayoutSize(); 55 58 m_bottomRight.scale(factor); 56 59 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, intrightWidth)60 m_bottomRight = LayoutSize(); 61 62 } 63 64 void RoundedRect::Radii::expand(const LayoutUnit& topWidth, const LayoutUnit& bottomWidth, const LayoutUnit& leftWidth, const LayoutUnit& rightWidth) 62 65 { 63 66 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)); 66 69 } 67 70 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)); 70 73 } 71 74 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)); 74 77 } 75 78 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( intsize)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 84 void RoundedRect::inflateWithRadii(const LayoutUnit& size) 85 { 86 LayoutRect old = m_rect; 84 87 85 88 m_rect.inflate(size); … … 132 135 } 133 136 134 RoundedRect::RoundedRect( int x, int y, int width, intheight)137 RoundedRect::RoundedRect(const LayoutUnit& x, const LayoutUnit& y, const LayoutUnit& width, const LayoutUnit& height) 135 138 : m_rect(x, y, width, height) 136 139 { 137 140 } 138 141 139 RoundedRect::RoundedRect(const IntRect& rect, const Radii& radii)142 RoundedRect::RoundedRect(const LayoutRect& rect, const Radii& radii) 140 143 : m_rect(rect) 141 144 , m_radii(radii) … … 143 146 } 144 147 145 RoundedRect::RoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight)148 RoundedRect::RoundedRect(const LayoutRect& rect, const LayoutSize& topLeft, const LayoutSize& topRight, const LayoutSize& bottomLeft, const LayoutSize& bottomRight) 146 149 : m_rect(rect) 147 150 , m_radii(topLeft, topRight, bottomLeft, bottomRight) … … 187 190 return false; 188 191 189 const IntSize& topLeft = m_radii.topLeft();192 const LayoutSize& topLeft = m_radii.topLeft(); 190 193 if (!topLeft.isEmpty()) { 191 194 FloatRect rect(m_rect.x(), m_rect.y(), topLeft.width(), topLeft.height()); … … 198 201 } 199 202 200 const IntSize& topRight = m_radii.topRight();203 const LayoutSize& topRight = m_radii.topRight(); 201 204 if (!topRight.isEmpty()) { 202 205 FloatRect rect(m_rect.maxX() - topRight.width(), m_rect.y(), topRight.width(), topRight.height()); … … 209 212 } 210 213 211 const IntSize& bottomLeft = m_radii.bottomLeft();214 const LayoutSize& bottomLeft = m_radii.bottomLeft(); 212 215 if (!bottomLeft.isEmpty()) { 213 216 FloatRect rect(m_rect.x(), m_rect.maxY() - bottomLeft.height(), bottomLeft.width(), bottomLeft.height()); … … 220 223 } 221 224 222 const IntSize& bottomRight = m_radii.bottomRight();225 const LayoutSize& bottomRight = m_radii.bottomRight(); 223 226 if (!bottomRight.isEmpty()) { 224 227 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 29 29 30 30 #include "FloatQuad.h" 31 #include "IntRect.h" 31 #include "LayoutRect.h" 32 #include "LayoutSize.h" 32 33 33 34 namespace WebCore { 34 35 36 class LayoutUnit; 35 37 36 38 class RoundedRect { … … 39 41 public: 40 42 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) 42 44 : m_topLeft(topLeft) 43 45 , m_topRight(topRight) … … 47 49 } 48 50 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; } 57 59 58 60 bool isZero() const; … … 62 64 63 65 void scale(float factor); 64 void expand( int topWidth, int bottomWidth, int leftWidth, intrightWidth);65 void expand( intsize) { expand(size, size, size, size); }66 void shrink( int topWidth, int bottomWidth, int leftWidth, intrightWidth) { expand(-topWidth, -bottomWidth, -leftWidth, -rightWidth); }67 void shrink( intsize) { 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); } 68 70 69 71 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; 74 76 }; 75 77 76 explicit RoundedRect(const IntRect&, const Radii& = Radii());77 RoundedRect( int x, int y, int width, intheight);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); 79 81 80 const IntRect& rect() const { return m_rect; }82 const LayoutRect& rect() const { return m_rect; } 81 83 const Radii& radii() const { return m_radii; } 82 84 bool isRounded() const { return !m_radii.isZero(); } 83 85 bool isEmpty() const { return m_rect.isEmpty(); } 84 86 85 void setRect(const IntRect& rect) { m_rect = rect; }87 void setRect(const LayoutRect& rect) { m_rect = rect; } 86 88 void setRadii(const Radii& radii) { m_radii = radii; } 87 89 88 void move(const IntSize& size) { m_rect.move(size); }89 void inflate( intsize) { m_rect.inflate(size); }90 void inflateWithRadii( intsize);91 void expandRadii( intsize) { m_radii.expand(size); }92 void shrinkRadii( intsize) { 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); } 93 95 94 96 void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); … … 103 105 104 106 private: 105 IntRect m_rect;107 LayoutRect m_rect; 106 108 Radii m_radii; 107 109 }; -
trunk/Source/WebCore/platform/graphics/ShadowBlur.cpp
r161014 r163156 84 84 } 85 85 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) 87 87 { 88 88 if (!m_lastWasInset && m_lastRadius == radius && m_lastColor == color && m_lastColorSpace == colorSpace && m_lastShadowRect == shadowRect && m_lastRadii == radii && m_lastLayerSize == layerSize) … … 100 100 } 101 101 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) 103 103 { 104 104 if (m_lastWasInset && m_lastRadius == radius && m_lastColor == color && m_lastColorSpace == colorSpace && m_lastInsetBounds == bounds && shadowRect == m_lastShadowRect && radii == m_lastRadii) … … 148 148 FloatRect m_lastInsetBounds; 149 149 FloatRect m_lastShadowRect; 150 RoundedRect::Radii m_lastRadii;150 FloatRoundedRect::Radii m_lastRadii; 151 151 Color m_lastColor; 152 152 ColorSpace m_lastColorSpace; … … 483 483 } 484 484 485 static void computeSliceSizesFromRadii(const IntSize& twiceRadius, const RoundedRect::Radii& radii, int& leftSlice, int& rightSlice, int& topSlice, int& bottomSlice)485 static void computeSliceSizesFromRadii(const IntSize& twiceRadius, const FloatRoundedRect::Radii& radii, int& leftSlice, int& rightSlice, int& topSlice, int& bottomSlice) 486 486 { 487 487 leftSlice = twiceRadius.width() + std::max(radii.topLeft().width(), radii.bottomLeft().width()); … … 492 492 } 493 493 494 IntSize ShadowBlur::templateSize(const IntSize& radiusPadding, const RoundedRect::Radii& radii) const494 IntSize ShadowBlur::templateSize(const IntSize& radiusPadding, const FloatRoundedRect::Radii& radii) const 495 495 { 496 496 const int templateSideLength = 1; … … 510 510 } 511 511 512 void ShadowBlur::drawRectShadow(GraphicsContext* graphicsContext, const FloatRect& shadowedRect, const RoundedRect::Radii& radii)512 void ShadowBlur::drawRectShadow(GraphicsContext* graphicsContext, const FloatRect& shadowedRect, const FloatRoundedRect::Radii& radii) 513 513 { 514 514 IntRect layerRect = calculateLayerBoundingRect(graphicsContext, shadowedRect, graphicsContext->clipBounds()); … … 537 537 } 538 538 539 void ShadowBlur::drawInsetShadow(GraphicsContext* graphicsContext, const FloatRect& rect, const FloatRect& holeRect, const RoundedRect::Radii& holeRadii)539 void ShadowBlur::drawInsetShadow(GraphicsContext* graphicsContext, const FloatRect& rect, const FloatRect& holeRect, const FloatRoundedRect::Radii& holeRadii) 540 540 { 541 541 IntRect layerRect = calculateLayerBoundingRect(graphicsContext, rect, graphicsContext->clipBounds()); … … 564 564 } 565 565 566 void ShadowBlur::drawRectShadowWithoutTiling(GraphicsContext* graphicsContext, const FloatRect& shadowedRect, const RoundedRect::Radii& radii, const IntRect& layerRect)566 void ShadowBlur::drawRectShadowWithoutTiling(GraphicsContext* graphicsContext, const FloatRect& shadowedRect, const FloatRoundedRect::Radii& radii, const IntRect& layerRect) 567 567 { 568 568 m_layerImage = ScratchBuffer::shared().getScratchBuffer(layerRect.size()); … … 599 599 } 600 600 601 void ShadowBlur::drawInsetShadowWithoutTiling(GraphicsContext* graphicsContext, const FloatRect& rect, const FloatRect& holeRect, const RoundedRect::Radii& holeRadii, const IntRect& layerRect)601 void ShadowBlur::drawInsetShadowWithoutTiling(GraphicsContext* graphicsContext, const FloatRect& rect, const FloatRect& holeRect, const FloatRoundedRect::Radii& holeRadii, const IntRect& layerRect) 602 602 { 603 603 m_layerImage = ScratchBuffer::shared().getScratchBuffer(layerRect.size()); … … 672 672 */ 673 673 674 void ShadowBlur::drawInsetShadowWithTiling(GraphicsContext* graphicsContext, const FloatRect& rect, const FloatRect& holeRect, const RoundedRect::Radii& radii, const IntSize& templateSize, const IntSize& edgeSize)674 void ShadowBlur::drawInsetShadowWithTiling(GraphicsContext* graphicsContext, const FloatRect& rect, const FloatRect& holeRect, const FloatRoundedRect::Radii& radii, const IntSize& templateSize, const IntSize& edgeSize) 675 675 { 676 676 m_layerImage = ScratchBuffer::shared().getScratchBuffer(templateSize); … … 737 737 } 738 738 739 void ShadowBlur::drawRectShadowWithTiling(GraphicsContext* graphicsContext, const FloatRect& shadowedRect, const RoundedRect::Radii& radii, const IntSize& templateSize, const IntSize& edgeSize)739 void ShadowBlur::drawRectShadowWithTiling(GraphicsContext* graphicsContext, const FloatRect& shadowedRect, const FloatRoundedRect::Radii& radii, const IntSize& templateSize, const IntSize& edgeSize) 740 740 { 741 741 m_layerImage = ScratchBuffer::shared().getScratchBuffer(templateSize); … … 782 782 } 783 783 784 void ShadowBlur::drawLayerPieces(GraphicsContext* graphicsContext, const FloatRect& shadowBounds, const RoundedRect::Radii& radii, const IntSize& bufferPadding, const IntSize& templateSize, ShadowDirection direction)784 void ShadowBlur::drawLayerPieces(GraphicsContext* graphicsContext, const FloatRect& shadowBounds, const FloatRoundedRect::Radii& radii, const IntSize& bufferPadding, const IntSize& templateSize, ShadowDirection direction) 785 785 { 786 786 const IntSize twiceRadius = IntSize(bufferPadding.width() * 2, bufferPadding.height() * 2); … … 894 894 // We reset the scratch buffer values here, because the buffer will no longer contain 895 895 // 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); 897 897 m_layerImage = ScratchBuffer::shared().getScratchBuffer(layerRect.size()); 898 898 -
trunk/Source/WebCore/platform/graphics/ShadowBlur.h
r147750 r163156 33 33 #include "ColorSpace.h" 34 34 #include "FloatRect.h" 35 #include " RoundedRect.h"35 #include "FloatRoundedRect.h" 36 36 #include <wtf/Noncopyable.h> 37 37 … … 64 64 void endShadowLayer(GraphicsContext*); 65 65 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); 68 68 69 69 void blurLayerImage(unsigned char*, const IntSize&, int stride); … … 86 86 87 87 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; 89 89 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); 92 92 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); 95 95 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); 97 97 98 98 void blurShadowBuffer(const IntSize& templateSize); -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r162579 r163156 1013 1013 } 1014 1014 1015 void GraphicsContext::clipOut(const IntRect& r)1015 void GraphicsContext::clipOut(const FloatRect& r) 1016 1016 { 1017 1017 if (paintingDisabled()) … … 1029 1029 } 1030 1030 1031 void GraphicsContext::fillRoundedRect(const IntRect& r, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color, ColorSpace)1031 void GraphicsContext::fillRoundedRect(const FloatRect& r, const FloatSize& topLeft, const FloatSize& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight, const Color& color, ColorSpace) 1032 1032 { 1033 1033 if (paintingDisabled()) … … 1035 1035 1036 1036 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)); 1038 1038 1039 1039 cairo_t* cr = platformContext()->cr(); … … 1047 1047 } 1048 1048 1049 void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const RoundedRect& roundedHoleRect, const Color& color, ColorSpace)1049 void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const RoundedRect& roundedHoleRect, const Color& color, ColorSpace) 1050 1050 { 1051 1051 if (paintingDisabled() || !color.isValid()) -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r162907 r163156 847 847 } 848 848 849 void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color, ColorSpace colorSpace)849 void GraphicsContext::fillRoundedRect(const FloatRect& rect, const FloatSize& topLeft, const FloatSize& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight, const Color& color, ColorSpace colorSpace) 850 850 { 851 851 if (paintingDisabled()) … … 866 866 867 867 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)); 869 869 } 870 870 … … 887 887 } 888 888 889 void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const RoundedRect& roundedHoleRect, const Color& color, ColorSpace colorSpace)889 void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const RoundedRect& roundedHoleRect, const Color& color, ColorSpace colorSpace) 890 890 { 891 891 if (paintingDisabled()) … … 937 937 } 938 938 939 void GraphicsContext::clipOut(const IntRect& rect)939 void GraphicsContext::clipOut(const FloatRect& rect) 940 940 { 941 941 if (paintingDisabled()) -
trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
r162579 r163156 899 899 } 900 900 901 void GraphicsContext::clipOut(const IntRect& rect)901 void GraphicsContext::clipOut(const FloatRect& rect) 902 902 { 903 903 if (paintingDisabled()) … … 1151 1151 return IntPoint(rect.left + (rect.right - rect.left) / 2, rect.top + (rect.bottom - rect.top) / 2); 1152 1152 } 1153 void GraphicsContext::fillRoundedRect(const IntRect& fillRect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& c, ColorSpace colorSpace)1153 void GraphicsContext::fillRoundedRect(const FloatRect& fillRect, const FloatSize& topLeft, const FloatSize& topRight, const FloatSize& bottomLeft, const FloatSize& bottomRight, const Color& c, ColorSpace colorSpace) 1154 1154 { 1155 1155 ScopeDCProvider dcProvider(m_data); -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r163079 r163156 1651 1651 1652 1652 void 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, 1654 1654 BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor) 1655 1655 { … … 1697 1697 } 1698 1698 1699 static IntRect calculateSideRect(const RoundedRect& outerBorder, const BorderEdge edges[], int side)1700 { 1701 IntRect sideRect = outerBorder.rect();1699 static LayoutRect calculateSideRect(const RoundedRect& outerBorder, const BorderEdge edges[], int side) 1700 { 1701 LayoutRect sideRect = outerBorder.rect(); 1702 1702 int width = edges[side].width; 1703 1703 … … 1730 1730 1731 1731 if (edges[BSTop].shouldRender() && includesEdge(edgeSet, BSTop)) { 1732 IntRect sideRect = outerBorder.rect();1732 LayoutRect sideRect = outerBorder.rect(); 1733 1733 sideRect.setHeight(edges[BSTop].width + innerBorderAdjustment.y()); 1734 1734 … … 1738 1738 1739 1739 if (edges[BSBottom].shouldRender() && includesEdge(edgeSet, BSBottom)) { 1740 IntRect sideRect = outerBorder.rect();1740 LayoutRect sideRect = outerBorder.rect(); 1741 1741 sideRect.shiftYEdgeTo(sideRect.maxY() - edges[BSBottom].width - innerBorderAdjustment.y()); 1742 1742 … … 1746 1746 1747 1747 if (edges[BSLeft].shouldRender() && includesEdge(edgeSet, BSLeft)) { 1748 IntRect sideRect = outerBorder.rect();1748 LayoutRect sideRect = outerBorder.rect(); 1749 1749 sideRect.setWidth(edges[BSLeft].width + innerBorderAdjustment.x()); 1750 1750 … … 1754 1754 1755 1755 if (edges[BSRight].shouldRender() && includesEdge(edgeSet, BSRight)) { 1756 IntRect sideRect = outerBorder.rect();1756 LayoutRect sideRect = outerBorder.rect(); 1757 1757 sideRect.shiftXEdgeTo(sideRect.maxX() - edges[BSRight].width - innerBorderAdjustment.x()); 1758 1758 … … 1879 1879 1880 1880 if (haveAllDoubleEdges) { 1881 IntRect innerThirdRect = outerBorder.rect();1882 IntRect outerThirdRect = outerBorder.rect();1881 LayoutRect innerThirdRect = outerBorder.rect(); 1882 LayoutRect outerThirdRect = outerBorder.rect(); 1883 1883 for (int side = BSTop; side <= BSLeft; ++side) { 1884 1884 int outerWidth; … … 1934 1934 const BorderEdge& currEdge = edges[i]; 1935 1935 if (currEdge.shouldRender()) { 1936 IntRect sideRect = calculateSideRect(outerBorder, edges, i);1936 LayoutRect sideRect = calculateSideRect(outerBorder, edges, i); 1937 1937 path.addRect(sideRect); 1938 1938 } … … 2224 2224 firstQuad[0] = quad[0]; 2225 2225 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()); 2228 2227 firstQuad[3] = quad[3]; 2229 2228 graphicsContext->clipConvexPolygon(4, firstQuad, !firstEdgeMatches); … … 2231 2230 FloatPoint secondQuad[4]; 2232 2231 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()); 2235 2233 secondQuad[2] = quad[2]; 2236 2234 secondQuad[3] = quad[3]; … … 2239 2237 } 2240 2238 2241 static IntRect calculateSideRectIncludingInner(const RoundedRect& outerBorder, const BorderEdge edges[], BoxSide side)2242 { 2243 IntRect sideRect = outerBorder.rect();2239 static LayoutRect calculateSideRectIncludingInner(const RoundedRect& outerBorder, const BorderEdge edges[], BoxSide side) 2240 { 2241 LayoutRect sideRect = outerBorder.rect(); 2244 2242 int width; 2245 2243 … … 2272 2270 // for an edge is zero, so we can shift the arc towards the zero radius corner. 2273 2271 RoundedRect::Radii newRadii = innerBorder.radii(); 2274 IntRect newRect = innerBorder.rect();2272 LayoutRect newRect = innerBorder.rect(); 2275 2273 2276 2274 float overshoot; … … 2466 2464 } 2467 2465 2468 static inline IntRect areaCastingShadowInHole(const IntRect& holeRect, int shadowExtent, int shadowSpread, const IntSize& shadowOffset)2469 { 2470 IntRect bounds(holeRect);2466 static inline LayoutRect areaCastingShadowInHole(const LayoutRect& holeRect, int shadowExtent, int shadowSpread, const IntSize& shadowOffset) 2467 { 2468 LayoutRect bounds(holeRect); 2471 2469 2472 2470 bounds.inflate(shadowExtent); … … 2475 2473 bounds.inflate(-shadowSpread); 2476 2474 2477 IntRect offsetBounds = bounds;2475 LayoutRect offsetBounds = bounds; 2478 2476 offsetBounds.move(-shadowOffset); 2479 2477 return unionRect(bounds, offsetBounds); … … 2557 2555 } 2558 2556 } else { 2559 IntRect rectToClipOut = border.rect();2557 LayoutRect rectToClipOut = border.rect(); 2560 2558 2561 2559 // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time … … 2606 2604 Color fillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), 255); 2607 2605 2608 IntRect outerRect = areaCastingShadowInHole(border.rect(), shadowPaintingExtent, shadowSpread, shadowOffset);2606 LayoutRect outerRect = areaCastingShadowInHole(border.rect(), shadowPaintingExtent, shadowSpread, shadowOffset); 2609 2607 RoundedRect roundedHole(holeRect, border.radii()); 2610 2608 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r163079 r163156 331 331 void clipBorderSideForComplexInnerPath(GraphicsContext*, const RoundedRect&, const RoundedRect&, BoxSide, const class BorderEdge[]); 332 332 void paintOneBorderSide(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, 333 const IntRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacentSide2, const class BorderEdge[],334 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); 335 335 void paintTranslucentBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, const IntPoint& innerBorderAdjustment, 336 336 const class BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false); -
trunk/Source/WebCore/rendering/RenderThemeSafari.cpp
r160226 r163156 779 779 RetainPtr<CGShadingRef> rightShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(r.maxX(), r.y()), CGPointMake(r.maxX() - radius, r.y()), mainFunction.get(), false, false)); 780 780 paintInfo.context->save(); 781 CGContextClipToRect(context, bound.rect());781 CGContextClipToRect(context, r); 782 782 paintInfo.context->clipRoundedRect(bound); 783 783 CGContextDrawShading(context, mainShading.get()); … … 799 799 800 800 paintInfo.context->save(); 801 CGContextClipToRect(context, bound.rect());801 CGContextClipToRect(context, r); 802 802 paintInfo.context->clipRoundedRect(bound); 803 803 CGContextDrawShading(context, leftShading.get()); … … 974 974 975 975 paintInfo.context->save(); 976 CGContextClipToRect(context, bounds.rect());976 CGContextClipToRect(context, pixelSnappedIntRect(bounds.rect())); 977 977 978 978 struct CGFunctionCallbacks mainCallbacks = { 0, TrackGradientInterpolate, NULL };
Note: See TracChangeset
for help on using the changeset viewer.