| 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 18 matching lines...) Expand all Loading... |
| 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 #include "wtf/PtrUtil.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 // 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 |
| 40 // precision. |
| 40 float clampCoordinate(double value) { | 41 float clampCoordinate(double value) { |
| 41 return LayoutUnit(value).toFloat(); | 42 return LayoutUnit(value).toFloat(); |
| 42 } | 43 } |
| 43 } | 44 } |
| 44 | 45 |
| 45 using namespace HTMLNames; | 46 using namespace HTMLNames; |
| 46 | 47 |
| 47 inline HTMLAreaElement::HTMLAreaElement(Document& document) | 48 inline HTMLAreaElement::HTMLAreaElement(Document& document) |
| 48 : HTMLAnchorElement(areaTag, document), m_shape(Rect) {} | 49 : HTMLAnchorElement(areaTag, document), m_shape(Rect) {} |
| 49 | 50 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 104 |
| 104 Path path = getPath(containerObject); | 105 Path path = getPath(containerObject); |
| 105 path.translate(toFloatSize(absPos)); | 106 path.translate(toFloatSize(absPos)); |
| 106 return enclosingLayoutRect(path.boundingRect()); | 107 return enclosingLayoutRect(path.boundingRect()); |
| 107 } | 108 } |
| 108 | 109 |
| 109 Path HTMLAreaElement::getPath(const LayoutObject* containerObject) const { | 110 Path HTMLAreaElement::getPath(const LayoutObject* containerObject) const { |
| 110 if (!containerObject) | 111 if (!containerObject) |
| 111 return Path(); | 112 return Path(); |
| 112 | 113 |
| 113 // Always recompute for default shape because it depends on container object's
size | 114 // Always recompute for default shape because it depends on container object's |
| 114 // and is cheap. | 115 // size and is cheap. |
| 115 if (m_shape == Default) { | 116 if (m_shape == Default) { |
| 116 Path path; | 117 Path path; |
| 117 // No need to zoom because it is already applied in containerObject->borderB
oxRect(). | 118 // No need to zoom because it is already applied in |
| 119 // containerObject->borderBoxRect(). |
| 118 if (containerObject->isBox()) | 120 if (containerObject->isBox()) |
| 119 path.addRect(FloatRect(toLayoutBox(containerObject)->borderBoxRect())); | 121 path.addRect(FloatRect(toLayoutBox(containerObject)->borderBoxRect())); |
| 120 m_path = nullptr; | 122 m_path = nullptr; |
| 121 return path; | 123 return path; |
| 122 } | 124 } |
| 123 | 125 |
| 124 Path path; | 126 Path path; |
| 125 if (m_path) { | 127 if (m_path) { |
| 126 path = *m_path; | 128 path = *m_path; |
| 127 } else { | 129 } else { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 SelectionBehaviorOnFocus selectionBehavior) { | 224 SelectionBehaviorOnFocus selectionBehavior) { |
| 223 document().updateStyleAndLayoutTreeForNode(this); | 225 document().updateStyleAndLayoutTreeForNode(this); |
| 224 if (!isFocusable()) | 226 if (!isFocusable()) |
| 225 return; | 227 return; |
| 226 | 228 |
| 227 if (HTMLImageElement* imageElement = this->imageElement()) | 229 if (HTMLImageElement* imageElement = this->imageElement()) |
| 228 imageElement->updateFocusAppearance(selectionBehavior); | 230 imageElement->updateFocusAppearance(selectionBehavior); |
| 229 } | 231 } |
| 230 | 232 |
| 231 } // namespace blink | 233 } // namespace blink |
| OLD | NEW |