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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 1960373002: nodeAtPoint(): Perform the early-check EARLY. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « third_party/WebKit/Source/core/layout/LayoutBox.h ('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) 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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 if (!isLayoutView()) { 1194 if (!isLayoutView()) {
1195 // Check if we need to do anything at all. 1195 // Check if we need to do anything at all.
1196 // If we have clipping, then we can't have any spillout. 1196 // If we have clipping, then we can't have any spillout.
1197 LayoutRect overflowBox = hasOverflowClip() ? borderBoxRect() : visualOve rflowRect(); 1197 LayoutRect overflowBox = hasOverflowClip() ? borderBoxRect() : visualOve rflowRect();
1198 flipForWritingMode(overflowBox); 1198 flipForWritingMode(overflowBox);
1199 overflowBox.moveBy(adjustedLocation); 1199 overflowBox.moveBy(adjustedLocation);
1200 if (!locationInContainer.intersects(overflowBox)) 1200 if (!locationInContainer.intersects(overflowBox))
1201 return false; 1201 return false;
1202 } 1202 }
1203 1203
1204 bool shouldHitTestSelf = isInSelfHitTestingPhase(action);
1205
1206 if (shouldHitTestSelf && hasOverflowClip()
1207 && hitTestOverflowControl(result, locationInContainer, adjustedLocation) )
1208 return true;
1209
1204 // TODO(pdr): We should also check for css clip in the !isSelfPaintingLayer 1210 // TODO(pdr): We should also check for css clip in the !isSelfPaintingLayer
1205 // case, similar to overflow clip below. 1211 // case, similar to overflow clip below.
1206 bool skipChildren = false; 1212 bool skipChildren = false;
1207 if (hasOverflowClip() && !hasSelfPaintingLayer()) { 1213 if (hasOverflowClip() && !hasSelfPaintingLayer()) {
1208 if (!locationInContainer.intersects(overflowClipRect(adjustedLocation, E xcludeOverlayScrollbarSizeForHitTesting))) { 1214 if (!locationInContainer.intersects(overflowClipRect(adjustedLocation, E xcludeOverlayScrollbarSizeForHitTesting))) {
1209 skipChildren = true; 1215 skipChildren = true;
1210 } else if (style()->hasBorderRadius()) { 1216 } else if (style()->hasBorderRadius()) {
1211 LayoutRect boundsRect(adjustedLocation, size()); 1217 LayoutRect boundsRect(adjustedLocation, size());
1212 skipChildren = !locationInContainer.intersects(style()->getRoundedIn nerBorderFor(boundsRect)); 1218 skipChildren = !locationInContainer.intersects(style()->getRoundedIn nerBorderFor(boundsRect));
1213 } 1219 }
1214 } 1220 }
1215 1221
1216 // A control clip can also clip out child hit testing. 1222 // A control clip can also clip out child hit testing.
1217 if (!skipChildren && hasControlClip() && !locationInContainer.intersects(con trolClipRect(adjustedLocation))) 1223 if (!skipChildren && hasControlClip() && !locationInContainer.intersects(con trolClipRect(adjustedLocation)))
1218 skipChildren = true; 1224 skipChildren = true;
1219 1225
1220 // TODO(pdr): We should also include checks for hit testing border radius at 1226 // TODO(pdr): We should also include checks for hit testing border radius at
1221 // the layer level (see: crbug.com/568904). 1227 // the layer level (see: crbug.com/568904).
1222 1228
1223 if (!skipChildren && hitTestChildren(result, locationInContainer, adjustedLo cation, action)) 1229 if (!skipChildren && hitTestChildren(result, locationInContainer, adjustedLo cation, action))
1224 return true; 1230 return true;
1225 1231
1226 if (hitTestClippedOutByRoundedBorder(locationInContainer, adjustedLocation)) 1232 if (hitTestClippedOutByRoundedBorder(locationInContainer, adjustedLocation))
1227 return false; 1233 return false;
1228 1234
1229 // Now hit test ourselves. 1235 // Now hit test ourselves.
1230 if (isInSelfHitTestingPhase(action) && visibleToHitTestRequest(result.hitTes tRequest())) { 1236 if (shouldHitTestSelf && visibleToHitTestRequest(result.hitTestRequest())) {
1231 LayoutRect boundsRect(adjustedLocation, size()); 1237 LayoutRect boundsRect(adjustedLocation, size());
1232 if (locationInContainer.intersects(boundsRect)) { 1238 if (locationInContainer.intersects(boundsRect)) {
1233 updateHitTestResult(result, flipForWritingMode(locationInContainer.p oint() - toLayoutSize(adjustedLocation))); 1239 updateHitTestResult(result, flipForWritingMode(locationInContainer.p oint() - toLayoutSize(adjustedLocation)));
1234 if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationIn Container, boundsRect) == StopHitTesting) 1240 if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationIn Container, boundsRect) == StopHitTesting)
1235 return true; 1241 return true;
1236 } 1242 }
1237 } 1243 }
1238 1244
1239 return false; 1245 return false;
1240 } 1246 }
(...skipping 3557 matching lines...) Expand 10 before | Expand all | Expand 10 after
4798 4804
4799 void LayoutBox::clearPercentHeightDescendants() 4805 void LayoutBox::clearPercentHeightDescendants()
4800 { 4806 {
4801 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { 4807 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4802 if (curr->isBox()) 4808 if (curr->isBox())
4803 toLayoutBox(curr)->removeFromPercentHeightContainer(); 4809 toLayoutBox(curr)->removeFromPercentHeightContainer();
4804 } 4810 }
4805 } 4811 }
4806 4812
4807 } // namespace blink 4813 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698