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

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

Issue 1094133004: Image maps should work for images with alt content (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 } 153 }
154 } 154 }
155 155
156 void HitTestResult::setInnerNode(Node* n) 156 void HitTestResult::setInnerNode(Node* n)
157 { 157 {
158 m_innerPossiblyPseudoNode = n; 158 m_innerPossiblyPseudoNode = n;
159 if (n && n->isPseudoElement()) 159 if (n && n->isPseudoElement())
160 n = toPseudoElement(n)->findAssociatedNode(); 160 n = toPseudoElement(n)->findAssociatedNode();
161 m_innerNode = n; 161 m_innerNode = n;
162
pdr. 2015/04/24 21:48:23 Instead of duplicating this logic here, what if we
163 Element* shadowHost = n->shadowHost();
164 if (!shadowHost || !isHTMLImageElement(shadowHost))
165 return;
166 HTMLMapElement* map = toHTMLImageElement(shadowHost)->treeScope().getImageMa p(toHTMLImageElement(shadowHost)->fastGetAttribute(usemapAttr));
167 if (!map)
168 return;
169 if (HTMLAreaElement* area = map->areaForPoint(localPoint(), toLayoutBox(layo utObject())->contentBoxRect().size()))
170 m_innerNode = area;
162 } 171 }
163 172
164 void HitTestResult::setURLElement(Element* n) 173 void HitTestResult::setURLElement(Element* n)
165 { 174 {
166 m_innerURLElement = n; 175 m_innerURLElement = n;
167 } 176 }
168 177
169 void HitTestResult::setScrollbar(Scrollbar* s) 178 void HitTestResult::setScrollbar(Scrollbar* s)
170 { 179 {
171 m_scrollbar = s; 180 m_scrollbar = s;
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 else if (isHTMLMapElement(m_innerNode)) 487 else if (isHTMLMapElement(m_innerNode))
479 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); 488 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement();
480 489
481 if (!imageMapImageElement) 490 if (!imageMapImageElement)
482 return m_innerNode.get(); 491 return m_innerNode.get();
483 492
484 return imageMapImageElement; 493 return imageMapImageElement;
485 } 494 }
486 495
487 } // namespace blink 496 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698