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

Side by Side Diff: Source/core/layout/LayoutTable.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) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
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 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 bool LayoutTable::nodeAtPoint(HitTestResult& result, const HitTestLocation& loca tionInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action) 1333 bool LayoutTable::nodeAtPoint(HitTestResult& result, const HitTestLocation& loca tionInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
1334 { 1334 {
1335 LayoutPoint adjustedLocation = accumulatedOffset + location(); 1335 LayoutPoint adjustedLocation = accumulatedOffset + location();
1336 1336
1337 // Check kids first. 1337 // Check kids first.
1338 if (!hasOverflowClip() || locationInContainer.intersects(overflowClipRect(ad justedLocation))) { 1338 if (!hasOverflowClip() || locationInContainer.intersects(overflowClipRect(ad justedLocation))) {
1339 for (LayoutObject* child = lastChild(); child; child = child->previousSi bling()) { 1339 for (LayoutObject* child = lastChild(); child; child = child->previousSi bling()) {
1340 if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) { 1340 if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) {
1341 LayoutPoint childPoint = flipForWritingModeForChild(toLayoutBox( child), adjustedLocation); 1341 LayoutPoint childPoint = flipForWritingModeForChild(toLayoutBox( child), adjustedLocation);
1342 if (child->nodeAtPoint(result, locationInContainer, childPoint, action)) { 1342 if (child->nodeAtPoint(result, locationInContainer, childPoint, action)) {
1343 updateHitTestResult(result, toLayoutPoint(locationInContaine r.point() - childPoint)); 1343 // TODO(dtapuska): Calculate child's rect
1344 updateHitTestResult(result, toLayoutPoint(locationInContaine r.point() - childPoint), result.validityRect());
1344 return true; 1345 return true;
1345 } 1346 }
1346 } 1347 }
1347 } 1348 }
1348 } 1349 }
1349 1350
1350 // Check our bounds next. 1351 // Check our bounds next.
1351 LayoutRect boundsRect(adjustedLocation, size()); 1352 LayoutRect boundsRect(adjustedLocation, size());
1352 if (visibleToHitTestRequest(result.hitTestRequest()) && (action == HitTestBl ockBackground || action == HitTestChildBlockBackground) && locationInContainer.i ntersects(boundsRect)) { 1353 if (visibleToHitTestRequest(result.hitTestRequest()) && (action == HitTestBl ockBackground || action == HitTestChildBlockBackground) && locationInContainer.i ntersects(boundsRect)) {
1353 updateHitTestResult(result, flipForWritingMode(locationInContainer.point () - toLayoutSize(adjustedLocation))); 1354 updateHitTestResult(result, flipForWritingMode(locationInContainer.point () - toLayoutSize(adjustedLocation)), boundsRect);
1354 if (!result.addNodeToListBasedTestResult(node(), locationInContainer, bo undsRect)) 1355 if (!result.addNodeToListBasedTestResult(node(), locationInContainer, bo undsRect))
1355 return true; 1356 return true;
1356 } 1357 }
1357 1358 result.shrinkValidityRect(boundsRect);
1358 return false; 1359 return false;
1359 } 1360 }
1360 1361
1361 LayoutTable* LayoutTable::createAnonymousWithParent(const LayoutObject* parent) 1362 LayoutTable* LayoutTable::createAnonymousWithParent(const LayoutObject* parent)
1362 { 1363 {
1363 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), TABLE); 1364 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), TABLE);
1364 LayoutTable* newTable = new LayoutTable(0); 1365 LayoutTable* newTable = new LayoutTable(0);
1365 newTable->setDocumentForAnonymous(&parent->document()); 1366 newTable->setDocumentForAnonymous(&parent->document());
1366 newTable->setStyle(newStyle.release()); 1367 newTable->setStyle(newStyle.release());
1367 return newTable; 1368 return newTable;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 cell->invalidateDisplayItemClient(*cell); 1406 cell->invalidateDisplayItemClient(*cell);
1406 } 1407 }
1407 } 1408 }
1408 } 1409 }
1409 } 1410 }
1410 1411
1411 LayoutBlock::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidationState); 1412 LayoutBlock::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidationState);
1412 } 1413 }
1413 1414
1414 } 1415 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698