Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: third_party/WebKit/Source/core/layout/HitTestResult.cpp

Issue 1912863002: Fix image map focus ring painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
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 return map->areaForPoint(localPoint(), imageElement->layoutObject());
206 LayoutRect contentBox = box->contentBoxRect();
207 float scaleFactor = 1 / box->style()->effectiveZoom();
208 LayoutPoint location = localPoint();
209 location.scale(scaleFactor, scaleFactor);
210
211 return map->areaForPoint(location, contentBox.size());
212 } 206 }
213 207
214 void HitTestResult::setInnerNode(Node* n) 208 void HitTestResult::setInnerNode(Node* n)
215 { 209 {
216 m_innerPossiblyPseudoNode = n; 210 m_innerPossiblyPseudoNode = n;
217 if (n && n->isPseudoElement()) 211 if (n && n->isPseudoElement())
218 n = toPseudoElement(n)->findAssociatedNode(); 212 n = toPseudoElement(n)->findAssociatedNode();
219 m_innerNode = n; 213 m_innerNode = n;
220 if (HTMLAreaElement* area = imageAreaForImage()) { 214 if (HTMLAreaElement* area = imageAreaForImage()) {
221 m_innerNode = area; 215 m_innerNode = area;
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 else if (isHTMLMapElement(m_innerNode)) 534 else if (isHTMLMapElement(m_innerNode))
541 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); 535 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement();
542 536
543 if (!imageMapImageElement) 537 if (!imageMapImageElement)
544 return m_innerNode.get(); 538 return m_innerNode.get();
545 539
546 return imageMapImageElement; 540 return imageMapImageElement;
547 } 541 }
548 542
549 } // namespace blink 543 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698