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

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: Updating as per review comments 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
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 { 287 {
288 return m_imageResource->errorOccurred() ? intrinsicSize().height() : LayoutU nit(); 288 return m_imageResource->errorOccurred() ? intrinsicSize().height() : LayoutU nit();
289 } 289 }
290 290
291 HTMLMapElement* LayoutImage::imageMap() const 291 HTMLMapElement* LayoutImage::imageMap() const
292 { 292 {
293 HTMLImageElement* i = isHTMLImageElement(node()) ? toHTMLImageElement(node() ) : 0; 293 HTMLImageElement* i = isHTMLImageElement(node()) ? toHTMLImageElement(node() ) : 0;
294 return i ? i->treeScope().getImageMap(i->fastGetAttribute(usemapAttr)) : 0; 294 return i ? i->treeScope().getImageMap(i->fastGetAttribute(usemapAttr)) : 0;
295 } 295 }
296 296
297 bool LayoutImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf fset, HitTestAction hitTestAction) 297 bool LayoutImage::nodeAtPoint(HitTestResult& result, const HitTestLocation& loca tionInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestActi on)
298 { 298 {
299 HitTestResult tempResult(result.hitTestLocation()); 299 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation());
300 bool inside = LayoutReplaced::nodeAtPoint(request, tempResult, locationInCon tainer, accumulatedOffset, hitTestAction); 300 bool inside = LayoutReplaced::nodeAtPoint(tempResult, locationInContainer, a ccumulatedOffset, hitTestAction);
301 301
302 if (tempResult.innerNode() && node()) { 302 if (tempResult.innerNode() && node()) {
303 if (HTMLMapElement* map = imageMap()) { 303 if (HTMLMapElement* map = imageMap()) {
304 LayoutRect contentBox = contentBoxRect(); 304 LayoutRect contentBox = contentBoxRect();
305 float scaleFactor = 1 / style()->effectiveZoom(); 305 float scaleFactor = 1 / style()->effectiveZoom();
306 LayoutPoint mapLocation = locationInContainer.point() - toLayoutSize (accumulatedOffset) - locationOffset() - toLayoutSize(contentBox.location()); 306 LayoutPoint mapLocation = locationInContainer.point() - toLayoutSize (accumulatedOffset) - locationOffset() - toLayoutSize(contentBox.location());
307 mapLocation.scale(scaleFactor, scaleFactor); 307 mapLocation.scale(scaleFactor, scaleFactor);
308 308
309 if (map->mapMouseEvent(mapLocation, contentBox.size(), tempResult)) 309 if (map->mapMouseEvent(mapLocation, contentBox.size(), tempResult))
310 tempResult.setInnerNonSharedNode(node()); 310 tempResult.setInnerNonSharedNode(node());
311 } 311 }
312 } 312 }
313 313
314 if (!inside && request.listBased()) 314 if (!inside && result.hitTestRequest().listBased())
315 result.append(tempResult, request); 315 result.append(tempResult);
316 if (inside) 316 if (inside)
317 result = tempResult; 317 result = tempResult;
318 return inside; 318 return inside;
319 } 319 }
320 320
321 void LayoutImage::layout() 321 void LayoutImage::layout()
322 { 322 {
323 LayoutReplaced::layout(); 323 LayoutReplaced::layout();
324 updateInnerContentRect(); 324 updateInnerContentRect();
325 } 325 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 return 0; 388 return 0;
389 389
390 ImageResource* cachedImage = m_imageResource->cachedImage(); 390 ImageResource* cachedImage = m_imageResource->cachedImage();
391 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage( )) 391 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage( ))
392 return toSVGImage(cachedImage->image())->embeddedContentBox(); 392 return toSVGImage(cachedImage->image())->embeddedContentBox();
393 393
394 return 0; 394 return 0;
395 } 395 }
396 396
397 } // namespace blink 397 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698