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

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

Issue 1549693002: Optimize collapsed border painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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, 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 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 if (!result.hitTestRequest().listBased()) 1607 if (!result.hitTestRequest().listBased())
1608 break; 1608 break;
1609 } 1609 }
1610 if (!result.hitTestRequest().listBased()) 1610 if (!result.hitTestRequest().listBased())
1611 break; 1611 break;
1612 } 1612 }
1613 1613
1614 return false; 1614 return false;
1615 } 1615 }
1616 1616
1617 void LayoutTableSection::removeCachedCollapsedBorders(const LayoutTableCell* cel l)
1618 {
1619 if (!table()->collapseBorders())
1620 return;
1621
1622 for (int side = CBSBefore; side <= CBSEnd; ++side)
1623 m_cellsCollapsedBorders.remove(std::make_pair(cell, side));
1624 }
1625
1626 bool LayoutTableSection::setCachedCollapsedBorder(const LayoutTableCell* cell, C ollapsedBorderSide side, const CollapsedBorderValue& border)
1627 {
1628 ASSERT(table()->collapseBorders());
1629 CellsCollapsedBordersMap::iterator it = m_cellsCollapsedBorders.find(std::ma ke_pair(cell, side));
1630 if (it == m_cellsCollapsedBorders.end()) {
1631 if (!border.isVisible())
1632 return false;
1633 m_cellsCollapsedBorders.add(std::make_pair(cell, side), border);
1634 return true;
1635 }
1636 if (!border.isVisible()) {
1637 m_cellsCollapsedBorders.remove(it);
1638 return true;
1639 }
1640 if (!it->value.equals(border)) {
1641 it->value = border;
1642 return true;
1643 }
1644 return false;
1645 }
1646
1647 const CollapsedBorderValue* LayoutTableSection::cachedCollapsedBorder(const Layo utTableCell* cell, CollapsedBorderSide side) const
1648 {
1649 ASSERT(table()->collapseBorders());
1650 CellsCollapsedBordersMap::const_iterator it = m_cellsCollapsedBorders.find(s td::make_pair(cell, side));
1651 return it == m_cellsCollapsedBorders.end() ? nullptr : &it->value;
1652 }
1653
1654 LayoutTableSection* LayoutTableSection::createAnonymousWithParent(const LayoutOb ject* parent) 1617 LayoutTableSection* LayoutTableSection::createAnonymousWithParent(const LayoutOb ject* parent)
1655 { 1618 {
1656 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), TABLE_ROW_GROUP); 1619 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(parent->styleRef(), TABLE_ROW_GROUP);
1657 LayoutTableSection* newSection = new LayoutTableSection(nullptr); 1620 LayoutTableSection* newSection = new LayoutTableSection(nullptr);
1658 newSection->setDocumentForAnonymous(&parent->document()); 1621 newSection->setDocumentForAnonymous(&parent->document());
1659 newSection->setStyle(newStyle.release()); 1622 newSection->setStyle(newStyle.release());
1660 return newSection; 1623 return newSection;
1661 } 1624 }
1662 1625
1663 void LayoutTableSection::setLogicalPositionForCell(LayoutTableCell* cell, unsign ed effectiveColumn) const 1626 void LayoutTableSection::setLogicalPositionForCell(LayoutTableCell* cell, unsign ed effectiveColumn) const
1664 { 1627 {
1665 LayoutPoint cellLocation(0, m_rowPos[cell->rowIndex()]); 1628 LayoutPoint cellLocation(0, m_rowPos[cell->rowIndex()]);
1666 int horizontalBorderSpacing = table()->hBorderSpacing(); 1629 int horizontalBorderSpacing = table()->hBorderSpacing();
1667 1630
1668 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1631 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1669 if (!style()->isLeftToRightDirection()) 1632 if (!style()->isLeftToRightDirection())
1670 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); 1633 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing));
1671 else 1634 else
1672 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); 1635 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing));
1673 1636
1674 cell->setLogicalLocation(cellLocation); 1637 cell->setLogicalLocation(cellLocation);
1675 } 1638 }
1676 1639
1677 } // namespace blink 1640 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableSection.h ('k') | third_party/WebKit/Source/core/paint/TableCellPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698