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

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

Issue 2261663002: Disallow cast/implicit conversion from LayoutUnit to int/unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 3 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 } 652 }
653 LayoutTableCell::sortBorderValues(m_collapsedBorders); 653 LayoutTableCell::sortBorderValues(m_collapsedBorders);
654 } 654 }
655 655
656 void LayoutTable::addOverflowFromChildren() 656 void LayoutTable::addOverflowFromChildren()
657 { 657 {
658 // Add overflow from borders. 658 // Add overflow from borders.
659 // Technically it's odd that we are incorporating the borders into layout ov erflow, which is only supposed to be about overflow from our 659 // Technically it's odd that we are incorporating the borders into layout ov erflow, which is only supposed to be about overflow from our
660 // descendant objects, but since tables don't support overflow:auto, this wo rks out fine. 660 // descendant objects, but since tables don't support overflow:auto, this wo rks out fine.
661 if (collapseBorders()) { 661 if (collapseBorders()) {
662 int rightBorderOverflow = size().width() + outerBorderRight() - borderRi ght(); 662 int rightBorderOverflow = (size().width() + outerBorderRight() - borderR ight()).toInt();
663 int leftBorderOverflow = borderLeft() - outerBorderLeft(); 663 int leftBorderOverflow = borderLeft() - outerBorderLeft();
664 int bottomBorderOverflow = size().height() + outerBorderBottom() - borde rBottom(); 664 int bottomBorderOverflow = (size().height() + outerBorderBottom() - bord erBottom()).toInt();
665 int topBorderOverflow = borderTop() - outerBorderTop(); 665 int topBorderOverflow = borderTop() - outerBorderTop();
666 IntRect borderOverflowRect(leftBorderOverflow, topBorderOverflow, rightB orderOverflow - leftBorderOverflow, bottomBorderOverflow - topBorderOverflow); 666 IntRect borderOverflowRect(leftBorderOverflow, topBorderOverflow, rightB orderOverflow - leftBorderOverflow, bottomBorderOverflow - topBorderOverflow);
667 if (borderOverflowRect != pixelSnappedBorderBoxRect()) { 667 if (borderOverflowRect != pixelSnappedBorderBoxRect()) {
668 LayoutRect borderLayoutRect(borderOverflowRect); 668 LayoutRect borderLayoutRect(borderOverflowRect);
669 addLayoutOverflow(borderLayoutRect); 669 addLayoutOverflow(borderLayoutRect);
670 addContentsVisualOverflow(borderLayoutRect); 670 addContentsVisualOverflow(borderLayoutRect);
671 } 671 }
672 } 672 }
673 673
674 // Add overflow from our caption. 674 // Add overflow from our caption.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 724
725 // FIXME: We should include captions widths here like we do in computePrefer redLogicalWidths. 725 // FIXME: We should include captions widths here like we do in computePrefer redLogicalWidths.
726 } 726 }
727 727
728 void LayoutTable::computePreferredLogicalWidths() 728 void LayoutTable::computePreferredLogicalWidths()
729 { 729 {
730 ASSERT(preferredLogicalWidthsDirty()); 730 ASSERT(preferredLogicalWidthsDirty());
731 731
732 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogi calWidth); 732 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogi calWidth);
733 733
734 int bordersPaddingAndSpacing = bordersPaddingAndSpacingInRowDirection(); 734 int bordersPaddingAndSpacing = bordersPaddingAndSpacingInRowDirection().toIn t();
735 m_minPreferredLogicalWidth += bordersPaddingAndSpacing; 735 m_minPreferredLogicalWidth += bordersPaddingAndSpacing;
736 m_maxPreferredLogicalWidth += bordersPaddingAndSpacing; 736 m_maxPreferredLogicalWidth += bordersPaddingAndSpacing;
737 737
738 m_tableLayout->applyPreferredLogicalWidthQuirks(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth); 738 m_tableLayout->applyPreferredLogicalWidthQuirks(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
739 739
740 for (unsigned i = 0; i < m_captions.size(); i++) 740 for (unsigned i = 0; i < m_captions.size(); i++)
741 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, m_capt ions[i]->minPreferredLogicalWidth()); 741 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, m_capt ions[i]->minPreferredLogicalWidth());
742 742
743 const ComputedStyle& styleToUse = styleRef(); 743 const ComputedStyle& styleToUse = styleRef();
744 // FIXME: This should probably be checking for isSpecified since you should be able to use percentage or calc values for min-width. 744 // FIXME: This should probably be checking for isSpecified since you should be able to use percentage or calc values for min-width.
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 return -1; 1334 return -1;
1335 1335
1336 recalcSectionsIfNeeded(); 1336 recalcSectionsIfNeeded();
1337 1337
1338 const LayoutTableSection* topNonEmptySection = this->topNonEmptySection(); 1338 const LayoutTableSection* topNonEmptySection = this->topNonEmptySection();
1339 if (!topNonEmptySection) 1339 if (!topNonEmptySection)
1340 return -1; 1340 return -1;
1341 1341
1342 int baseline = topNonEmptySection->firstLineBoxBaseline(); 1342 int baseline = topNonEmptySection->firstLineBoxBaseline();
1343 if (baseline >= 0) 1343 if (baseline >= 0)
1344 return topNonEmptySection->logicalTop() + baseline; 1344 return (topNonEmptySection->logicalTop() + baseline).toInt();
1345 1345
1346 // FF, Presto and IE use the top of the section as the baseline if its first row is empty of cells or content. 1346 // FF, Presto and IE use the top of the section as the baseline if its first row is empty of cells or content.
1347 // The baseline of an empty row isn't specified by CSS 2.1. 1347 // The baseline of an empty row isn't specified by CSS 2.1.
1348 if (topNonEmptySection->firstRow() && !topNonEmptySection->firstRow()->first Cell()) 1348 if (topNonEmptySection->firstRow() && !topNonEmptySection->firstRow()->first Cell())
1349 return topNonEmptySection->logicalTop(); 1349 return topNonEmptySection->logicalTop().toInt();
1350 1350
1351 return -1; 1351 return -1;
1352 } 1352 }
1353 1353
1354 LayoutRect LayoutTable::overflowClipRect(const LayoutPoint& location, OverlayScr ollbarClipBehavior overlayScrollbarClipBehavior) const 1354 LayoutRect LayoutTable::overflowClipRect(const LayoutPoint& location, OverlayScr ollbarClipBehavior overlayScrollbarClipBehavior) const
1355 { 1355 {
1356 LayoutRect rect = LayoutBlock::overflowClipRect(location, overlayScrollbarCl ipBehavior); 1356 LayoutRect rect = LayoutBlock::overflowClipRect(location, overlayScrollbarCl ipBehavior);
1357 1357
1358 // If we have a caption, expand the clip to include the caption. 1358 // If we have a caption, expand the clip to include the caption.
1359 // FIXME: Technically this is wrong, but it's virtually impossible to fix th is 1359 // FIXME: Technically this is wrong, but it's virtually impossible to fix th is
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 1474
1475 LayoutUnit LayoutTable::paddingRight() const 1475 LayoutUnit LayoutTable::paddingRight() const
1476 { 1476 {
1477 if (collapseBorders()) 1477 if (collapseBorders())
1478 return LayoutUnit(); 1478 return LayoutUnit();
1479 1479
1480 return LayoutBlock::paddingRight(); 1480 return LayoutBlock::paddingRight();
1481 } 1481 }
1482 1482
1483 } // namespace blink 1483 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.h ('k') | third_party/WebKit/Source/core/layout/LayoutTableCell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698