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

Side by Side Diff: Source/core/layout/LayoutInline.cpp

Issue 1142283004: Implement a Hit Test Cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 * 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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 if (!visibleToHitTestRequest(result.hitTestRequest())) 807 if (!visibleToHitTestRequest(result.hitTestRequest()))
808 return false; 808 return false;
809 809
810 HitTestLocation tmpLocation(locationInContainer, -toLayoutSize(accumulatedOf fset)); 810 HitTestLocation tmpLocation(locationInContainer, -toLayoutSize(accumulatedOf fset));
811 811
812 Region regionResult; 812 Region regionResult;
813 HitTestCulledInlinesGeneratorContext context(regionResult, tmpLocation); 813 HitTestCulledInlinesGeneratorContext context(regionResult, tmpLocation);
814 generateCulledLineBoxRects(context, this); 814 generateCulledLineBoxRects(context, this);
815 815
816 if (context.intersected()) { 816 if (context.intersected()) {
817 updateHitTestResult(result, tmpLocation.point()); 817 // TODO(dtapuska): Move the regionResult by accumulatedOffset
818 updateHitTestResult(result, tmpLocation.point(), result.validityRect());
818 // We can not use addNodeToListBasedTestResult to determine if we fully enclose the hit-test area 819 // We can not use addNodeToListBasedTestResult to determine if we fully enclose the hit-test area
819 // because it can only handle rectangular targets. 820 // because it can only handle rectangular targets.
820 result.addNodeToListBasedTestResult(node(), locationInContainer); 821 result.addNodeToListBasedTestResult(node(), locationInContainer);
821 return regionResult.contains(tmpLocation.boundingBox()); 822 return regionResult.contains(tmpLocation.boundingBox());
822 } 823 }
823 return false; 824 return false;
824 } 825 }
825 826
826 PositionWithAffinity LayoutInline::positionForPoint(const LayoutPoint& point) 827 PositionWithAffinity LayoutInline::positionForPoint(const LayoutPoint& point)
827 { 828 {
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 { 1226 {
1226 // We have to split the parent flow. 1227 // We have to split the parent flow.
1227 LayoutBlock* newBox = containingBlock()->createAnonymousBlock(); 1228 LayoutBlock* newBox = containingBlock()->createAnonymousBlock();
1228 LayoutBoxModelObject* oldContinuation = continuation(); 1229 LayoutBoxModelObject* oldContinuation = continuation();
1229 setContinuation(newBox); 1230 setContinuation(newBox);
1230 LayoutObject* beforeChild = child->nextSibling(); 1231 LayoutObject* beforeChild = child->nextSibling();
1231 children()->removeChildNode(this, child); 1232 children()->removeChildNode(this, child);
1232 splitFlow(beforeChild, newBox, child, oldContinuation); 1233 splitFlow(beforeChild, newBox, child, oldContinuation);
1233 } 1234 }
1234 1235
1235 void LayoutInline::updateHitTestResult(HitTestResult& result, const LayoutPoint& point) 1236 void LayoutInline::updateHitTestResult(HitTestResult& result, const LayoutPoint& point, const LayoutRect& rect)
1236 { 1237 {
1237 if (result.innerNode()) 1238 if (result.innerNode())
1238 return; 1239 return;
1239 1240
1241 result.intersectValidityRect(rect);
1240 Node* n = node(); 1242 Node* n = node();
1241 LayoutPoint localPoint(point); 1243 LayoutPoint localPoint(point);
1242 if (n) { 1244 if (n) {
1243 if (isInlineElementContinuation()) { 1245 if (isInlineElementContinuation()) {
1244 // We're in the continuation of a split inline. Adjust our local po int to be in the coordinate space 1246 // We're in the continuation of a split inline. Adjust our local po int to be in the coordinate space
1245 // of the principal layoutObject's containing block. This will end up being the innerNode. 1247 // of the principal layoutObject's containing block. This will end up being the innerNode.
1246 LayoutBlock* firstBlock = n->layoutObject()->containingBlock(); 1248 LayoutBlock* firstBlock = n->layoutObject()->containingBlock();
1247 1249
1248 // Get our containing block. 1250 // Get our containing block.
1249 LayoutBox* block = containingBlock(); 1251 LayoutBox* block = containingBlock();
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 } 1451 }
1450 1452
1451 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) const 1453 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) const
1452 { 1454 {
1453 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r); 1455 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r);
1454 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1456 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1455 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box); 1457 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box);
1456 } 1458 }
1457 1459
1458 } // namespace blink 1460 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698