OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2009, 2011 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2009, 2011 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 #include "core/HTMLNames.h" | 24 #include "core/HTMLNames.h" |
25 #include "core/dom/ElementTraversal.h" | 25 #include "core/dom/ElementTraversal.h" |
26 #include "core/html/HTMLImageElement.h" | 26 #include "core/html/HTMLImageElement.h" |
27 #include "core/html/HTMLMapElement.h" | 27 #include "core/html/HTMLMapElement.h" |
28 #include "core/html/parser/HTMLParserIdioms.h" | 28 #include "core/html/parser/HTMLParserIdioms.h" |
29 #include "core/layout/HitTestResult.h" | 29 #include "core/layout/HitTestResult.h" |
30 #include "core/layout/LayoutImage.h" | 30 #include "core/layout/LayoutImage.h" |
31 #include "platform/graphics/Path.h" | 31 #include "platform/graphics/Path.h" |
32 #include "platform/transforms/AffineTransform.h" | 32 #include "platform/transforms/AffineTransform.h" |
| 33 #include "wtf/PtrUtil.h" |
33 | 34 |
34 namespace blink { | 35 namespace blink { |
35 | 36 |
36 namespace { | 37 namespace { |
37 | 38 |
38 // Adapt a double to the allowed range of a LayoutUnit and narrow it to float pr
ecision. | 39 // Adapt a double to the allowed range of a LayoutUnit and narrow it to float pr
ecision. |
39 float clampCoordinate(double value) | 40 float clampCoordinate(double value) |
40 { | 41 { |
41 return LayoutUnit(value).toFloat(); | 42 return LayoutUnit(value).toFloat(); |
42 } | 43 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 float y1 = clampCoordinate(m_coords[3]); | 159 float y1 = clampCoordinate(m_coords[3]); |
159 path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0)); | 160 path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0)); |
160 } | 161 } |
161 break; | 162 break; |
162 default: | 163 default: |
163 ASSERT_NOT_REACHED(); | 164 ASSERT_NOT_REACHED(); |
164 break; | 165 break; |
165 } | 166 } |
166 | 167 |
167 // Cache the original path, not depending on containerObject. | 168 // Cache the original path, not depending on containerObject. |
168 m_path = adoptPtr(new Path(path)); | 169 m_path = wrapUnique(new Path(path)); |
169 } | 170 } |
170 | 171 |
171 // Zoom the path into coordinates of the container object. | 172 // Zoom the path into coordinates of the container object. |
172 float zoomFactor = containerObject->styleRef().effectiveZoom(); | 173 float zoomFactor = containerObject->styleRef().effectiveZoom(); |
173 if (zoomFactor != 1.0f) { | 174 if (zoomFactor != 1.0f) { |
174 AffineTransform zoomTransform; | 175 AffineTransform zoomTransform; |
175 zoomTransform.scale(zoomFactor); | 176 zoomTransform.scale(zoomFactor); |
176 path.transform(zoomTransform); | 177 path.transform(zoomTransform); |
177 } | 178 } |
178 return path; | 179 return path; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 { | 227 { |
227 document().updateStyleAndLayoutTreeForNode(this); | 228 document().updateStyleAndLayoutTreeForNode(this); |
228 if (!isFocusable()) | 229 if (!isFocusable()) |
229 return; | 230 return; |
230 | 231 |
231 if (HTMLImageElement* imageElement = this->imageElement()) | 232 if (HTMLImageElement* imageElement = this->imageElement()) |
232 imageElement->updateFocusAppearance(selectionBehavior); | 233 imageElement->updateFocusAppearance(selectionBehavior); |
233 } | 234 } |
234 | 235 |
235 } // namespace blink | 236 } // namespace blink |
OLD | NEW |