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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTableCell.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 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 381 }
382 382
383 int LayoutTableCell::cellBaselinePosition() const 383 int LayoutTableCell::cellBaselinePosition() const
384 { 384 {
385 // <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>: The baseline of a cell is the baseline of 385 // <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>: The baseline of a cell is the baseline of
386 // the first in-flow line box in the cell, or the first in-flow table-row in the cell, whichever comes first. If there 386 // the first in-flow line box in the cell, or the first in-flow table-row in the cell, whichever comes first. If there
387 // is no such line box or table-row, the baseline is the bottom of content e dge of the cell box. 387 // is no such line box or table-row, the baseline is the bottom of content e dge of the cell box.
388 int firstLineBaseline = firstLineBoxBaseline(); 388 int firstLineBaseline = firstLineBoxBaseline();
389 if (firstLineBaseline != -1) 389 if (firstLineBaseline != -1)
390 return firstLineBaseline; 390 return firstLineBaseline;
391 return borderBefore() + paddingBefore() + contentLogicalHeight(); 391 return (borderBefore() + paddingBefore() + contentLogicalHeight()).toInt();
392 } 392 }
393 393
394 void LayoutTableCell::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle) 394 void LayoutTableCell::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle)
395 { 395 {
396 ASSERT(style()->display() == TABLE_CELL); 396 ASSERT(style()->display() == TABLE_CELL);
397 397
398 LayoutBlockFlow::styleDidChange(diff, oldStyle); 398 LayoutBlockFlow::styleDidChange(diff, oldStyle);
399 setHasBoxDecorationBackground(true); 399 setHasBoxDecorationBackground(true);
400 400
401 if (parent() && section() && oldStyle && style()->height() != oldStyle->heig ht()) 401 if (parent() && section() && oldStyle && style()->height() != oldStyle->heig ht())
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 || (!isHorizontalWritingMode() && !verticalScrollbarChanged)) 1004 || (!isHorizontalWritingMode() && !verticalScrollbarChanged))
1005 return; 1005 return;
1006 1006
1007 // Shrink our intrinsic padding as much as possible to accommodate the scrol lbar. 1007 // Shrink our intrinsic padding as much as possible to accommodate the scrol lbar.
1008 if (style()->verticalAlign() == VerticalAlignMiddle) { 1008 if (style()->verticalAlign() == VerticalAlignMiddle) {
1009 LayoutUnit totalHeight = logicalHeight(); 1009 LayoutUnit totalHeight = logicalHeight();
1010 LayoutUnit heightWithoutIntrinsicPadding = totalHeight - intrinsicPaddin gBefore() - intrinsicPaddingAfter(); 1010 LayoutUnit heightWithoutIntrinsicPadding = totalHeight - intrinsicPaddin gBefore() - intrinsicPaddingAfter();
1011 totalHeight -= scrollbarHeight; 1011 totalHeight -= scrollbarHeight;
1012 LayoutUnit newBeforePadding = (totalHeight - heightWithoutIntrinsicPaddi ng) / 2; 1012 LayoutUnit newBeforePadding = (totalHeight - heightWithoutIntrinsicPaddi ng) / 2;
1013 LayoutUnit newAfterPadding = totalHeight - heightWithoutIntrinsicPadding - newBeforePadding; 1013 LayoutUnit newAfterPadding = totalHeight - heightWithoutIntrinsicPadding - newBeforePadding;
1014 setIntrinsicPaddingBefore(newBeforePadding); 1014 setIntrinsicPaddingBefore(newBeforePadding.toInt());
1015 setIntrinsicPaddingAfter(newAfterPadding); 1015 setIntrinsicPaddingAfter(newAfterPadding.toInt());
1016 } else { 1016 } else {
1017 setIntrinsicPaddingAfter(intrinsicPaddingAfter() - scrollbarHeight); 1017 setIntrinsicPaddingAfter(intrinsicPaddingAfter() - scrollbarHeight);
1018 } 1018 }
1019 } 1019 }
1020 1020
1021 LayoutTableCell* LayoutTableCell::createAnonymous(Document* document) 1021 LayoutTableCell* LayoutTableCell::createAnonymous(Document* document)
1022 { 1022 {
1023 LayoutTableCell* layoutObject = new LayoutTableCell(nullptr); 1023 LayoutTableCell* layoutObject = new LayoutTableCell(nullptr);
1024 layoutObject->setDocumentForAnonymous(document); 1024 layoutObject->setDocumentForAnonymous(document);
1025 return layoutObject; 1025 return layoutObject;
(...skipping 10 matching lines...) Expand all
1036 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR ect) const 1036 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR ect) const
1037 { 1037 {
1038 // If this object has layer, the area of collapsed borders should be transpa rent 1038 // If this object has layer, the area of collapsed borders should be transpa rent
1039 // to expose the collapsed borders painted on the underlying layer. 1039 // to expose the collapsed borders painted on the underlying layer.
1040 if (hasLayer() && table()->collapseBorders()) 1040 if (hasLayer() && table()->collapseBorders())
1041 return false; 1041 return false;
1042 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect); 1042 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect);
1043 } 1043 }
1044 1044
1045 } // namespace blink 1045 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableCell.h ('k') | third_party/WebKit/Source/core/layout/LayoutTableSection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698