Changeset 98931 in webkit
- Timestamp:
- Oct 31, 2011 6:09:03 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r98930 r98931 1 2011-10-31 Levi Weintraub <leviw@chromium.org> 2 3 Switch RoundedRect back to integers 4 https://bugs.webkit.org/show_bug.cgi?id=71238 5 6 Reviewed by Darin Adler. 7 8 Changing RoundedRect back to ints from LayoutUnits. As further testing has shown, this graphics- 9 focused class should maintain values aligned to pixel boundaries, and therefor kept as integers. 10 11 No new tests -- no change in behavior. 12 13 * platform/graphics/RoundedRect.cpp: 14 (WebCore::RoundedRect::Radii::scale): 15 (WebCore::RoundedRect::Radii::expand): 16 (WebCore::RoundedRect::inflateWithRadii): 17 (WebCore::RoundedRect::Radii::excludeLogicalEdges): 18 (WebCore::RoundedRect::RoundedRect): 19 * platform/graphics/RoundedRect.h: 20 (WebCore::RoundedRect::Radii::Radii): 21 (WebCore::RoundedRect::Radii::setTopLeft): 22 (WebCore::RoundedRect::Radii::setTopRight): 23 (WebCore::RoundedRect::Radii::setBottomLeft): 24 (WebCore::RoundedRect::Radii::setBottomRight): 25 (WebCore::RoundedRect::Radii::topLeft): 26 (WebCore::RoundedRect::Radii::topRight): 27 (WebCore::RoundedRect::Radii::bottomLeft): 28 (WebCore::RoundedRect::Radii::bottomRight): 29 (WebCore::RoundedRect::Radii::expand): 30 (WebCore::RoundedRect::Radii::shrink): 31 (WebCore::RoundedRect::rect): 32 (WebCore::RoundedRect::setRect): 33 (WebCore::RoundedRect::move): 34 (WebCore::RoundedRect::inflate): 35 (WebCore::RoundedRect::expandRadii): 36 (WebCore::RoundedRect::shrinkRadii): 37 * rendering/svg/SVGRenderSupport.h: Adding missing LayoutTypes.h include 38 1 39 2011-10-31 Peter Kasting <pkasting@google.com> 2 40 -
trunk/Source/WebCore/platform/graphics/RoundedRect.cpp
r95901 r98931 47 47 m_topLeft.scale(factor); 48 48 if (!m_topLeft.width() || !m_topLeft.height()) 49 m_topLeft = LayoutSize();49 m_topLeft = IntSize(); 50 50 m_topRight.scale(factor); 51 51 if (!m_topRight.width() || !m_topRight.height()) 52 m_topRight = LayoutSize();52 m_topRight = IntSize(); 53 53 m_bottomLeft.scale(factor); 54 54 if (!m_bottomLeft.width() || !m_bottomLeft.height()) 55 m_bottomLeft = LayoutSize();55 m_bottomLeft = IntSize(); 56 56 m_bottomRight.scale(factor); 57 57 if (!m_bottomRight.width() || !m_bottomRight.height()) 58 m_bottomRight = LayoutSize();58 m_bottomRight = IntSize(); 59 59 60 60 } 61 61 62 void RoundedRect::Radii::expand( LayoutUnit topWidth, LayoutUnit bottomWidth, LayoutUnit leftWidth, LayoutUnit rightWidth)62 void RoundedRect::Radii::expand(int topWidth, int bottomWidth, int leftWidth, int rightWidth) 63 63 { 64 m_topLeft.setWidth(max< LayoutUnit>(0, m_topLeft.width() + leftWidth));65 m_topLeft.setHeight(max< LayoutUnit>(0, m_topLeft.height() + topWidth));64 m_topLeft.setWidth(max<int>(0, m_topLeft.width() + leftWidth)); 65 m_topLeft.setHeight(max<int>(0, m_topLeft.height() + topWidth)); 66 66 67 m_topRight.setWidth(max< LayoutUnit>(0, m_topRight.width() + rightWidth));68 m_topRight.setHeight(max< LayoutUnit>(0, m_topRight.height() + topWidth));67 m_topRight.setWidth(max<int>(0, m_topRight.width() + rightWidth)); 68 m_topRight.setHeight(max<int>(0, m_topRight.height() + topWidth)); 69 69 70 m_bottomLeft.setWidth(max< LayoutUnit>(0, m_bottomLeft.width() + leftWidth));71 m_bottomLeft.setHeight(max< LayoutUnit>(0, m_bottomLeft.height() + bottomWidth));70 m_bottomLeft.setWidth(max<int>(0, m_bottomLeft.width() + leftWidth)); 71 m_bottomLeft.setHeight(max<int>(0, m_bottomLeft.height() + bottomWidth)); 72 72 73 m_bottomRight.setWidth(max< LayoutUnit>(0, m_bottomRight.width() + rightWidth));74 m_bottomRight.setHeight(max< LayoutUnit>(0, m_bottomRight.height() + bottomWidth));73 m_bottomRight.setWidth(max<int>(0, m_bottomRight.width() + rightWidth)); 74 m_bottomRight.setHeight(max<int>(0, m_bottomRight.height() + bottomWidth)); 75 75 } 76 76 77 void RoundedRect::inflateWithRadii( LayoutUnit size)77 void RoundedRect::inflateWithRadii(int size) 78 78 { 79 LayoutRect old = m_rect;79 IntRect old = m_rect; 80 80 81 81 m_rect.inflate(size); … … 83 83 float factor; 84 84 if (m_rect.width() < m_rect.height()) 85 factor = old.width() ? (float)m_rect.width() / old.width() : 0;85 factor = old.width() ? (float)m_rect.width() / old.width() : int(0); 86 86 else 87 factor = old.height() ? (float)m_rect.height() / old.height() : 0;87 factor = old.height() ? (float)m_rect.height() / old.height() : int(0); 88 88 89 89 m_radii.scale(factor); … … 113 113 if (excludeLogicalLeftEdge) { 114 114 if (isHorizontal) 115 m_bottomLeft = LayoutSize();115 m_bottomLeft = IntSize(); 116 116 else 117 m_topRight = LayoutSize();118 m_topLeft = LayoutSize();117 m_topRight = IntSize(); 118 m_topLeft = IntSize(); 119 119 } 120 120 121 121 if (excludeLogicalRightEdge) { 122 122 if (isHorizontal) 123 m_topRight = LayoutSize();123 m_topRight = IntSize(); 124 124 else 125 m_bottomLeft = LayoutSize();126 m_bottomRight = LayoutSize();125 m_bottomLeft = IntSize(); 126 m_bottomRight = IntSize(); 127 127 } 128 128 } 129 129 130 RoundedRect::RoundedRect( LayoutUnit x, LayoutUnit y, LayoutUnit width, LayoutUnit height)130 RoundedRect::RoundedRect(int x, int y, int width, int height) 131 131 : m_rect(x, y, width, height) 132 132 { 133 133 } 134 134 135 RoundedRect::RoundedRect(const LayoutRect& rect, const Radii& radii)135 RoundedRect::RoundedRect(const IntRect& rect, const Radii& radii) 136 136 : m_rect(rect) 137 137 , m_radii(radii) … … 139 139 } 140 140 141 RoundedRect::RoundedRect(const LayoutRect& rect, const LayoutSize& topLeft, const LayoutSize& topRight, const LayoutSize& bottomLeft, const LayoutSize& bottomRight)141 RoundedRect::RoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight) 142 142 : m_rect(rect) 143 143 , m_radii(topLeft, topRight, bottomLeft, bottomRight) -
trunk/Source/WebCore/platform/graphics/RoundedRect.h
r95901 r98931 28 28 #define RoundedRect_h 29 29 30 #include " LayoutTypes.h"30 #include "IntRect.h" 31 31 32 32 namespace WebCore { … … 38 38 public: 39 39 Radii() {} 40 Radii(const LayoutSize& topLeft, const LayoutSize& topRight, const LayoutSize& bottomLeft, const LayoutSize& bottomRight)40 Radii(const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight) 41 41 : m_topLeft(topLeft) 42 42 , m_topRight(topRight) … … 46 46 } 47 47 48 void setTopLeft(const LayoutSize& size) { m_topLeft = size; }49 void setTopRight(const LayoutSize& size) { m_topRight = size; }50 void setBottomLeft(const LayoutSize& size) { m_bottomLeft = size; }51 void setBottomRight(const LayoutSize& size) { m_bottomRight = size; }52 const LayoutSize& topLeft() const { return m_topLeft; }53 const LayoutSize& topRight() const { return m_topRight; }54 const LayoutSize& bottomLeft() const { return m_bottomLeft; }55 const LayoutSize& bottomRight() const { return m_bottomRight; }48 void setTopLeft(const IntSize& size) { m_topLeft = size; } 49 void setTopRight(const IntSize& size) { m_topRight = size; } 50 void setBottomLeft(const IntSize& size) { m_bottomLeft = size; } 51 void setBottomRight(const IntSize& size) { m_bottomRight = size; } 52 const IntSize& topLeft() const { return m_topLeft; } 53 const IntSize& topRight() const { return m_topRight; } 54 const IntSize& bottomLeft() const { return m_bottomLeft; } 55 const IntSize& bottomRight() const { return m_bottomRight; } 56 56 57 57 bool isZero() const; … … 61 61 62 62 void scale(float factor); 63 void expand( LayoutUnit topWidth, LayoutUnit bottomWidth, LayoutUnit leftWidth, LayoutUnit rightWidth);64 void expand( LayoutUnit size) { expand(size, size, size, size); }65 void shrink( LayoutUnit topWidth, LayoutUnit bottomWidth, LayoutUnit leftWidth, LayoutUnit rightWidth) { expand(-topWidth, -bottomWidth, -leftWidth, -rightWidth); }66 void shrink( LayoutUnit size) { shrink(size, size, size, size); }63 void expand(int topWidth, int bottomWidth, int leftWidth, int rightWidth); 64 void expand(int size) { expand(size, size, size, size); } 65 void shrink(int topWidth, int bottomWidth, int leftWidth, int rightWidth) { expand(-topWidth, -bottomWidth, -leftWidth, -rightWidth); } 66 void shrink(int size) { shrink(size, size, size, size); } 67 67 68 68 private: 69 LayoutSize m_topLeft;70 LayoutSize m_topRight;71 LayoutSize m_bottomLeft;72 LayoutSize m_bottomRight;69 IntSize m_topLeft; 70 IntSize m_topRight; 71 IntSize m_bottomLeft; 72 IntSize m_bottomRight; 73 73 }; 74 74 75 explicit RoundedRect(const LayoutRect&, const Radii& = Radii());76 RoundedRect( LayoutUnit x, LayoutUnit y, LayoutUnit width, LayoutUnit height);77 RoundedRect(const LayoutRect&, const LayoutSize& topLeft, const LayoutSize& topRight, const LayoutSize& bottomLeft, const LayoutSize& bottomRight);75 explicit RoundedRect(const IntRect&, const Radii& = Radii()); 76 RoundedRect(int x, int y, int width, int height); 77 RoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight); 78 78 79 const LayoutRect& rect() const { return m_rect; }79 const IntRect& rect() const { return m_rect; } 80 80 const Radii& radii() const { return m_radii; } 81 81 bool isRounded() const { return !m_radii.isZero(); } 82 82 bool isEmpty() const { return m_rect.isEmpty(); } 83 83 84 void setRect(const LayoutRect& rect) { m_rect = rect; }84 void setRect(const IntRect& rect) { m_rect = rect; } 85 85 void setRadii(const Radii& radii) { m_radii = radii; } 86 86 87 void move(const LayoutSize& size) { m_rect.move(size); }88 void inflate( LayoutUnit size) { m_rect.inflate(size); }89 void inflateWithRadii( LayoutUnit size);90 void expandRadii( LayoutUnit size) { m_radii.expand(size); }91 void shrinkRadii( LayoutUnit size) { m_radii.shrink(size); }87 void move(const IntSize& size) { m_rect.move(size); } 88 void inflate(int size) { m_rect.inflate(size); } 89 void inflateWithRadii(int size); 90 void expandRadii(int size) { m_radii.expand(size); } 91 void shrinkRadii(int size) { m_radii.shrink(size); } 92 92 93 93 void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); … … 97 97 98 98 private: 99 LayoutRect m_rect;99 IntRect m_rect; 100 100 Radii m_radii; 101 101 }; -
trunk/Source/WebCore/rendering/svg/SVGRenderSupport.h
r96558 r98931 26 26 27 27 #if ENABLE(SVG) 28 #include "LayoutTypes.h" 28 29 #include "PaintInfo.h" 29 30
Note: See TracChangeset
for help on using the changeset viewer.