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