| OLD | NEW |
| 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 LayoutRect LayoutTableCell::clippedOverflowRectForPaintInvalidation(const Layout
BoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintI
nvalidationState) const | 314 LayoutRect LayoutTableCell::clippedOverflowRectForPaintInvalidation(const Layout
BoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintI
nvalidationState) const |
| 315 { | 315 { |
| 316 // If the table grid is dirty, we cannot get reliable information about adjo
ining cells, | 316 // If the table grid is dirty, we cannot get reliable information about adjo
ining cells, |
| 317 // so we ignore outside borders. This should not be a problem because it mea
ns that | 317 // so we ignore outside borders. This should not be a problem because it mea
ns that |
| 318 // the table is going to recalculate the grid, relayout and issue a paint in
validation of its current rect, which | 318 // the table is going to recalculate the grid, relayout and issue a paint in
validation of its current rect, which |
| 319 // includes any outside borders of this cell. | 319 // includes any outside borders of this cell. |
| 320 if (!table()->collapseBorders() || table()->needsSectionRecalc()) | 320 if (!table()->collapseBorders() || table()->needsSectionRecalc()) |
| 321 return LayoutBlockFlow::clippedOverflowRectForPaintInvalidation(paintInv
alidationContainer, paintInvalidationState); | 321 return LayoutBlockFlow::clippedOverflowRectForPaintInvalidation(paintInv
alidationContainer, paintInvalidationState); |
| 322 | 322 |
| 323 bool rtl = !styleForCellFlow().isLeftToRightDirection(); | 323 bool rtl = !styleForCellFlow().isLeftToRightDirection(); |
| 324 int outlineOutset = style()->outlineOutsetExtent(); | 324 LayoutUnit outlineOutset = style()->outlineOutsetExtent(); |
| 325 int left = std::max(borderHalfLeft(true), outlineOutset); | 325 LayoutUnit left = std::max(borderHalfLeft(true), outlineOutset); |
| 326 int right = std::max(borderHalfRight(true), outlineOutset); | 326 LayoutUnit right = std::max(borderHalfRight(true), outlineOutset); |
| 327 int top = std::max(borderHalfTop(true), outlineOutset); | 327 LayoutUnit top = std::max(borderHalfTop(true), outlineOutset); |
| 328 int bottom = std::max(borderHalfBottom(true), outlineOutset); | 328 LayoutUnit bottom = std::max(borderHalfBottom(true), outlineOutset); |
| 329 if ((left && !rtl) || (right && rtl)) { | 329 if ((left && !rtl) || (right && rtl)) { |
| 330 if (LayoutTableCell* before = table()->cellBefore(this)) { | 330 if (LayoutTableCell* before = table()->cellBefore(this)) { |
| 331 top = std::max(top, before->borderHalfTop(true)); | 331 top = std::max(top, before->borderHalfTop(true)); |
| 332 bottom = std::max(bottom, before->borderHalfBottom(true)); | 332 bottom = std::max(bottom, before->borderHalfBottom(true)); |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 if ((left && rtl) || (right && !rtl)) { | 335 if ((left && rtl) || (right && !rtl)) { |
| 336 if (LayoutTableCell* after = table()->cellAfter(this)) { | 336 if (LayoutTableCell* after = table()->cellAfter(this)) { |
| 337 top = std::max(top, after->borderHalfTop(true)); | 337 top = std::max(top, after->borderHalfTop(true)); |
| 338 bottom = std::max(bottom, after->borderHalfBottom(true)); | 338 bottom = std::max(bottom, after->borderHalfBottom(true)); |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 | 787 |
| 788 // (9) The table's after border. | 788 // (9) The table's after border. |
| 789 result = chooseBorder(result, CollapsedBorderValue(table->style()->borde
rAfter(), includeColor ? table->resolveColor(afterColorProperty) : Color(), BTAB
LE)); | 789 result = chooseBorder(result, CollapsedBorderValue(table->style()->borde
rAfter(), includeColor ? table->resolveColor(afterColorProperty) : Color(), BTAB
LE)); |
| 790 if (!result.exists()) | 790 if (!result.exists()) |
| 791 return result; | 791 return result; |
| 792 } | 792 } |
| 793 | 793 |
| 794 return result; | 794 return result; |
| 795 } | 795 } |
| 796 | 796 |
| 797 int LayoutTableCell::borderLeft() const | 797 LayoutUnit LayoutTableCell::borderLeft() const |
| 798 { | 798 { |
| 799 return table()->collapseBorders() ? borderHalfLeft(false) : LayoutBlockFlow:
:borderLeft(); | 799 return table()->collapseBorders() ? borderHalfLeft(false) : LayoutBlockFlow:
:borderLeft(); |
| 800 } | 800 } |
| 801 | 801 |
| 802 int LayoutTableCell::borderRight() const | 802 LayoutUnit LayoutTableCell::borderRight() const |
| 803 { | 803 { |
| 804 return table()->collapseBorders() ? borderHalfRight(false) : LayoutBlockFlow
::borderRight(); | 804 return table()->collapseBorders() ? borderHalfRight(false) : LayoutBlockFlow
::borderRight(); |
| 805 } | 805 } |
| 806 | 806 |
| 807 int LayoutTableCell::borderTop() const | 807 LayoutUnit LayoutTableCell::borderTop() const |
| 808 { | 808 { |
| 809 return table()->collapseBorders() ? borderHalfTop(false) : LayoutBlockFlow::
borderTop(); | 809 return table()->collapseBorders() ? borderHalfTop(false) : LayoutBlockFlow::
borderTop(); |
| 810 } | 810 } |
| 811 | 811 |
| 812 int LayoutTableCell::borderBottom() const | 812 LayoutUnit LayoutTableCell::borderBottom() const |
| 813 { | 813 { |
| 814 return table()->collapseBorders() ? borderHalfBottom(false) : LayoutBlockFlo
w::borderBottom(); | 814 return table()->collapseBorders() ? borderHalfBottom(false) : LayoutBlockFlo
w::borderBottom(); |
| 815 } | 815 } |
| 816 | 816 |
| 817 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=46191, make the collapsed bord
er drawing | 817 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=46191, make the collapsed bord
er drawing |
| 818 // work with different block flow values instead of being hard-coded to top-to-b
ottom. | 818 // work with different block flow values instead of being hard-coded to top-to-b
ottom. |
| 819 int LayoutTableCell::borderStart() const | 819 LayoutUnit LayoutTableCell::borderStart() const |
| 820 { | 820 { |
| 821 return table()->collapseBorders() ? borderHalfStart(false) : LayoutBlockFlow
::borderStart(); | 821 return table()->collapseBorders() ? borderHalfStart(false) : LayoutBlockFlow
::borderStart(); |
| 822 } | 822 } |
| 823 | 823 |
| 824 int LayoutTableCell::borderEnd() const | 824 LayoutUnit LayoutTableCell::borderEnd() const |
| 825 { | 825 { |
| 826 return table()->collapseBorders() ? borderHalfEnd(false) : LayoutBlockFlow::
borderEnd(); | 826 return table()->collapseBorders() ? borderHalfEnd(false) : LayoutBlockFlow::
borderEnd(); |
| 827 } | 827 } |
| 828 | 828 |
| 829 int LayoutTableCell::borderBefore() const | 829 LayoutUnit LayoutTableCell::borderBefore() const |
| 830 { | 830 { |
| 831 return table()->collapseBorders() ? borderHalfBefore(false) : LayoutBlockFlo
w::borderBefore(); | 831 return table()->collapseBorders() ? borderHalfBefore(false) : LayoutBlockFlo
w::borderBefore(); |
| 832 } | 832 } |
| 833 | 833 |
| 834 int LayoutTableCell::borderAfter() const | 834 LayoutUnit LayoutTableCell::borderAfter() const |
| 835 { | 835 { |
| 836 return table()->collapseBorders() ? borderHalfAfter(false) : LayoutBlockFlow
::borderAfter(); | 836 return table()->collapseBorders() ? borderHalfAfter(false) : LayoutBlockFlow
::borderAfter(); |
| 837 } | 837 } |
| 838 | 838 |
| 839 int LayoutTableCell::borderHalfLeft(bool outer) const | 839 LayoutUnit LayoutTableCell::borderHalfLeft(bool outer) const |
| 840 { | 840 { |
| 841 const ComputedStyle& styleForCellFlow = this->styleForCellFlow(); | 841 const ComputedStyle& styleForCellFlow = this->styleForCellFlow(); |
| 842 if (styleForCellFlow.isHorizontalWritingMode()) | 842 if (styleForCellFlow.isHorizontalWritingMode()) |
| 843 return styleForCellFlow.isLeftToRightDirection() ? borderHalfStart(outer
) : borderHalfEnd(outer); | 843 return styleForCellFlow.isLeftToRightDirection() ? borderHalfStart(outer
) : borderHalfEnd(outer); |
| 844 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfAfter(outer
) : borderHalfBefore(outer); | 844 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfAfter(outer
) : borderHalfBefore(outer); |
| 845 } | 845 } |
| 846 | 846 |
| 847 int LayoutTableCell::borderHalfRight(bool outer) const | 847 LayoutUnit LayoutTableCell::borderHalfRight(bool outer) const |
| 848 { | 848 { |
| 849 const ComputedStyle& styleForCellFlow = this->styleForCellFlow(); | 849 const ComputedStyle& styleForCellFlow = this->styleForCellFlow(); |
| 850 if (styleForCellFlow.isHorizontalWritingMode()) | 850 if (styleForCellFlow.isHorizontalWritingMode()) |
| 851 return styleForCellFlow.isLeftToRightDirection() ? borderHalfEnd(outer)
: borderHalfStart(outer); | 851 return styleForCellFlow.isLeftToRightDirection() ? borderHalfEnd(outer)
: borderHalfStart(outer); |
| 852 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfBefore(oute
r) : borderHalfAfter(outer); | 852 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfBefore(oute
r) : borderHalfAfter(outer); |
| 853 } | 853 } |
| 854 | 854 |
| 855 int LayoutTableCell::borderHalfTop(bool outer) const | 855 LayoutUnit LayoutTableCell::borderHalfTop(bool outer) const |
| 856 { | 856 { |
| 857 const ComputedStyle& styleForCellFlow = this->styleForCellFlow(); | 857 const ComputedStyle& styleForCellFlow = this->styleForCellFlow(); |
| 858 if (styleForCellFlow.isHorizontalWritingMode()) | 858 if (styleForCellFlow.isHorizontalWritingMode()) |
| 859 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfAfter(o
uter) : borderHalfBefore(outer); | 859 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfAfter(o
uter) : borderHalfBefore(outer); |
| 860 return styleForCellFlow.isLeftToRightDirection() ? borderHalfStart(outer) :
borderHalfEnd(outer); | 860 return styleForCellFlow.isLeftToRightDirection() ? borderHalfStart(outer) :
borderHalfEnd(outer); |
| 861 } | 861 } |
| 862 | 862 |
| 863 int LayoutTableCell::borderHalfBottom(bool outer) const | 863 LayoutUnit LayoutTableCell::borderHalfBottom(bool outer) const |
| 864 { | 864 { |
| 865 const ComputedStyle& styleForCellFlow = this->styleForCellFlow(); | 865 const ComputedStyle& styleForCellFlow = this->styleForCellFlow(); |
| 866 if (styleForCellFlow.isHorizontalWritingMode()) | 866 if (styleForCellFlow.isHorizontalWritingMode()) |
| 867 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfBefore(
outer) : borderHalfAfter(outer); | 867 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfBefore(
outer) : borderHalfAfter(outer); |
| 868 return styleForCellFlow.isLeftToRightDirection() ? borderHalfEnd(outer) : bo
rderHalfStart(outer); | 868 return styleForCellFlow.isLeftToRightDirection() ? borderHalfEnd(outer) : bo
rderHalfStart(outer); |
| 869 } | 869 } |
| 870 | 870 |
| 871 int LayoutTableCell::borderHalfStart(bool outer) const | 871 LayoutUnit LayoutTableCell::borderHalfStart(bool outer) const |
| 872 { | 872 { |
| 873 CollapsedBorderValue border = computeCollapsedStartBorder(DoNotIncludeBorder
Color); | 873 CollapsedBorderValue border = computeCollapsedStartBorder(DoNotIncludeBorder
Color); |
| 874 if (border.exists()) | 874 if (border.exists()) |
| 875 return (border.width() + ((styleForCellFlow().isLeftToRightDirection() ^
outer) ? 1 : 0)) / 2; // Give the extra pixel to top and left. | 875 return (border.width() + ((styleForCellFlow().isLeftToRightDirection() ^
outer) ? 1 : 0)) / 2; // Give the extra pixel to top and left. |
| 876 return 0; | 876 return 0; |
| 877 } | 877 } |
| 878 | 878 |
| 879 int LayoutTableCell::borderHalfEnd(bool outer) const | 879 LayoutUnit LayoutTableCell::borderHalfEnd(bool outer) const |
| 880 { | 880 { |
| 881 CollapsedBorderValue border = computeCollapsedEndBorder(DoNotIncludeBorderCo
lor); | 881 CollapsedBorderValue border = computeCollapsedEndBorder(DoNotIncludeBorderCo
lor); |
| 882 if (border.exists()) | 882 if (border.exists()) |
| 883 return (border.width() + ((styleForCellFlow().isLeftToRightDirection() ^
outer) ? 0 : 1)) / 2; | 883 return (border.width() + ((styleForCellFlow().isLeftToRightDirection() ^
outer) ? 0 : 1)) / 2; |
| 884 return 0; | 884 return 0; |
| 885 } | 885 } |
| 886 | 886 |
| 887 int LayoutTableCell::borderHalfBefore(bool outer) const | 887 LayoutUnit LayoutTableCell::borderHalfBefore(bool outer) const |
| 888 { | 888 { |
| 889 CollapsedBorderValue border = computeCollapsedBeforeBorder(DoNotIncludeBorde
rColor); | 889 CollapsedBorderValue border = computeCollapsedBeforeBorder(DoNotIncludeBorde
rColor); |
| 890 if (border.exists()) | 890 if (border.exists()) |
| 891 return (border.width() + ((styleForCellFlow().isFlippedBlocksWritingMode
() ^ outer) ? 0 : 1)) / 2; // Give the extra pixel to top and left. | 891 return (border.width() + ((styleForCellFlow().isFlippedBlocksWritingMode
() ^ outer) ? 0 : 1)) / 2; // Give the extra pixel to top and left. |
| 892 return 0; | 892 return 0; |
| 893 } | 893 } |
| 894 | 894 |
| 895 int LayoutTableCell::borderHalfAfter(bool outer) const | 895 LayoutUnit LayoutTableCell::borderHalfAfter(bool outer) const |
| 896 { | 896 { |
| 897 CollapsedBorderValue border = computeCollapsedAfterBorder(DoNotIncludeBorder
Color); | 897 CollapsedBorderValue border = computeCollapsedAfterBorder(DoNotIncludeBorder
Color); |
| 898 if (border.exists()) | 898 if (border.exists()) |
| 899 return (border.width() + ((styleForCellFlow().isFlippedBlocksWritingMode
() ^ outer) ? 1 : 0)) / 2; | 899 return (border.width() + ((styleForCellFlow().isFlippedBlocksWritingMode
() ^ outer) ? 1 : 0)) / 2; |
| 900 return 0; | 900 return 0; |
| 901 } | 901 } |
| 902 | 902 |
| 903 void LayoutTableCell::paint(const PaintInfo& paintInfo, const LayoutPoint& paint
Offset) const | 903 void LayoutTableCell::paint(const PaintInfo& paintInfo, const LayoutPoint& paint
Offset) const |
| 904 { | 904 { |
| 905 TableCellPainter(*this).paint(paintInfo, paintOffset); | 905 TableCellPainter(*this).paint(paintInfo, paintOffset); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR
ect) const | 1014 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR
ect) const |
| 1015 { | 1015 { |
| 1016 // If this object has layer, the area of collapsed borders should be transpa
rent | 1016 // If this object has layer, the area of collapsed borders should be transpa
rent |
| 1017 // to expose the collapsed borders painted on the underlying layer. | 1017 // to expose the collapsed borders painted on the underlying layer. |
| 1018 if (hasLayer() && table()->collapseBorders()) | 1018 if (hasLayer() && table()->collapseBorders()) |
| 1019 return false; | 1019 return false; |
| 1020 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect); | 1020 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect); |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 } // namespace blink | 1023 } // namespace blink |
| OLD | NEW |