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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlock.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
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 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 } 1494 }
1495 1495
1496 Node* LayoutBlock::nodeForHitTest() const 1496 Node* LayoutBlock::nodeForHitTest() const
1497 { 1497 {
1498 // If we are in the margins of block elements that are part of a 1498 // If we are in the margins of block elements that are part of a
1499 // continuation we're actually still inside the enclosing element 1499 // continuation we're actually still inside the enclosing element
1500 // that was split. Use the appropriate inner node. 1500 // that was split. Use the appropriate inner node.
1501 return isAnonymousBlockContinuation() ? continuation()->node() : node(); 1501 return isAnonymousBlockContinuation() ? continuation()->node() : node();
1502 } 1502 }
1503 1503
1504 bool LayoutBlock::nodeAtPoint(HitTestResult& result, const HitTestLocation& loca tionInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestActi on) 1504 bool LayoutBlock::hitTestOverflowControl(HitTestResult& result, const HitTestLoc ation& locationInContainer, const LayoutPoint& adjustedLocation)
1505 { 1505 {
1506 LayoutPoint adjustedLocation(accumulatedOffset + location()); 1506 if (visibleToHitTestRequest(result.hitTestRequest())
1507 LayoutSize localOffset = toLayoutSize(adjustedLocation);
1508
1509 if (isInSelfHitTestingPhase(hitTestAction)
1510 && visibleToHitTestRequest(result.hitTestRequest())
1511 && isPointInOverflowControl(result, locationInContainer.point(), adjuste dLocation)) { 1507 && isPointInOverflowControl(result, locationInContainer.point(), adjuste dLocation)) {
1512 updateHitTestResult(result, locationInContainer.point() - localOffset); 1508 updateHitTestResult(result, locationInContainer.point() - toLayoutSize(a djustedLocation));
1513 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet . 1509 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet .
1514 if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationInCont ainer) == StopHitTesting) 1510 if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationInCont ainer) == StopHitTesting)
1515 return true; 1511 return true;
1516 } 1512 }
1517 return LayoutBox::nodeAtPoint(result, locationInContainer, accumulatedOffset , hitTestAction); 1513 return false;
1518 } 1514 }
1519 1515
1520 bool LayoutBlock::hitTestChildren(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTest Action) 1516 bool LayoutBlock::hitTestChildren(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTest Action)
1521 { 1517 {
1522 ASSERT(!childrenInline()); 1518 ASSERT(!childrenInline());
1523 LayoutPoint scrolledOffset(hasOverflowClip() ? accumulatedOffset - scrolledC ontentOffset() : accumulatedOffset); 1519 LayoutPoint scrolledOffset(hasOverflowClip() ? accumulatedOffset - scrolledC ontentOffset() : accumulatedOffset);
1524 HitTestAction childHitTest = hitTestAction; 1520 HitTestAction childHitTest = hitTestAction;
1525 if (hitTestAction == HitTestChildBlockBackgrounds) 1521 if (hitTestAction == HitTestChildBlockBackgrounds)
1526 childHitTest = HitTestChildBlockBackground; 1522 childHitTest = HitTestChildBlockBackground;
1527 for (LayoutBox* child = lastChildBox(); child; child = child->previousSiblin gBox()) { 1523 for (LayoutBox* child = lastChildBox(); child; child = child->previousSiblin gBox()) {
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) { 2426 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) {
2431 LayoutBox* currBox = *it; 2427 LayoutBox* currBox = *it;
2432 ASSERT(!currBox->needsLayout()); 2428 ASSERT(!currBox->needsLayout());
2433 } 2429 }
2434 } 2430 }
2435 } 2431 }
2436 2432
2437 #endif 2433 #endif
2438 2434
2439 } // namespace blink 2435 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698