OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 University of Szeged | 2 * Copyright (C) 2011 University of Szeged |
3 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> | 3 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> |
4 * All rights reserved. | 4 * All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 m_innerStrokeRect = m_fillBoundingBox; | 75 m_innerStrokeRect = m_fillBoundingBox; |
76 m_outerStrokeRect = m_fillBoundingBox; | 76 m_outerStrokeRect = m_fillBoundingBox; |
77 | 77 |
78 if (style()->svgStyle()->hasStroke()) { | 78 if (style()->svgStyle()->hasStroke()) { |
79 float strokeWidth = this->strokeWidth(); | 79 float strokeWidth = this->strokeWidth(); |
80 m_innerStrokeRect.inflate(-strokeWidth / 2); | 80 m_innerStrokeRect.inflate(-strokeWidth / 2); |
81 m_outerStrokeRect.inflate(strokeWidth / 2); | 81 m_outerStrokeRect.inflate(strokeWidth / 2); |
82 } | 82 } |
83 | 83 |
84 m_strokeBoundingBox = m_outerStrokeRect; | 84 m_strokeBoundingBox = m_outerStrokeRect; |
85 | |
86 #if USE(CG) | |
87 // CoreGraphics can inflate the stroke by 1px when drawing a rectangle with
antialiasing disabled at non-integer coordinates, we need to compensate. | |
88 if (style()->svgStyle()->shapeRendering() == SR_CRISPEDGES) | |
89 m_strokeBoundingBox.inflate(1); | |
90 #endif | |
91 } | 85 } |
92 | 86 |
93 void RenderSVGRect::fillShape(GraphicsContext* context) const | 87 void RenderSVGRect::fillShape(GraphicsContext* context) const |
94 { | 88 { |
95 if (m_usePathFallback) { | 89 if (m_usePathFallback) { |
96 RenderSVGShape::fillShape(context); | 90 RenderSVGShape::fillShape(context); |
97 return; | 91 return; |
98 } | 92 } |
99 | 93 |
100 #if USE(CG) | |
101 // FIXME: CG implementation of GraphicsContextCG::fillRect has an own | |
102 // shadow drawing method, which draws an extra shadow. | |
103 // This is a workaround for switching off the extra shadow. | |
104 // https://bugs.webkit.org/show_bug.cgi?id=68899 | |
105 if (context->hasShadow()) { | |
106 GraphicsContextStateSaver stateSaver(*context); | |
107 context->clearShadow(); | |
108 context->fillRect(m_fillBoundingBox); | |
109 return; | |
110 } | |
111 #endif | |
112 | |
113 context->fillRect(m_fillBoundingBox); | 94 context->fillRect(m_fillBoundingBox); |
114 } | 95 } |
115 | 96 |
116 void RenderSVGRect::strokeShape(GraphicsContext* context) const | 97 void RenderSVGRect::strokeShape(GraphicsContext* context) const |
117 { | 98 { |
118 if (!style()->svgStyle()->hasVisibleStroke()) | 99 if (!style()->svgStyle()->hasVisibleStroke()) |
119 return; | 100 return; |
120 | 101 |
121 if (m_usePathFallback) { | 102 if (m_usePathFallback) { |
122 RenderSVGShape::strokeShape(context); | 103 RenderSVGShape::strokeShape(context); |
(...skipping 19 matching lines...) Expand all Loading... |
142 bool RenderSVGRect::shapeDependentFillContains(const FloatPoint& point, const Wi
ndRule fillRule) const | 123 bool RenderSVGRect::shapeDependentFillContains(const FloatPoint& point, const Wi
ndRule fillRule) const |
143 { | 124 { |
144 if (m_usePathFallback) | 125 if (m_usePathFallback) |
145 return RenderSVGShape::shapeDependentFillContains(point, fillRule); | 126 return RenderSVGShape::shapeDependentFillContains(point, fillRule); |
146 return m_fillBoundingBox.contains(point.x(), point.y()); | 127 return m_fillBoundingBox.contains(point.x(), point.y()); |
147 } | 128 } |
148 | 129 |
149 } | 130 } |
150 | 131 |
151 #endif // ENABLE(SVG) | 132 #endif // ENABLE(SVG) |
OLD | NEW |