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

Side by Side Diff: Source/core/html/HTMLMapElement.cpp

Issue 189923002: Use new Traversal<HTML*Element> API in HTML code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/html/HTMLFieldSetElement.cpp ('k') | Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, 2007, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2010 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 return adoptRef(new HTMLMapElement(document)); 47 return adoptRef(new HTMLMapElement(document));
48 } 48 }
49 49
50 HTMLMapElement::~HTMLMapElement() 50 HTMLMapElement::~HTMLMapElement()
51 { 51 {
52 } 52 }
53 53
54 bool HTMLMapElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size, HitTestResult& result) 54 bool HTMLMapElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size, HitTestResult& result)
55 { 55 {
56 HTMLAreaElement* defaultArea = 0; 56 HTMLAreaElement* defaultArea = 0;
57 Element* element = this; 57 for (HTMLAreaElement* area = Traversal<HTMLAreaElement>::firstWithin(*this); area; area = Traversal<HTMLAreaElement>::next(*area, this)) {
58 while ((element = ElementTraversal::next(*element, this))) { 58 if (area->isDefault()) {
59 if (element->hasTagName(areaTag)) { 59 if (!defaultArea)
60 HTMLAreaElement* areaElt = toHTMLAreaElement(element); 60 defaultArea = area;
61 if (areaElt->isDefault()) { 61 } else if (area->mapMouseEvent(location, size, result)) {
62 if (!defaultArea) 62 return true;
63 defaultArea = areaElt;
64 } else if (areaElt->mapMouseEvent(location, size, result))
65 return true;
66 } 63 }
67 } 64 }
68 65
69 if (defaultArea) { 66 if (defaultArea) {
70 result.setInnerNode(defaultArea); 67 result.setInnerNode(defaultArea);
71 result.setURLElement(defaultArea); 68 result.setURLElement(defaultArea);
72 } 69 }
73 return defaultArea; 70 return defaultArea;
74 } 71 }
75 72
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 128 }
132 129
133 void HTMLMapElement::removedFrom(ContainerNode* insertionPoint) 130 void HTMLMapElement::removedFrom(ContainerNode* insertionPoint)
134 { 131 {
135 if (insertionPoint->inDocument()) 132 if (insertionPoint->inDocument())
136 treeScope().removeImageMap(this); 133 treeScope().removeImageMap(this);
137 HTMLElement::removedFrom(insertionPoint); 134 HTMLElement::removedFrom(insertionPoint);
138 } 135 }
139 136
140 } 137 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFieldSetElement.cpp ('k') | Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698