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

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

Issue 1302583002: Hit-test should not descend into iframe unnecessarily (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 | « LayoutTests/fast/events/hit-test-counts-expected.txt ('k') | no next file » | 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) 2000 Simon Hausmann <hausmann@kde.org> 3 * (C) 2000 Simon Hausmann <hausmann@kde.org>
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2011. 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if ((inside || result.isRectBasedTest()) && !hadResult && result.innerNode() == node()) 153 if ((inside || result.isRectBasedTest()) && !hadResult && result.innerNode() == node())
154 result.setIsOverWidget(contentBoxRect().contains(result.localPoint())); 154 result.setIsOverWidget(contentBoxRect().contains(result.localPoint()));
155 return inside; 155 return inside;
156 } 156 }
157 157
158 bool LayoutPart::nodeAtPoint(HitTestResult& result, const HitTestLocation& locat ionInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action) 158 bool LayoutPart::nodeAtPoint(HitTestResult& result, const HitTestLocation& locat ionInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
159 { 159 {
160 if (!widget() || !widget()->isFrameView() || !result.hitTestRequest().allows ChildFrameContent()) 160 if (!widget() || !widget()->isFrameView() || !result.hitTestRequest().allows ChildFrameContent())
161 return nodeAtPointOverWidget(result, locationInContainer, accumulatedOff set, action); 161 return nodeAtPointOverWidget(result, locationInContainer, accumulatedOff set, action);
162 162
163 FrameView* childFrameView = toFrameView(widget()); 163 if (action == HitTestForeground) {
164 LayoutView* childRoot = childFrameView->layoutView(); 164 FrameView* childFrameView = toFrameView(widget());
165 LayoutView* childRoot = childFrameView->layoutView();
165 166
166 if (visibleToHitTestRequest(result.hitTestRequest()) && childRoot) { 167 if (visibleToHitTestRequest(result.hitTestRequest()) && childRoot) {
167 LayoutPoint adjustedLocation = accumulatedOffset + location(); 168 LayoutPoint adjustedLocation = accumulatedOffset + location();
168 LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), bo rderTop() + paddingTop()) - LayoutSize(childFrameView->scrollOffset()); 169 LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft() , borderTop() + paddingTop()) - LayoutSize(childFrameView->scrollOffset());
169 HitTestLocation newHitTestLocation(locationInContainer, -adjustedLocatio n - contentOffset); 170 HitTestLocation newHitTestLocation(locationInContainer, -adjustedLoc ation - contentOffset);
170 HitTestRequest newHitTestRequest(result.hitTestRequest().type() | HitTes tRequest::ChildFrameHitTest); 171 HitTestRequest newHitTestRequest(result.hitTestRequest().type() | Hi tTestRequest::ChildFrameHitTest);
171 HitTestResult childFrameResult(newHitTestRequest, newHitTestLocation); 172 HitTestResult childFrameResult(newHitTestRequest, newHitTestLocation );
172 173
173 // The frame's layout and style must be up-to-date if we reach here. 174 // The frame's layout and style must be up-to-date if we reach here.
174 bool isInsideChildFrame = childRoot->hitTestNoLifecycleUpdate(childFrame Result); 175 bool isInsideChildFrame = childRoot->hitTestNoLifecycleUpdate(childF rameResult);
175 176
176 if (result.hitTestRequest().listBased()) { 177 if (result.hitTestRequest().listBased()) {
177 result.append(childFrameResult); 178 result.append(childFrameResult);
178 } else if (isInsideChildFrame) { 179 } else if (isInsideChildFrame) {
179 // Force the result not to be cacheable because the parent 180 // Force the result not to be cacheable because the parent
180 // frame should not cache this result; as it won't be notified of 181 // frame should not cache this result; as it won't be notified o f
181 // changes in the child. 182 // changes in the child.
182 childFrameResult.setCacheable(false); 183 childFrameResult.setCacheable(false);
183 result = childFrameResult; 184 result = childFrameResult;
185 }
186
187 if (isInsideChildFrame)
188 return true;
184 } 189 }
185
186 if (isInsideChildFrame)
187 return true;
188 } 190 }
189 191
190 return nodeAtPointOverWidget(result, locationInContainer, accumulatedOffset, action); 192 return nodeAtPointOverWidget(result, locationInContainer, accumulatedOffset, action);
191 } 193 }
192 194
193 CompositingReasons LayoutPart::additionalCompositingReasons() const 195 CompositingReasons LayoutPart::additionalCompositingReasons() const
194 { 196 {
195 if (requiresAcceleratedCompositing()) 197 if (requiresAcceleratedCompositing())
196 return CompositingReasonIFrame; 198 return CompositingReasonIFrame;
197 return CompositingReasonNone; 199 return CompositingReasonNone;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 if (widget() && widget()->isFrameView()) { 338 if (widget() && widget()->isFrameView()) {
337 FrameView* childFrameView = toFrameView(widget()); 339 FrameView* childFrameView = toFrameView(widget());
338 PaintInvalidationState childViewPaintInvalidationState(*childFrameView-> layoutView(), paintInvalidationState); 340 PaintInvalidationState childViewPaintInvalidationState(*childFrameView-> layoutView(), paintInvalidationState);
339 toFrameView(widget())->invalidateTreeIfNeeded(childViewPaintInvalidation State); 341 toFrameView(widget())->invalidateTreeIfNeeded(childViewPaintInvalidation State);
340 } 342 }
341 343
342 LayoutReplaced::invalidatePaintOfSubtreesIfNeeded(paintInvalidationState); 344 LayoutReplaced::invalidatePaintOfSubtreesIfNeeded(paintInvalidationState);
343 } 345 }
344 346
345 } 347 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/hit-test-counts-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698