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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutInline.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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 }; 794 };
795 795
796 } // unnamed namespace 796 } // unnamed namespace
797 797
798 bool LayoutInline::hitTestCulledInline(HitTestResult& result, const HitTestLocat ion& locationInContainer, const LayoutPoint& accumulatedOffset) 798 bool LayoutInline::hitTestCulledInline(HitTestResult& result, const HitTestLocat ion& locationInContainer, const LayoutPoint& accumulatedOffset)
799 { 799 {
800 ASSERT(!alwaysCreateLineBoxes()); 800 ASSERT(!alwaysCreateLineBoxes());
801 if (!visibleToHitTestRequest(result.hitTestRequest())) 801 if (!visibleToHitTestRequest(result.hitTestRequest()))
802 return false; 802 return false;
803 803
804 HitTestLocation tmpLocation(locationInContainer, -toLayoutSize(accumulatedOf fset)); 804 HitTestLocation adjustedLocation(locationInContainer, -toLayoutSize(accumula tedOffset));
805 805
806 Region regionResult; 806 Region regionResult;
807 HitTestCulledInlinesGeneratorContext context(regionResult, tmpLocation); 807 HitTestCulledInlinesGeneratorContext context(regionResult, adjustedLocation) ;
808 generateCulledLineBoxRects(context, this); 808 generateCulledLineBoxRects(context, this);
809 809
810 if (context.intersected()) { 810 if (context.intersected()) {
811 updateHitTestResult(result, tmpLocation.point()); 811 updateHitTestResult(result, adjustedLocation.point());
812 // We can not use addNodeToListBasedTestResult to determine if we fully enclose the hit-test area 812 if (result.addNodeToListBasedTestResult(node(), adjustedLocation, region Result) == StopHitTesting)
813 // because it can only handle rectangular targets. 813 return true;
814 result.addNodeToListBasedTestResult(node(), locationInContainer);
815 // We check if using list-based hit-test to continue hit testing.
816 if (!result.hitTestRequest().penetratingList())
817 return regionResult.contains(tmpLocation.boundingBox());
818 } 814 }
819 return false; 815 return false;
820 } 816 }
821 817
822 PositionWithAffinity LayoutInline::positionForPoint(const LayoutPoint& point) 818 PositionWithAffinity LayoutInline::positionForPoint(const LayoutPoint& point)
823 { 819 {
824 // FIXME: Does not deal with relative positioned inlines (should it?) 820 // FIXME: Does not deal with relative positioned inlines (should it?)
825 LayoutBlock* cb = containingBlock(); 821 LayoutBlock* cb = containingBlock();
826 if (firstLineBoxIncludingCulling()) { 822 if (firstLineBoxIncludingCulling()) {
827 // This inline actually has a line box. We must have clicked in the bor der/padding of one of these boxes. We 823 // This inline actually has a line box. We must have clicked in the bor der/padding of one of these boxes. We
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 1429
1434 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const 1430 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const
1435 { 1431 {
1436 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason); 1432 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason);
1437 1433
1438 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1434 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1439 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); 1435 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason);
1440 } 1436 }
1441 1437
1442 } // namespace blink 1438 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698