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

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

Issue 1032823003: Refactor HitTestResult to store the HitTestRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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, 2008, 2009, 2010, 2013 Apple Inc. All r ights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. All r ights 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 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 r[pos + 1].inColSpan = 0; 1494 r[pos + 1].inColSpan = 0;
1495 else 1495 else
1496 r[pos + 1].inColSpan = first + r[pos].inColSpan; 1496 r[pos + 1].inColSpan = first + r[pos].inColSpan;
1497 } else { 1497 } else {
1498 r[pos + 1].inColSpan = 0; 1498 r[pos + 1].inColSpan = 0;
1499 } 1499 }
1500 } 1500 }
1501 } 1501 }
1502 1502
1503 // Hit Testing 1503 // Hit Testing
1504 bool LayoutTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResul t& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumu latedOffset, HitTestAction action) 1504 bool LayoutTableSection::nodeAtPoint(HitTestResult& result, const HitTestLocatio n& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction acti on)
1505 { 1505 {
1506 // If we have no children then we have nothing to do. 1506 // If we have no children then we have nothing to do.
1507 if (!firstRow()) 1507 if (!firstRow())
1508 return false; 1508 return false;
1509 1509
1510 // Table sections cannot ever be hit tested. Effectively they do not exist. 1510 // Table sections cannot ever be hit tested. Effectively they do not exist.
1511 // Just forward to our children always. 1511 // Just forward to our children always.
1512 LayoutPoint adjustedLocation = accumulatedOffset + location(); 1512 LayoutPoint adjustedLocation = accumulatedOffset + location();
1513 1513
1514 if (hasOverflowClip() && !locationInContainer.intersects(overflowClipRect(ad justedLocation))) 1514 if (hasOverflowClip() && !locationInContainer.intersects(overflowClipRect(ad justedLocation)))
1515 return false; 1515 return false;
1516 1516
1517 if (hasOverflowingCell()) { 1517 if (hasOverflowingCell()) {
1518 for (LayoutTableRow* row = lastRow(); row; row = row->previousRow()) { 1518 for (LayoutTableRow* row = lastRow(); row; row = row->previousRow()) {
1519 // FIXME: We have to skip over inline flows, since they can show up inside table rows 1519 // FIXME: We have to skip over inline flows, since they can show up inside table rows
1520 // at the moment (a demoted inline <form> for example). If we ever i mplement a 1520 // at the moment (a demoted inline <form> for example). If we ever i mplement a
1521 // table-specific hit-test method (which we should do for performanc e reasons anyway), 1521 // table-specific hit-test method (which we should do for performanc e reasons anyway),
1522 // then we can remove this check. 1522 // then we can remove this check.
1523 if (!row->hasSelfPaintingLayer()) { 1523 if (!row->hasSelfPaintingLayer()) {
1524 LayoutPoint childPoint = flipForWritingModeForChild(row, adjuste dLocation); 1524 LayoutPoint childPoint = flipForWritingModeForChild(row, adjuste dLocation);
1525 if (row->nodeAtPoint(request, result, locationInContainer, child Point, action)) { 1525 if (row->nodeAtPoint(result, locationInContainer, childPoint, ac tion)) {
1526 updateHitTestResult(result, toLayoutPoint(locationInContaine r.point() - childPoint)); 1526 updateHitTestResult(result, toLayoutPoint(locationInContaine r.point() - childPoint));
1527 return true; 1527 return true;
1528 } 1528 }
1529 } 1529 }
1530 } 1530 }
1531 return false; 1531 return false;
1532 } 1532 }
1533 1533
1534 recalcCellsIfNeeded(); 1534 recalcCellsIfNeeded();
1535 1535
(...skipping 10 matching lines...) Expand all
1546 CellStruct& current = cellAt(hitRow, hitColumn); 1546 CellStruct& current = cellAt(hitRow, hitColumn);
1547 1547
1548 // If the cell is empty, there's nothing to do 1548 // If the cell is empty, there's nothing to do
1549 if (!current.hasCells()) 1549 if (!current.hasCells())
1550 continue; 1550 continue;
1551 1551
1552 for (unsigned i = current.cells.size() ; i; ) { 1552 for (unsigned i = current.cells.size() ; i; ) {
1553 --i; 1553 --i;
1554 LayoutTableCell* cell = current.cells[i]; 1554 LayoutTableCell* cell = current.cells[i];
1555 LayoutPoint cellPoint = flipForWritingModeForChild(cell, adjuste dLocation); 1555 LayoutPoint cellPoint = flipForWritingModeForChild(cell, adjuste dLocation);
1556 if (static_cast<LayoutObject*>(cell)->nodeAtPoint(request, resul t, locationInContainer, cellPoint, action)) { 1556 if (static_cast<LayoutObject*>(cell)->nodeAtPoint(result, locati onInContainer, cellPoint, action)) {
1557 updateHitTestResult(result, locationInContainer.point() - to LayoutSize(cellPoint)); 1557 updateHitTestResult(result, locationInContainer.point() - to LayoutSize(cellPoint));
1558 return true; 1558 return true;
1559 } 1559 }
1560 } 1560 }
1561 if (!request.listBased()) 1561 if (!result.hitTestRequest().listBased())
1562 break; 1562 break;
1563 } 1563 }
1564 if (!request.listBased()) 1564 if (!result.hitTestRequest().listBased())
1565 break; 1565 break;
1566 } 1566 }
1567 1567
1568 return false; 1568 return false;
1569 } 1569 }
1570 1570
1571 void LayoutTableSection::removeCachedCollapsedBorders(const LayoutTableCell* cel l) 1571 void LayoutTableSection::removeCachedCollapsedBorders(const LayoutTableCell* cel l)
1572 { 1572 {
1573 if (!table()->collapseBorders()) 1573 if (!table()->collapseBorders())
1574 return; 1574 return;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1608 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1609 if (!style()->isLeftToRightDirection()) 1609 if (!style()->isLeftToRightDirection())
1610 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); 1610 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing);
1611 else 1611 else
1612 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1612 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1613 1613
1614 cell->setLogicalLocation(cellLocation); 1614 cell->setLogicalLocation(cellLocation);
1615 } 1615 }
1616 1616
1617 } // namespace blink 1617 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698