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

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

Issue 924273003: Remove HitTestAction. (Closed) Base URL: git@github.com:domokit/mojo.git@hittestfilter
Patch Set: Created 5 years, 10 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/rendering/RenderBox.h ('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) 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 return std::max<LayoutUnit>(0, width); 355 return std::max<LayoutUnit>(0, width);
356 } 356 }
357 357
358 LayoutUnit RenderBox::adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit heigh t) const 358 LayoutUnit RenderBox::adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit heigh t) const
359 { 359 {
360 if (style()->boxSizing() == BORDER_BOX) 360 if (style()->boxSizing() == BORDER_BOX)
361 height -= borderAndPaddingLogicalHeight(); 361 height -= borderAndPaddingLogicalHeight();
362 return std::max<LayoutUnit>(0, height); 362 return std::max<LayoutUnit>(0, height);
363 } 363 }
364 364
365 bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result , const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs et, HitTestAction action) 365 bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result , const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs et)
366 { 366 {
367 LayoutPoint adjustedLocation = accumulatedOffset + location(); 367 LayoutPoint adjustedLocation = accumulatedOffset + location();
368 368
369 // Check kids first. 369 // Check kids first.
370 for (RenderObject* child = slowLastChild(); child; child = child->previousSi bling()) { 370 for (RenderObject* child = slowLastChild(); child; child = child->previousSi bling()) {
371 if ((!child->hasLayer() || !toRenderLayerModelObject(child)->layer()->is SelfPaintingLayer()) && child->nodeAtPoint(request, result, locationInContainer, adjustedLocation, action)) { 371 if ((!child->hasLayer() || !toRenderLayerModelObject(child)->layer()->is SelfPaintingLayer()) && child->nodeAtPoint(request, result, locationInContainer, adjustedLocation)) {
372 updateHitTestResult(result, locationInContainer.point() - toLayoutSi ze(adjustedLocation)); 372 updateHitTestResult(result, locationInContainer.point() - toLayoutSi ze(adjustedLocation));
373 return true; 373 return true;
374 } 374 }
375 } 375 }
376 376
377 // Check our bounds next. For this purpose always assume that we can only be hit in the 377 // Check our bounds next.
378 // foreground phase (which is true for replaced elements like images).
379 LayoutRect boundsRect = borderBoxRect(); 378 LayoutRect boundsRect = borderBoxRect();
380 boundsRect.moveBy(adjustedLocation); 379 boundsRect.moveBy(adjustedLocation);
381 if (visibleToHitTestRequest(request) && action == HitTestForeground && locat ionInContainer.intersects(boundsRect)) { 380 if (visibleToHitTestRequest(request) && locationInContainer.intersects(bound sRect)) {
382 updateHitTestResult(result, locationInContainer.point() - toLayoutSize(a djustedLocation)); 381 updateHitTestResult(result, locationInContainer.point() - toLayoutSize(a djustedLocation));
383 if (!result.addNodeToRectBasedTestResult(node(), request, locationInCont ainer, boundsRect)) 382 if (!result.addNodeToRectBasedTestResult(node(), request, locationInCont ainer, boundsRect))
384 return true; 383 return true;
385 } 384 }
386 385
387 return false; 386 return false;
388 } 387 }
389 388
390 // --------------------- painting stuff ------------------------------- 389 // --------------------- painting stuff -------------------------------
391 390
(...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after
2894 2893
2895 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 2894 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
2896 { 2895 {
2897 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); 2896 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor);
2898 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 2897 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
2899 ASSERT(hasBackground == style.hasBackground()); 2898 ASSERT(hasBackground == style.hasBackground());
2900 hasBorder = style.hasBorder(); 2899 hasBorder = style.hasBorder();
2901 } 2900 }
2902 2901
2903 } // namespace blink 2902 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBox.h ('k') | sky/engine/core/rendering/RenderImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698