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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTableCell.cpp

Issue 2640143005: Support subpixel layout for borders. (Closed)
Patch Set: Rebaselined tests. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
index c3aa30641010b97eb6524cf0649902416224a846..4146da633a4f574417f9255a7ca53b0a0e0af252 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
@@ -415,11 +415,11 @@ LayoutRect LayoutTableCell::localVisualRect() const {
return LayoutBlockFlow::localVisualRect();
bool rtl = !styleForCellFlow().isLeftToRightDirection();
- int outlineOutset = style()->outlineOutsetExtent();
- int left = std::max(borderHalfLeft(true), outlineOutset);
- int right = std::max(borderHalfRight(true), outlineOutset);
- int top = std::max(borderHalfTop(true), outlineOutset);
- int bottom = std::max(borderHalfBottom(true), outlineOutset);
+ LayoutUnit outlineOutset(style()->outlineOutsetExtent());
+ LayoutUnit left(std::max(borderHalfLeft(true), outlineOutset));
+ LayoutUnit right(std::max(borderHalfRight(true), outlineOutset));
+ LayoutUnit top(std::max(borderHalfTop(true), outlineOutset));
+ LayoutUnit bottom(std::max(borderHalfBottom(true), outlineOutset));
if ((left && !rtl) || (right && rtl)) {
if (LayoutTableCell* before = table()->cellBefore(this)) {
top = std::max(top, before->borderHalfTop(true));
@@ -1177,22 +1177,22 @@ CollapsedBorderValue LayoutTableCell::computeCollapsedAfterBorder(
return result;
}
-int LayoutTableCell::borderLeft() const {
+LayoutUnit LayoutTableCell::borderLeft() const {
return table()->collapseBorders() ? borderHalfLeft(false)
: LayoutBlockFlow::borderLeft();
}
-int LayoutTableCell::borderRight() const {
+LayoutUnit LayoutTableCell::borderRight() const {
return table()->collapseBorders() ? borderHalfRight(false)
: LayoutBlockFlow::borderRight();
}
-int LayoutTableCell::borderTop() const {
+LayoutUnit LayoutTableCell::borderTop() const {
return table()->collapseBorders() ? borderHalfTop(false)
: LayoutBlockFlow::borderTop();
}
-int LayoutTableCell::borderBottom() const {
+LayoutUnit LayoutTableCell::borderBottom() const {
return table()->collapseBorders() ? borderHalfBottom(false)
: LayoutBlockFlow::borderBottom();
}
@@ -1200,27 +1200,27 @@ int LayoutTableCell::borderBottom() const {
// FIXME: https://bugs.webkit.org/show_bug.cgi?id=46191, make the collapsed
// border drawing work with different block flow values instead of being
// hard-coded to top-to-bottom.
-int LayoutTableCell::borderStart() const {
+LayoutUnit LayoutTableCell::borderStart() const {
return table()->collapseBorders() ? borderHalfStart(false)
: LayoutBlockFlow::borderStart();
}
-int LayoutTableCell::borderEnd() const {
+LayoutUnit LayoutTableCell::borderEnd() const {
return table()->collapseBorders() ? borderHalfEnd(false)
: LayoutBlockFlow::borderEnd();
}
-int LayoutTableCell::borderBefore() const {
+LayoutUnit LayoutTableCell::borderBefore() const {
return table()->collapseBorders() ? borderHalfBefore(false)
: LayoutBlockFlow::borderBefore();
}
-int LayoutTableCell::borderAfter() const {
+LayoutUnit LayoutTableCell::borderAfter() const {
return table()->collapseBorders() ? borderHalfAfter(false)
: LayoutBlockFlow::borderAfter();
}
-int LayoutTableCell::borderHalfLeft(bool outer) const {
+LayoutUnit LayoutTableCell::borderHalfLeft(bool outer) const {
const ComputedStyle& styleForCellFlow = this->styleForCellFlow();
if (styleForCellFlow.isHorizontalWritingMode())
return styleForCellFlow.isLeftToRightDirection() ? borderHalfStart(outer)
@@ -1230,7 +1230,7 @@ int LayoutTableCell::borderHalfLeft(bool outer) const {
: borderHalfBefore(outer);
}
-int LayoutTableCell::borderHalfRight(bool outer) const {
+LayoutUnit LayoutTableCell::borderHalfRight(bool outer) const {
const ComputedStyle& styleForCellFlow = this->styleForCellFlow();
if (styleForCellFlow.isHorizontalWritingMode())
return styleForCellFlow.isLeftToRightDirection() ? borderHalfEnd(outer)
@@ -1239,7 +1239,7 @@ int LayoutTableCell::borderHalfRight(bool outer) const {
: borderHalfAfter(outer);
}
-int LayoutTableCell::borderHalfTop(bool outer) const {
+LayoutUnit LayoutTableCell::borderHalfTop(bool outer) const {
const ComputedStyle& styleForCellFlow = this->styleForCellFlow();
if (styleForCellFlow.isHorizontalWritingMode())
return styleForCellFlow.isFlippedBlocksWritingMode()
@@ -1249,7 +1249,7 @@ int LayoutTableCell::borderHalfTop(bool outer) const {
: borderHalfEnd(outer);
}
-int LayoutTableCell::borderHalfBottom(bool outer) const {
+LayoutUnit LayoutTableCell::borderHalfBottom(bool outer) const {
const ComputedStyle& styleForCellFlow = this->styleForCellFlow();
if (styleForCellFlow.isHorizontalWritingMode())
return styleForCellFlow.isFlippedBlocksWritingMode()
@@ -1259,46 +1259,52 @@ int LayoutTableCell::borderHalfBottom(bool outer) const {
: borderHalfStart(outer);
}
-int LayoutTableCell::borderHalfStart(bool outer) const {
+LayoutUnit LayoutTableCell::borderHalfStart(bool outer) const {
CollapsedBorderValue border =
computeCollapsedStartBorder(DoNotIncludeBorderColor);
- if (border.exists())
- return (border.width() +
- ((styleForCellFlow().isLeftToRightDirection() ^ outer) ? 1 : 0)) /
- 2; // Give the extra pixel to top and left.
- return 0;
+ if (border.exists()) {
+ return LayoutUnit(
+ (border.width() +
+ ((styleForCellFlow().isLeftToRightDirection() ^ outer) ? 1 : 0)) /
+ 2); // Give the extra pixel to top and left.
+ }
+ return LayoutUnit();
}
-int LayoutTableCell::borderHalfEnd(bool outer) const {
+LayoutUnit LayoutTableCell::borderHalfEnd(bool outer) const {
CollapsedBorderValue border =
computeCollapsedEndBorder(DoNotIncludeBorderColor);
- if (border.exists())
- return (border.width() +
- ((styleForCellFlow().isLeftToRightDirection() ^ outer) ? 0 : 1)) /
- 2;
- return 0;
+ if (border.exists()) {
+ return LayoutUnit(
+ (border.width() +
+ ((styleForCellFlow().isLeftToRightDirection() ^ outer) ? 0 : 1)) /
+ 2);
+ }
+ return LayoutUnit();
}
-int LayoutTableCell::borderHalfBefore(bool outer) const {
+LayoutUnit LayoutTableCell::borderHalfBefore(bool outer) const {
CollapsedBorderValue border =
computeCollapsedBeforeBorder(DoNotIncludeBorderColor);
- if (border.exists())
- return (border.width() +
- ((styleForCellFlow().isFlippedBlocksWritingMode() ^ outer) ? 0
- : 1)) /
- 2; // Give the extra pixel to top and left.
- return 0;
+ if (border.exists()) {
+ return LayoutUnit(
+ (border.width() +
+ ((styleForCellFlow().isFlippedBlocksWritingMode() ^ outer) ? 0 : 1)) /
+ 2); // Give the extra pixel to top and left.
+ }
+ return LayoutUnit();
}
-int LayoutTableCell::borderHalfAfter(bool outer) const {
+LayoutUnit LayoutTableCell::borderHalfAfter(bool outer) const {
CollapsedBorderValue border =
computeCollapsedAfterBorder(DoNotIncludeBorderColor);
- if (border.exists())
- return (border.width() +
- ((styleForCellFlow().isFlippedBlocksWritingMode() ^ outer) ? 1
- : 0)) /
- 2;
- return 0;
+ if (border.exists()) {
+ return LayoutUnit(
+ (border.width() +
+ ((styleForCellFlow().isFlippedBlocksWritingMode() ^ outer) ? 1 : 0)) /
+ 2);
+ }
+ return LayoutUnit();
}
void LayoutTableCell::paint(const PaintInfo& paintInfo,
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableCell.h ('k') | third_party/WebKit/Source/core/layout/api/LayoutBoxModel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698