Chromium Code Reviews| 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) 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. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
| 7 * All rights reserved. | 7 * All rights reserved. |
| 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1392 | 1392 |
| 1393 bool shouldHitTestSelf = isInSelfHitTestingPhase(action); | 1393 bool shouldHitTestSelf = isInSelfHitTestingPhase(action); |
| 1394 | 1394 |
| 1395 if (shouldHitTestSelf && hasOverflowClip() && | 1395 if (shouldHitTestSelf && hasOverflowClip() && |
| 1396 hitTestOverflowControl(result, locationInContainer, adjustedLocation)) | 1396 hitTestOverflowControl(result, locationInContainer, adjustedLocation)) |
| 1397 return true; | 1397 return true; |
| 1398 | 1398 |
| 1399 // TODO(pdr): We should also check for css clip in the !isSelfPaintingLayer | 1399 // TODO(pdr): We should also check for css clip in the !isSelfPaintingLayer |
| 1400 // case, similar to overflow clip below. | 1400 // case, similar to overflow clip below. |
| 1401 bool skipChildren = false; | 1401 bool skipChildren = false; |
| 1402 if (hasOverflowClip() && !hasSelfPaintingLayer()) { | 1402 if (shouldClipOverflow() && !hasSelfPaintingLayer()) { |
| 1403 if (!locationInContainer.intersects(overflowClipRect( | 1403 if (!locationInContainer.intersects(overflowClipRect( |
| 1404 adjustedLocation, ExcludeOverlayScrollbarSizeForHitTesting))) { | 1404 adjustedLocation, ExcludeOverlayScrollbarSizeForHitTesting))) { |
| 1405 skipChildren = true; | 1405 skipChildren = true; |
| 1406 } else if (style()->hasBorderRadius()) { | 1406 } else if (style()->hasBorderRadius()) { |
| 1407 LayoutRect boundsRect(adjustedLocation, size()); | 1407 LayoutRect boundsRect(adjustedLocation, size()); |
| 1408 skipChildren = !locationInContainer.intersects( | 1408 skipChildren = !locationInContainer.intersects( |
| 1409 style()->getRoundedInnerBorderFor(boundsRect)); | 1409 style()->getRoundedInnerBorderFor(boundsRect)); |
| 1410 } | 1410 } |
| 1411 } | 1411 } |
| 1412 | 1412 |
| 1413 // A control clip can also clip out child hit testing. | |
| 1414 if (!skipChildren && hasControlClip() && | |
| 1415 !locationInContainer.intersects(controlClipRect(adjustedLocation))) | |
| 1416 skipChildren = true; | |
| 1417 | |
| 1418 // TODO(pdr): We should also include checks for hit testing border radius at | 1413 // TODO(pdr): We should also include checks for hit testing border radius at |
| 1419 // the layer level (see: crbug.com/568904). | 1414 // the layer level (see: crbug.com/568904). |
| 1420 | 1415 |
| 1421 if (!skipChildren && | 1416 if (!skipChildren && |
| 1422 hitTestChildren(result, locationInContainer, adjustedLocation, action)) | 1417 hitTestChildren(result, locationInContainer, adjustedLocation, action)) |
| 1423 return true; | 1418 return true; |
| 1424 | 1419 |
| 1425 if (style()->hasBorderRadius() && | 1420 if (style()->hasBorderRadius() && |
| 1426 hitTestClippedOutByBorder(locationInContainer, adjustedLocation)) | 1421 hitTestClippedOutByBorder(locationInContainer, adjustedLocation)) |
| 1427 return false; | 1422 return false; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1790 const LayoutPoint& location, | 1785 const LayoutPoint& location, |
| 1791 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const { | 1786 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const { |
| 1792 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property | 1787 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property |
| 1793 // here. | 1788 // here. |
| 1794 LayoutRect clipRect = borderBoxRect(); | 1789 LayoutRect clipRect = borderBoxRect(); |
| 1795 clipRect.setLocation(location + clipRect.location() + | 1790 clipRect.setLocation(location + clipRect.location() + |
| 1796 LayoutSize(borderLeft(), borderTop())); | 1791 LayoutSize(borderLeft(), borderTop())); |
| 1797 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), | 1792 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), |
| 1798 borderTop() + borderBottom())); | 1793 borderTop() + borderBottom())); |
| 1799 | 1794 |
| 1795 if (hasControlClip()) | |
|
pdr.
2017/01/23 18:46:12
I think this needs to be after excludeScrollbars.
chrishtr
2017/01/23 18:53:20
DONE!!!
| |
| 1796 clipRect.intersect(controlClipRect(location)); | |
| 1797 | |
| 1800 if (hasOverflowClip()) | 1798 if (hasOverflowClip()) |
| 1801 excludeScrollbars(clipRect, overlayScrollbarClipBehavior); | 1799 excludeScrollbars(clipRect, overlayScrollbarClipBehavior); |
| 1800 | |
| 1802 return clipRect; | 1801 return clipRect; |
| 1803 } | 1802 } |
| 1804 | 1803 |
| 1805 void LayoutBox::excludeScrollbars( | 1804 void LayoutBox::excludeScrollbars( |
| 1806 LayoutRect& rect, | 1805 LayoutRect& rect, |
| 1807 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const { | 1806 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const { |
| 1808 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) { | 1807 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) { |
| 1809 if (shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { | 1808 if (shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { |
| 1810 rect.move( | 1809 rect.move( |
| 1811 scrollableArea->verticalScrollbarWidth(overlayScrollbarClipBehavior), | 1810 scrollableArea->verticalScrollbarWidth(overlayScrollbarClipBehavior), |
| (...skipping 3881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5693 block->adjustChildDebugRect(rect); | 5692 block->adjustChildDebugRect(rect); |
| 5694 | 5693 |
| 5695 return rect; | 5694 return rect; |
| 5696 } | 5695 } |
| 5697 | 5696 |
| 5698 bool LayoutBox::shouldClipOverflow() const { | 5697 bool LayoutBox::shouldClipOverflow() const { |
| 5699 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); | 5698 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); |
| 5700 } | 5699 } |
| 5701 | 5700 |
| 5702 } // namespace blink | 5701 } // namespace blink |
| OLD | NEW |