OLD | NEW |
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 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 } | 1495 } |
1496 | 1496 |
1497 Node* LayoutBlock::nodeForHitTest() const | 1497 Node* LayoutBlock::nodeForHitTest() const |
1498 { | 1498 { |
1499 // If we are in the margins of block elements that are part of a | 1499 // If we are in the margins of block elements that are part of a |
1500 // continuation we're actually still inside the enclosing element | 1500 // continuation we're actually still inside the enclosing element |
1501 // that was split. Use the appropriate inner node. | 1501 // that was split. Use the appropriate inner node. |
1502 return isAnonymousBlockContinuation() ? continuation()->node() : node(); | 1502 return isAnonymousBlockContinuation() ? continuation()->node() : node(); |
1503 } | 1503 } |
1504 | 1504 |
1505 // TODO(pdr): This is too similar to LayoutBox::nodeAtPoint and should share | |
1506 // more code, or merge into LayoutBox::nodeAtPoint entirely. | |
1507 bool LayoutBlock::nodeAtPoint(HitTestResult& result, const HitTestLocation& loca
tionInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestActi
on) | 1505 bool LayoutBlock::nodeAtPoint(HitTestResult& result, const HitTestLocation& loca
tionInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestActi
on) |
1508 { | 1506 { |
1509 LayoutPoint adjustedLocation(accumulatedOffset + location()); | 1507 LayoutPoint adjustedLocation(accumulatedOffset + location()); |
1510 LayoutSize localOffset = toLayoutSize(adjustedLocation); | 1508 LayoutSize localOffset = toLayoutSize(adjustedLocation); |
1511 | 1509 |
1512 if (!isLayoutView()) { | 1510 if (isInSelfHitTestingPhase(hitTestAction) |
1513 // Check if we need to do anything at all. | |
1514 // If we have clipping, then we can't have any spillout. | |
1515 LayoutRect overflowBox = hasOverflowClip() ? borderBoxRect() : visualOve
rflowRect(); | |
1516 flipForWritingMode(overflowBox); | |
1517 overflowBox.moveBy(adjustedLocation); | |
1518 if (!locationInContainer.intersects(overflowBox)) | |
1519 return false; | |
1520 } | |
1521 | |
1522 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil
dBlockBackground) | |
1523 && visibleToHitTestRequest(result.hitTestRequest()) | 1511 && visibleToHitTestRequest(result.hitTestRequest()) |
1524 && isPointInOverflowControl(result, locationInContainer.point(), adjuste
dLocation)) { | 1512 && isPointInOverflowControl(result, locationInContainer.point(), adjuste
dLocation)) { |
1525 updateHitTestResult(result, locationInContainer.point() - localOffset); | 1513 updateHitTestResult(result, locationInContainer.point() - localOffset); |
1526 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet
. | 1514 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet
. |
1527 if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationInCont
ainer) == StopHitTesting) | 1515 if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationInCont
ainer) == StopHitTesting) |
1528 return true; | 1516 return true; |
1529 } | 1517 } |
1530 | 1518 return LayoutBox::nodeAtPoint(result, locationInContainer, accumulatedOffset
, hitTestAction); |
1531 // TODO(pdr): We should also include checks for hit testing border radius at | |
1532 // the layer level (see: crbug.com/568904). | |
1533 | |
1534 if (hitTestChildren(result, locationInContainer, adjustedLocation, hitTestAc
tion)) | |
1535 return true; | |
1536 | |
1537 if (hitTestClippedOutByRoundedBorder(locationInContainer, adjustedLocation)) | |
1538 return false; | |
1539 | |
1540 // Now hit test our background | |
1541 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild
BlockBackground) { | |
1542 LayoutRect boundsRect(adjustedLocation, size()); | |
1543 if (visibleToHitTestRequest(result.hitTestRequest()) && locationInContai
ner.intersects(boundsRect)) { | |
1544 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); | |
1545 if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationIn
Container, boundsRect) == StopHitTesting) | |
1546 return true; | |
1547 } | |
1548 } | |
1549 | |
1550 return false; | |
1551 } | 1519 } |
1552 | 1520 |
1553 bool LayoutBlock::hitTestChildren(HitTestResult& result, const HitTestLocation&
locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTest
Action) | 1521 bool LayoutBlock::hitTestChildren(HitTestResult& result, const HitTestLocation&
locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTest
Action) |
1554 { | 1522 { |
1555 // TODO(pdr): We should also check for css clip in the !isSelfPaintingLayer | 1523 // TODO(pdr): We should also check for css clip in the !isSelfPaintingLayer |
1556 // case, similar to overflow clip below. | 1524 // case, similar to overflow clip below. |
1557 if (hasOverflowClip() && !hasSelfPaintingLayer()) { | 1525 if (hasOverflowClip() && !hasSelfPaintingLayer()) { |
1558 if (!locationInContainer.intersects(overflowClipRect(accumulatedOffset,
ExcludeOverlayScrollbarSizeForHitTesting))) | 1526 if (!locationInContainer.intersects(overflowClipRect(accumulatedOffset,
ExcludeOverlayScrollbarSizeForHitTesting))) |
1559 return false; | 1527 return false; |
1560 if (style()->hasBorderRadius()) { | 1528 if (style()->hasBorderRadius()) { |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2599 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { | 2567 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { |
2600 LayoutBox* currBox = *it; | 2568 LayoutBox* currBox = *it; |
2601 ASSERT(!currBox->needsLayout()); | 2569 ASSERT(!currBox->needsLayout()); |
2602 } | 2570 } |
2603 } | 2571 } |
2604 } | 2572 } |
2605 | 2573 |
2606 #endif | 2574 #endif |
2607 | 2575 |
2608 } // namespace blink | 2576 } // namespace blink |
OLD | NEW |