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

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

Issue 1032823003: Refactor HitTestResult to store the HitTestRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
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 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com)
6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 9 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
10 * 10 *
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 { 262 {
263 return m_imageResource->errorOccurred() ? intrinsicSize().height() : LayoutU nit(); 263 return m_imageResource->errorOccurred() ? intrinsicSize().height() : LayoutU nit();
264 } 264 }
265 265
266 HTMLMapElement* LayoutImage::imageMap() const 266 HTMLMapElement* LayoutImage::imageMap() const
267 { 267 {
268 HTMLImageElement* i = isHTMLImageElement(node()) ? toHTMLImageElement(node() ) : 0; 268 HTMLImageElement* i = isHTMLImageElement(node()) ? toHTMLImageElement(node() ) : 0;
269 return i ? i->treeScope().getImageMap(i->fastGetAttribute(usemapAttr)) : 0; 269 return i ? i->treeScope().getImageMap(i->fastGetAttribute(usemapAttr)) : 0;
270 } 270 }
271 271
272 bool LayoutImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf fset, HitTestAction hitTestAction) 272 bool LayoutImage::nodeAtPoint(HitTestResult& result, const HitTestLocation& loca tionInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestActi on)
273 { 273 {
274 HitTestResult tempResult(result.hitTestLocation()); 274 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation());
275 bool inside = LayoutReplaced::nodeAtPoint(request, tempResult, locationInCon tainer, accumulatedOffset, hitTestAction); 275 bool inside = LayoutReplaced::nodeAtPoint(tempResult, locationInContainer, a ccumulatedOffset, hitTestAction);
276 276
277 if (tempResult.innerNode() && node()) { 277 if (tempResult.innerNode() && node()) {
278 if (HTMLMapElement* map = imageMap()) { 278 if (HTMLMapElement* map = imageMap()) {
279 LayoutRect contentBox = contentBoxRect(); 279 LayoutRect contentBox = contentBoxRect();
280 float scaleFactor = 1 / style()->effectiveZoom(); 280 float scaleFactor = 1 / style()->effectiveZoom();
281 LayoutPoint mapLocation = locationInContainer.point() - toLayoutSize (accumulatedOffset) - locationOffset() - toLayoutSize(contentBox.location()); 281 LayoutPoint mapLocation = locationInContainer.point() - toLayoutSize (accumulatedOffset) - locationOffset() - toLayoutSize(contentBox.location());
282 mapLocation.scale(scaleFactor, scaleFactor); 282 mapLocation.scale(scaleFactor, scaleFactor);
283 283
284 if (map->mapMouseEvent(mapLocation, contentBox.size(), tempResult)) 284 if (map->mapMouseEvent(mapLocation, contentBox.size(), tempResult))
285 tempResult.setInnerNonSharedNode(node()); 285 tempResult.setInnerNonSharedNode(node());
286 } 286 }
287 } 287 }
288 288
289 if (!inside && request.listBased()) 289 if (!inside && result.hitTestRequest().listBased())
290 result.append(tempResult, request); 290 result.append(tempResult);
291 if (inside) 291 if (inside)
292 result = tempResult; 292 result = tempResult;
293 return inside; 293 return inside;
294 } 294 }
295 295
296 void LayoutImage::layout() 296 void LayoutImage::layout()
297 { 297 {
298 LayoutReplaced::layout(); 298 LayoutReplaced::layout();
299 updateInnerContentRect(); 299 updateInnerContentRect();
300 } 300 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 return 0; 363 return 0;
364 364
365 ImageResource* cachedImage = m_imageResource->cachedImage(); 365 ImageResource* cachedImage = m_imageResource->cachedImage();
366 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage( )) 366 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage( ))
367 return toSVGImage(cachedImage->image())->embeddedContentBox(); 367 return toSVGImage(cachedImage->image())->embeddedContentBox();
368 368
369 return 0; 369 return 0;
370 } 370 }
371 371
372 } // namespace blink 372 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698