OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 } | 196 } |
197 | 197 |
198 if (!imageElement || !imageElement->layoutObject() || !imageElement->layoutO
bject()->isBox()) | 198 if (!imageElement || !imageElement->layoutObject() || !imageElement->layoutO
bject()->isBox()) |
199 return nullptr; | 199 return nullptr; |
200 | 200 |
201 HTMLMapElement* map = imageElement->treeScope().getImageMap(imageElement->fa
stGetAttribute(usemapAttr)); | 201 HTMLMapElement* map = imageElement->treeScope().getImageMap(imageElement->fa
stGetAttribute(usemapAttr)); |
202 if (!map) | 202 if (!map) |
203 return nullptr; | 203 return nullptr; |
204 | 204 |
205 LayoutBox* box = toLayoutBox(imageElement->layoutObject()); | 205 LayoutBox* box = toLayoutBox(imageElement->layoutObject()); |
206 LayoutRect contentBox = box->contentBoxRect(); | |
207 float scaleFactor = 1 / box->style()->effectiveZoom(); | 206 float scaleFactor = 1 / box->style()->effectiveZoom(); |
208 LayoutPoint location = localPoint(); | 207 LayoutPoint location = localPoint(); |
209 location.scale(scaleFactor, scaleFactor); | 208 location.scale(scaleFactor, scaleFactor); |
210 | 209 |
211 return map->areaForPoint(location, contentBox.size()); | 210 return map->areaForPoint(location, box); |
212 } | 211 } |
213 | 212 |
214 void HitTestResult::setInnerNode(Node* n) | 213 void HitTestResult::setInnerNode(Node* n) |
215 { | 214 { |
216 m_innerPossiblyPseudoNode = n; | 215 m_innerPossiblyPseudoNode = n; |
217 if (n && n->isPseudoElement()) | 216 if (n && n->isPseudoElement()) |
218 n = toPseudoElement(n)->findAssociatedNode(); | 217 n = toPseudoElement(n)->findAssociatedNode(); |
219 m_innerNode = n; | 218 m_innerNode = n; |
220 if (HTMLAreaElement* area = imageAreaForImage()) { | 219 if (HTMLAreaElement* area = imageAreaForImage()) { |
221 m_innerNode = area; | 220 m_innerNode = area; |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 else if (isHTMLMapElement(m_innerNode)) | 539 else if (isHTMLMapElement(m_innerNode)) |
541 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); | 540 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); |
542 | 541 |
543 if (!imageMapImageElement) | 542 if (!imageMapImageElement) |
544 return m_innerNode.get(); | 543 return m_innerNode.get(); |
545 | 544 |
546 return imageMapImageElement; | 545 return imageMapImageElement; |
547 } | 546 } |
548 | 547 |
549 } // namespace blink | 548 } // namespace blink |
OLD | NEW |