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

Side by Side Diff: sky/engine/core/rendering/HitTestResult.cpp

Issue 1228463002: Remove RenderImage (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « sky/engine/core/loader/ImageLoader.cpp ('k') | sky/engine/core/rendering/RenderImage.h » ('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) 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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 * 19 *
20 */ 20 */
21 21
22 #include "sky/engine/core/rendering/HitTestResult.h" 22 #include "sky/engine/core/rendering/HitTestResult.h"
23 23
24 #include "gen/sky/core/HTMLNames.h" 24 #include "gen/sky/core/HTMLNames.h"
25 #include "sky/engine/core/dom/DocumentMarkerController.h" 25 #include "sky/engine/core/dom/DocumentMarkerController.h"
26 #include "sky/engine/core/dom/NodeRenderingTraversal.h" 26 #include "sky/engine/core/dom/NodeRenderingTraversal.h"
27 #include "sky/engine/core/dom/shadow/ShadowRoot.h" 27 #include "sky/engine/core/dom/shadow/ShadowRoot.h"
28 #include "sky/engine/core/editing/FrameSelection.h" 28 #include "sky/engine/core/editing/FrameSelection.h"
29 #include "sky/engine/core/frame/LocalFrame.h" 29 #include "sky/engine/core/frame/LocalFrame.h"
30 #include "sky/engine/core/rendering/RenderImage.h" 30 #include "sky/engine/core/rendering/RenderBox.h"
31 #include "sky/engine/core/rendering/RenderObject.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 HitTestResult::HitTestResult() 35 HitTestResult::HitTestResult()
35 { 36 {
36 } 37 }
37 38
38 HitTestResult::HitTestResult(const LayoutPoint& point) 39 HitTestResult::HitTestResult(const LayoutPoint& point)
39 : m_hitTestLocation(point) 40 : m_hitTestLocation(point)
40 , m_pointInInnerNodeFrame(point) 41 , m_pointInInnerNodeFrame(point)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (!m_innerNonSharedNode) 127 if (!m_innerNonSharedNode)
127 return false; 128 return false;
128 129
129 if (LocalFrame* frame = m_innerNonSharedNode->document().frame()) 130 if (LocalFrame* frame = m_innerNonSharedNode->document().frame())
130 return frame->selection().contains(m_hitTestLocation.point()); 131 return frame->selection().contains(m_hitTestLocation.point());
131 return false; 132 return false;
132 } 133 }
133 134
134 Image* HitTestResult::image() const 135 Image* HitTestResult::image() const
135 { 136 {
136 if (!m_innerNonSharedNode)
137 return 0;
138
139 RenderObject* renderer = m_innerNonSharedNode->renderer();
140 if (renderer && renderer->isImage()) {
141 RenderImage* image = toRenderImage(renderer);
142 if (image->cachedImage() && !image->cachedImage()->errorOccurred())
143 return image->cachedImage()->imageForRenderer(image);
144 }
145
146 return 0; 137 return 0;
147 } 138 }
148 139
149 IntRect HitTestResult::imageRect() const 140 IntRect HitTestResult::imageRect() const
150 { 141 {
151 if (!image()) 142 if (!image())
152 return IntRect(); 143 return IntRect();
153 return m_innerNonSharedNode->renderBox()->absoluteContentQuad().enclosingBou ndingBox(); 144 return m_innerNonSharedNode->renderBox()->absoluteContentQuad().enclosingBou ndingBox();
154 } 145 }
155 146
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 { 251 {
261 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) { 252 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node)) {
262 if (node->isElementNode()) 253 if (node->isElementNode())
263 return toElement(node); 254 return toElement(node);
264 } 255 }
265 256
266 return 0; 257 return 0;
267 } 258 }
268 259
269 } // namespace blink 260 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/loader/ImageLoader.cpp ('k') | sky/engine/core/rendering/RenderImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698