| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 float y = rect->yCurrentValue().value(lengthContext); | 126 float y = rect->yCurrentValue().value(lengthContext); |
| 127 bool hasRx = rect->rxCurrentValue().value(lengthContext) > 0; | 127 bool hasRx = rect->rxCurrentValue().value(lengthContext) > 0; |
| 128 bool hasRy = rect->ryCurrentValue().value(lengthContext) > 0; | 128 bool hasRy = rect->ryCurrentValue().value(lengthContext) > 0; |
| 129 if (hasRx || hasRy) { | 129 if (hasRx || hasRy) { |
| 130 float rx = rect->rxCurrentValue().value(lengthContext); | 130 float rx = rect->rxCurrentValue().value(lengthContext); |
| 131 float ry = rect->ryCurrentValue().value(lengthContext); | 131 float ry = rect->ryCurrentValue().value(lengthContext); |
| 132 if (!hasRx) | 132 if (!hasRx) |
| 133 rx = ry; | 133 rx = ry; |
| 134 else if (!hasRy) | 134 else if (!hasRy) |
| 135 ry = rx; | 135 ry = rx; |
| 136 // FIXME: We currently enforce using beziers here, as at least on CoreGr
aphics/Lion, as | 136 |
| 137 // the native method uses a different line dash origin, causing svg/cust
om/dashOrigin.svg to fail. | 137 path.addRoundedRect(FloatRect(x, y, width, height), FloatSize(rx, ry)); |
| 138 // See bug https://bugs.webkit.org/show_bug.cgi?id=79932 which tracks th
is issue. | |
| 139 path.addRoundedRect(FloatRect(x, y, width, height), FloatSize(rx, ry), P
ath::PreferBezierRoundedRect); | |
| 140 return; | 138 return; |
| 141 } | 139 } |
| 142 | 140 |
| 143 path.addRect(FloatRect(x, y, width, height)); | 141 path.addRect(FloatRect(x, y, width, height)); |
| 144 } | 142 } |
| 145 | 143 |
| 146 void updatePathFromGraphicsElement(SVGElement* element, Path& path) | 144 void updatePathFromGraphicsElement(SVGElement* element, Path& path) |
| 147 { | 145 { |
| 148 ASSERT(element); | 146 ASSERT(element); |
| 149 ASSERT(path.isEmpty()); | 147 ASSERT(path.isEmpty()); |
| 150 | 148 |
| 151 typedef void (*PathUpdateFunction)(SVGElement*, Path&); | 149 typedef void (*PathUpdateFunction)(SVGElement*, Path&); |
| 152 static HashMap<AtomicStringImpl*, PathUpdateFunction>* map = 0; | 150 static HashMap<AtomicStringImpl*, PathUpdateFunction>* map = 0; |
| 153 if (!map) { | 151 if (!map) { |
| 154 map = new HashMap<AtomicStringImpl*, PathUpdateFunction>; | 152 map = new HashMap<AtomicStringImpl*, PathUpdateFunction>; |
| 155 map->set(SVGNames::circleTag.localName().impl(), updatePathFromCircleEle
ment); | 153 map->set(SVGNames::circleTag.localName().impl(), updatePathFromCircleEle
ment); |
| 156 map->set(SVGNames::ellipseTag.localName().impl(), updatePathFromEllipseE
lement); | 154 map->set(SVGNames::ellipseTag.localName().impl(), updatePathFromEllipseE
lement); |
| 157 map->set(SVGNames::lineTag.localName().impl(), updatePathFromLineElement
); | 155 map->set(SVGNames::lineTag.localName().impl(), updatePathFromLineElement
); |
| 158 map->set(SVGNames::pathTag.localName().impl(), updatePathFromPathElement
); | 156 map->set(SVGNames::pathTag.localName().impl(), updatePathFromPathElement
); |
| 159 map->set(SVGNames::polygonTag.localName().impl(), updatePathFromPolygonE
lement); | 157 map->set(SVGNames::polygonTag.localName().impl(), updatePathFromPolygonE
lement); |
| 160 map->set(SVGNames::polylineTag.localName().impl(), updatePathFromPolylin
eElement); | 158 map->set(SVGNames::polylineTag.localName().impl(), updatePathFromPolylin
eElement); |
| 161 map->set(SVGNames::rectTag.localName().impl(), updatePathFromRectElement
); | 159 map->set(SVGNames::rectTag.localName().impl(), updatePathFromRectElement
); |
| 162 } | 160 } |
| 163 | 161 |
| 164 if (PathUpdateFunction pathUpdateFunction = map->get(element->localName().im
pl())) | 162 if (PathUpdateFunction pathUpdateFunction = map->get(element->localName().im
pl())) |
| 165 (*pathUpdateFunction)(element, path); | 163 (*pathUpdateFunction)(element, path); |
| 166 } | 164 } |
| 167 | 165 |
| 168 } // namespace WebCore | 166 } // namespace WebCore |
| OLD | NEW |