| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/BoxBorderPainter.h" | 6 #include "core/paint/BoxBorderPainter.h" |
| 7 | 7 |
| 8 #include "core/paint/BoxPainter.h" | 8 #include "core/paint/BoxPainter.h" |
| 9 #include "core/paint/PaintInfo.h" | 9 #include "core/paint/PaintInfo.h" |
| 10 #include "core/style/BorderEdge.h" | 10 #include "core/style/BorderEdge.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 switch (side) { | 177 switch (side) { |
| 178 case BSTop: | 178 case BSTop: |
| 179 overshoot = newRadii.topLeft().width() + newRadii.topRight().width() - n
ewRect.width(); | 179 overshoot = newRadii.topLeft().width() + newRadii.topRight().width() - n
ewRect.width(); |
| 180 // FIXME: once we start pixel-snapping rounded rects after this point, t
he overshoot concept | 180 // FIXME: once we start pixel-snapping rounded rects after this point, t
he overshoot concept |
| 181 // should disappear. | 181 // should disappear. |
| 182 if (overshoot > 0.1) { | 182 if (overshoot > 0.1) { |
| 183 newRect.setWidth(newRect.width() + overshoot); | 183 newRect.setWidth(newRect.width() + overshoot); |
| 184 if (!newRadii.topLeft().width()) | 184 if (!newRadii.topLeft().width()) |
| 185 newRect.move(-overshoot, 0); | 185 newRect.move(-overshoot, 0); |
| 186 } | 186 } |
| 187 newRadii.setBottomLeft(IntSize(0, 0)); | 187 newRadii.setBottomLeft(FloatSize(0, 0)); |
| 188 newRadii.setBottomRight(IntSize(0, 0)); | 188 newRadii.setBottomRight(FloatSize(0, 0)); |
| 189 maxRadii = std::max(newRadii.topLeft().height(), newRadii.topRight().hei
ght()); | 189 maxRadii = std::max(newRadii.topLeft().height(), newRadii.topRight().hei
ght()); |
| 190 if (maxRadii > newRect.height()) | 190 if (maxRadii > newRect.height()) |
| 191 newRect.setHeight(maxRadii); | 191 newRect.setHeight(maxRadii); |
| 192 break; | 192 break; |
| 193 | 193 |
| 194 case BSBottom: | 194 case BSBottom: |
| 195 overshoot = newRadii.bottomLeft().width() + newRadii.bottomRight().width
() - newRect.width(); | 195 overshoot = newRadii.bottomLeft().width() + newRadii.bottomRight().width
() - newRect.width(); |
| 196 if (overshoot > 0.1) { | 196 if (overshoot > 0.1) { |
| 197 newRect.setWidth(newRect.width() + overshoot); | 197 newRect.setWidth(newRect.width() + overshoot); |
| 198 if (!newRadii.bottomLeft().width()) | 198 if (!newRadii.bottomLeft().width()) |
| 199 newRect.move(-overshoot, 0); | 199 newRect.move(-overshoot, 0); |
| 200 } | 200 } |
| 201 newRadii.setTopLeft(IntSize(0, 0)); | 201 newRadii.setTopLeft(FloatSize(0, 0)); |
| 202 newRadii.setTopRight(IntSize(0, 0)); | 202 newRadii.setTopRight(FloatSize(0, 0)); |
| 203 maxRadii = std::max(newRadii.bottomLeft().height(), newRadii.bottomRight
().height()); | 203 maxRadii = std::max(newRadii.bottomLeft().height(), newRadii.bottomRight
().height()); |
| 204 if (maxRadii > newRect.height()) { | 204 if (maxRadii > newRect.height()) { |
| 205 newRect.move(0, newRect.height() - maxRadii); | 205 newRect.move(0, newRect.height() - maxRadii); |
| 206 newRect.setHeight(maxRadii); | 206 newRect.setHeight(maxRadii); |
| 207 } | 207 } |
| 208 break; | 208 break; |
| 209 | 209 |
| 210 case BSLeft: | 210 case BSLeft: |
| 211 overshoot = newRadii.topLeft().height() + newRadii.bottomLeft().height()
- newRect.height(); | 211 overshoot = newRadii.topLeft().height() + newRadii.bottomLeft().height()
- newRect.height(); |
| 212 if (overshoot > 0.1) { | 212 if (overshoot > 0.1) { |
| 213 newRect.setHeight(newRect.height() + overshoot); | 213 newRect.setHeight(newRect.height() + overshoot); |
| 214 if (!newRadii.topLeft().height()) | 214 if (!newRadii.topLeft().height()) |
| 215 newRect.move(0, -overshoot); | 215 newRect.move(0, -overshoot); |
| 216 } | 216 } |
| 217 newRadii.setTopRight(IntSize(0, 0)); | 217 newRadii.setTopRight(FloatSize(0, 0)); |
| 218 newRadii.setBottomRight(IntSize(0, 0)); | 218 newRadii.setBottomRight(FloatSize(0, 0)); |
| 219 maxRadii = std::max(newRadii.topLeft().width(), newRadii.bottomLeft().wi
dth()); | 219 maxRadii = std::max(newRadii.topLeft().width(), newRadii.bottomLeft().wi
dth()); |
| 220 if (maxRadii > newRect.width()) | 220 if (maxRadii > newRect.width()) |
| 221 newRect.setWidth(maxRadii); | 221 newRect.setWidth(maxRadii); |
| 222 break; | 222 break; |
| 223 | 223 |
| 224 case BSRight: | 224 case BSRight: |
| 225 overshoot = newRadii.topRight().height() + newRadii.bottomRight().height
() - newRect.height(); | 225 overshoot = newRadii.topRight().height() + newRadii.bottomRight().height
() - newRect.height(); |
| 226 if (overshoot > 0.1) { | 226 if (overshoot > 0.1) { |
| 227 newRect.setHeight(newRect.height() + overshoot); | 227 newRect.setHeight(newRect.height() + overshoot); |
| 228 if (!newRadii.topRight().height()) | 228 if (!newRadii.topRight().height()) |
| 229 newRect.move(0, -overshoot); | 229 newRect.move(0, -overshoot); |
| 230 } | 230 } |
| 231 newRadii.setTopLeft(IntSize(0, 0)); | 231 newRadii.setTopLeft(FloatSize(0, 0)); |
| 232 newRadii.setBottomLeft(IntSize(0, 0)); | 232 newRadii.setBottomLeft(FloatSize(0, 0)); |
| 233 maxRadii = std::max(newRadii.topRight().width(), newRadii.bottomRight().
width()); | 233 maxRadii = std::max(newRadii.topRight().width(), newRadii.bottomRight().
width()); |
| 234 if (maxRadii > newRect.width()) { | 234 if (maxRadii > newRect.width()) { |
| 235 newRect.move(newRect.width() - maxRadii, 0); | 235 newRect.move(newRect.width() - maxRadii, 0); |
| 236 newRect.setWidth(maxRadii); | 236 newRect.setWidth(maxRadii); |
| 237 } | 237 } |
| 238 break; | 238 break; |
| 239 } | 239 } |
| 240 | 240 |
| 241 return FloatRoundedRect(newRect, newRadii); | 241 return FloatRoundedRect(newRect, newRadii); |
| 242 } | 242 } |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 FloatPoint secondQuad[4]; | 1195 FloatPoint secondQuad[4]; |
| 1196 secondQuad[0] = quad[0]; | 1196 secondQuad[0] = quad[0]; |
| 1197 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy)
; | 1197 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy)
; |
| 1198 secondQuad[2] = quad[2]; | 1198 secondQuad[2] = quad[2]; |
| 1199 secondQuad[3] = quad[3]; | 1199 secondQuad[3] = quad[3]; |
| 1200 graphicsContext->clipPolygon(4, secondQuad, secondMiter == SoftMiter); | 1200 graphicsContext->clipPolygon(4, secondQuad, secondMiter == SoftMiter); |
| 1201 } | 1201 } |
| 1202 } | 1202 } |
| 1203 | 1203 |
| 1204 } // namespace blink | 1204 } // namespace blink |
| OLD | NEW |