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

Side by Side Diff: sky/engine/core/rendering/RenderBlock.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/RenderBlock.h ('k') | sky/engine/core/rendering/RenderBox.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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 } 1017 }
1018 1018
1019 LayoutUnit RenderBlock::textIndentOffset() const 1019 LayoutUnit RenderBlock::textIndentOffset() const
1020 { 1020 {
1021 LayoutUnit cw = 0; 1021 LayoutUnit cw = 0;
1022 if (style()->textIndent().isPercent()) 1022 if (style()->textIndent().isPercent())
1023 cw = containingBlock()->availableLogicalWidth(); 1023 cw = containingBlock()->availableLogicalWidth();
1024 return minimumValueForLength(style()->textIndent(), cw); 1024 return minimumValueForLength(style()->textIndent(), cw);
1025 } 1025 }
1026 1026
1027 bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf fset, HitTestAction hitTestAction) 1027 bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf fset)
1028 { 1028 {
1029 LayoutPoint adjustedLocation(accumulatedOffset + location()); 1029 LayoutPoint adjustedLocation(accumulatedOffset + location());
1030 LayoutSize localOffset = toLayoutSize(adjustedLocation); 1030 LayoutSize localOffset = toLayoutSize(adjustedLocation);
1031 1031
1032 if (!isRenderView()) { 1032 if (!isRenderView()) {
1033 // Check if we need to do anything at all. 1033 // Check if we need to do anything at all.
1034 // If we have clipping, then we can't have any spillout. 1034 // If we have clipping, then we can't have any spillout.
1035 LayoutRect overflowBox = hasOverflowClip() ? borderBoxRect() : visualOve rflowRect(); 1035 LayoutRect overflowBox = hasOverflowClip() ? borderBoxRect() : visualOve rflowRect();
1036 overflowBox.moveBy(adjustedLocation); 1036 overflowBox.moveBy(adjustedLocation);
1037 if (!locationInContainer.intersects(overflowBox)) 1037 if (!locationInContainer.intersects(overflowBox))
(...skipping 18 matching lines...) Expand all
1056 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); 1056 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer();
1057 bool checkChildren = !useOverflowClip; 1057 bool checkChildren = !useOverflowClip;
1058 if (!checkChildren) { 1058 if (!checkChildren) {
1059 LayoutRect clipRect = overflowClipRect(adjustedLocation); 1059 LayoutRect clipRect = overflowClipRect(adjustedLocation);
1060 if (style()->hasBorderRadius()) 1060 if (style()->hasBorderRadius())
1061 checkChildren = locationInContainer.intersects(style()->getRoundedBo rderFor(clipRect)); 1061 checkChildren = locationInContainer.intersects(style()->getRoundedBo rderFor(clipRect));
1062 else 1062 else
1063 checkChildren = locationInContainer.intersects(clipRect); 1063 checkChildren = locationInContainer.intersects(clipRect);
1064 } 1064 }
1065 if (checkChildren) { 1065 if (checkChildren) {
1066 if (hitTestContents(request, result, locationInContainer, toLayoutPoint( localOffset), hitTestAction)) { 1066 if (hitTestContents(request, result, locationInContainer, toLayoutPoint( localOffset))) {
1067 updateHitTestResult(result, locationInContainer.point() - localOffse t); 1067 updateHitTestResult(result, locationInContainer.point() - localOffse t);
1068 return true; 1068 return true;
1069 } 1069 }
1070 } 1070 }
1071 1071
1072 // Check if the point is outside radii. 1072 // Check if the point is outside radii.
1073 if (style()->hasBorderRadius()) { 1073 if (style()->hasBorderRadius()) {
1074 LayoutRect borderRect = borderBoxRect(); 1074 LayoutRect borderRect = borderBoxRect();
1075 borderRect.moveBy(adjustedLocation); 1075 borderRect.moveBy(adjustedLocation);
1076 RoundedRect border = style()->getRoundedBorderFor(borderRect); 1076 RoundedRect border = style()->getRoundedBorderFor(borderRect);
1077 if (!locationInContainer.intersects(border)) 1077 if (!locationInContainer.intersects(border))
1078 return false; 1078 return false;
1079 } 1079 }
1080 1080
1081 // Now hit test our background 1081 // Now hit test our background
1082 if (hitTestAction == HitTestBlockBackground) { 1082 LayoutRect boundsRect(adjustedLocation, size());
1083 LayoutRect boundsRect(adjustedLocation, size()); 1083 if (visibleToHitTestRequest(request) && locationInContainer.intersects(bound sRect)) {
1084 if (visibleToHitTestRequest(request) && locationInContainer.intersects(b oundsRect)) { 1084 updateHitTestResult(result, locationInContainer.point() - localOffset);
1085 updateHitTestResult(result, locationInContainer.point() - localOffse t); 1085 if (!result.addNodeToRectBasedTestResult(node(), request, locationInCont ainer, boundsRect))
1086 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn Container, boundsRect)) 1086 return true;
1087 return true;
1088 }
1089 } 1087 }
1090 1088
1091 return false; 1089 return false;
1092 } 1090 }
1093 1091
1094 bool RenderBlock::hitTestContents(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulat edOffset, HitTestAction hitTestAction) 1092 bool RenderBlock::hitTestContents(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulat edOffset)
1095 { 1093 {
1096 for (RenderBox* child = lastChildBox(); child; child = child->previousSiblin gBox()) { 1094 for (RenderBox* child = lastChildBox(); child; child = child->previousSiblin gBox()) {
1097 if (!child->hasSelfPaintingLayer() && child->nodeAtPoint(request, result , locationInContainer, accumulatedOffset, hitTestAction)) 1095 if (!child->hasSelfPaintingLayer() && child->nodeAtPoint(request, result , locationInContainer, accumulatedOffset))
1098 return true; 1096 return true;
1099 } 1097 }
1100 1098
1101 return false; 1099 return false;
1102 } 1100 }
1103 1101
1104 Position RenderBlock::positionForBox(InlineBox *box, bool start) const 1102 Position RenderBlock::positionForBox(InlineBox *box, bool start) const
1105 { 1103 {
1106 if (!box) 1104 if (!box)
1107 return Position(); 1105 return Position();
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 1761 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
1764 { 1762 {
1765 showRenderObject(); 1763 showRenderObject();
1766 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 1764 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
1767 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 1765 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
1768 } 1766 }
1769 1767
1770 #endif 1768 #endif
1771 1769
1772 } // namespace blink 1770 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.h ('k') | sky/engine/core/rendering/RenderBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698