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

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

Issue 1630793002: Stop hit testing culled inlines when a match is found (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simpler approach, but duplicated code Created 4 years, 10 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 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 overflowBox.moveBy(adjustedLocation); 1610 overflowBox.moveBy(adjustedLocation);
1611 if (!locationInContainer.intersects(overflowBox)) 1611 if (!locationInContainer.intersects(overflowBox))
1612 return false; 1612 return false;
1613 } 1613 }
1614 1614
1615 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil dBlockBackground) 1615 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil dBlockBackground)
1616 && visibleToHitTestRequest(result.hitTestRequest()) 1616 && visibleToHitTestRequest(result.hitTestRequest())
1617 && isPointInOverflowControl(result, locationInContainer.point(), adjuste dLocation)) { 1617 && isPointInOverflowControl(result, locationInContainer.point(), adjuste dLocation)) {
1618 updateHitTestResult(result, locationInContainer.point() - localOffset); 1618 updateHitTestResult(result, locationInContainer.point() - localOffset);
1619 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet . 1619 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet .
1620 if (!result.addNodeToListBasedTestResult(nodeForHitTest(), locationInCon tainer)) 1620 if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationInCont ainer) == StopHitTesting)
1621 return true; 1621 return true;
1622 } 1622 }
1623 1623
1624 // TODO(pdr): We should also include checks for hit testing border radius at 1624 // TODO(pdr): We should also include checks for hit testing border radius at
1625 // the layer level (see: crbug.com/568904). 1625 // the layer level (see: crbug.com/568904).
1626 1626
1627 if (hitTestChildren(result, locationInContainer, adjustedLocation, hitTestAc tion)) 1627 if (hitTestChildren(result, locationInContainer, adjustedLocation, hitTestAc tion))
1628 return true; 1628 return true;
1629 1629
1630 if (hitTestClippedOutByRoundedBorder(locationInContainer, adjustedLocation)) 1630 if (hitTestClippedOutByRoundedBorder(locationInContainer, adjustedLocation))
1631 return false; 1631 return false;
1632 1632
1633 // Now hit test our background 1633 // Now hit test our background
1634 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild BlockBackground) { 1634 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild BlockBackground) {
1635 LayoutRect boundsRect(adjustedLocation, size()); 1635 LayoutRect boundsRect(adjustedLocation, size());
1636 if (visibleToHitTestRequest(result.hitTestRequest()) && locationInContai ner.intersects(boundsRect)) { 1636 if (visibleToHitTestRequest(result.hitTestRequest()) && locationInContai ner.intersects(boundsRect)) {
1637 updateHitTestResult(result, flipForWritingMode(locationInContainer.p oint() - localOffset)); 1637 updateHitTestResult(result, flipForWritingMode(locationInContainer.p oint() - localOffset));
1638 if (!result.addNodeToListBasedTestResult(nodeForHitTest(), locationI nContainer, boundsRect)) 1638 if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationIn Container, boundsRect) == StopHitTesting)
1639 return true; 1639 return true;
1640 } 1640 }
1641 } 1641 }
1642 1642
1643 return false; 1643 return false;
1644 } 1644 }
1645 1645
1646 bool LayoutBlock::hitTestChildren(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTest Action) 1646 bool LayoutBlock::hitTestChildren(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTest Action)
1647 { 1647 {
1648 // TODO(pdr): We should also check for css clip in the !isSelfPaintingLayer 1648 // TODO(pdr): We should also check for css clip in the !isSelfPaintingLayer
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2858 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2859 { 2859 {
2860 showLayoutObject(); 2860 showLayoutObject();
2861 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2861 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2862 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2862 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2863 } 2863 }
2864 2864
2865 #endif 2865 #endif
2866 2866
2867 } // namespace blink 2867 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/HitTestResult.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698