| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 if (!m_region->contains(FloatPoint(location))) | 81 if (!m_region->contains(FloatPoint(location))) |
| 82 return false; | 82 return false; |
| 83 | 83 |
| 84 result.setInnerNode(this); | 84 result.setInnerNode(this); |
| 85 result.setURLElement(this); | 85 result.setURLElement(this); |
| 86 return true; | 86 return true; |
| 87 } | 87 } |
| 88 | 88 |
| 89 Path HTMLAreaElement::computePath(RenderObject* obj) const | 89 Path HTMLAreaElement::computePath(LayoutObject* obj) const |
| 90 { | 90 { |
| 91 if (!obj) | 91 if (!obj) |
| 92 return Path(); | 92 return Path(); |
| 93 | 93 |
| 94 // FIXME: This doesn't work correctly with transforms. | 94 // FIXME: This doesn't work correctly with transforms. |
| 95 FloatPoint absPos = obj->localToAbsolute(); | 95 FloatPoint absPos = obj->localToAbsolute(); |
| 96 | 96 |
| 97 // Default should default to the size of the containing object. | 97 // Default should default to the size of the containing object. |
| 98 LayoutSize size = m_lastSize; | 98 LayoutSize size = m_lastSize; |
| 99 if (m_shape == Default) | 99 if (m_shape == Default) |
| 100 size = obj->absoluteClippedOverflowRect().size(); | 100 size = obj->absoluteClippedOverflowRect().size(); |
| 101 | 101 |
| 102 Path p = getRegion(size); | 102 Path p = getRegion(size); |
| 103 float zoomFactor = obj->style()->effectiveZoom(); | 103 float zoomFactor = obj->style()->effectiveZoom(); |
| 104 if (zoomFactor != 1.0f) { | 104 if (zoomFactor != 1.0f) { |
| 105 AffineTransform zoomTransform; | 105 AffineTransform zoomTransform; |
| 106 zoomTransform.scale(zoomFactor); | 106 zoomTransform.scale(zoomFactor); |
| 107 p.transform(zoomTransform); | 107 p.transform(zoomTransform); |
| 108 } | 108 } |
| 109 | 109 |
| 110 p.translate(toFloatSize(absPos)); | 110 p.translate(toFloatSize(absPos)); |
| 111 return p; | 111 return p; |
| 112 } | 112 } |
| 113 | 113 |
| 114 LayoutRect HTMLAreaElement::computeRect(RenderObject* obj) const | 114 LayoutRect HTMLAreaElement::computeRect(LayoutObject* obj) const |
| 115 { | 115 { |
| 116 return enclosingLayoutRect(computePath(obj).boundingRect()); | 116 return enclosingLayoutRect(computePath(obj).boundingRect()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 Path HTMLAreaElement::getRegion(const LayoutSize& size) const | 119 Path HTMLAreaElement::getRegion(const LayoutSize& size) const |
| 120 { | 120 { |
| 121 if (m_coords.isEmpty() && m_shape != Default) | 121 if (m_coords.isEmpty() && m_shape != Default) |
| 122 return Path(); | 122 return Path(); |
| 123 | 123 |
| 124 LayoutUnit width = size.width(); | 124 LayoutUnit width = size.width(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 { | 202 { |
| 203 if (focused() == shouldBeFocused) | 203 if (focused() == shouldBeFocused) |
| 204 return; | 204 return; |
| 205 | 205 |
| 206 HTMLAnchorElement::setFocus(shouldBeFocused); | 206 HTMLAnchorElement::setFocus(shouldBeFocused); |
| 207 | 207 |
| 208 HTMLImageElement* imageElement = this->imageElement(); | 208 HTMLImageElement* imageElement = this->imageElement(); |
| 209 if (!imageElement) | 209 if (!imageElement) |
| 210 return; | 210 return; |
| 211 | 211 |
| 212 RenderObject* renderer = imageElement->renderer(); | 212 LayoutObject* renderer = imageElement->renderer(); |
| 213 if (!renderer || !renderer->isImage()) | 213 if (!renderer || !renderer->isImage()) |
| 214 return; | 214 return; |
| 215 | 215 |
| 216 toRenderImage(renderer)->areaElementFocusChanged(this); | 216 toRenderImage(renderer)->areaElementFocusChanged(this); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void HTMLAreaElement::updateFocusAppearance(bool restorePreviousSelection) | 219 void HTMLAreaElement::updateFocusAppearance(bool restorePreviousSelection) |
| 220 { | 220 { |
| 221 if (!isFocusable()) | 221 if (!isFocusable()) |
| 222 return; | 222 return; |
| 223 | 223 |
| 224 HTMLImageElement* imageElement = this->imageElement(); | 224 HTMLImageElement* imageElement = this->imageElement(); |
| 225 if (!imageElement) | 225 if (!imageElement) |
| 226 return; | 226 return; |
| 227 | 227 |
| 228 imageElement->updateFocusAppearance(restorePreviousSelection); | 228 imageElement->updateFocusAppearance(restorePreviousSelection); |
| 229 } | 229 } |
| 230 | 230 |
| 231 } | 231 } |
| OLD | NEW |