| 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 { | 374 { |
| 375 // <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>:
The baseline of a cell is the baseline of | 375 // <http://www.w3.org/TR/2007/CR-CSS21-20070719/tables.html#height-layout>:
The baseline of a cell is the baseline of |
| 376 // the first in-flow line box in the cell, or the first in-flow table-row in
the cell, whichever comes first. If there | 376 // the first in-flow line box in the cell, or the first in-flow table-row in
the cell, whichever comes first. If there |
| 377 // is no such line box or table-row, the baseline is the bottom of content e
dge of the cell box. | 377 // is no such line box or table-row, the baseline is the bottom of content e
dge of the cell box. |
| 378 LayoutUnit firstLineBaseline = firstLineBoxBaseline(); | 378 LayoutUnit firstLineBaseline = firstLineBoxBaseline(); |
| 379 if (firstLineBaseline != -1) | 379 if (firstLineBaseline != -1) |
| 380 return firstLineBaseline; | 380 return firstLineBaseline; |
| 381 return paddingBefore() + borderBefore() + contentLogicalHeight(); | 381 return paddingBefore() + borderBefore() + contentLogicalHeight(); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void LayoutTableCell::styleDidChange(StyleDifference diff, const LayoutStyle* ol
dStyle) | 384 void LayoutTableCell::styleDidChange(StyleDifference diff, const ComputedStyle*
oldStyle) |
| 385 { | 385 { |
| 386 ASSERT(style()->display() == TABLE_CELL); | 386 ASSERT(style()->display() == TABLE_CELL); |
| 387 | 387 |
| 388 LayoutBlockFlow::styleDidChange(diff, oldStyle); | 388 LayoutBlockFlow::styleDidChange(diff, oldStyle); |
| 389 setHasBoxDecorationBackground(true); | 389 setHasBoxDecorationBackground(true); |
| 390 | 390 |
| 391 if (parent() && section() && oldStyle && style()->height() != oldStyle->heig
ht()) | 391 if (parent() && section() && oldStyle && style()->height() != oldStyle->heig
ht()) |
| 392 section()->rowLogicalHeightChanged(row()); | 392 section()->rowLogicalHeightChanged(row()); |
| 393 | 393 |
| 394 // Our intrinsic padding pushes us down to align with the baseline of other
cells on the row. If our vertical-align | 394 // Our intrinsic padding pushes us down to align with the baseline of other
cells on the row. If our vertical-align |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 return table()->collapseBorders() ? borderHalfBefore(false) : LayoutBlockFlo
w::borderBefore(); | 891 return table()->collapseBorders() ? borderHalfBefore(false) : LayoutBlockFlo
w::borderBefore(); |
| 892 } | 892 } |
| 893 | 893 |
| 894 int LayoutTableCell::borderAfter() const | 894 int LayoutTableCell::borderAfter() const |
| 895 { | 895 { |
| 896 return table()->collapseBorders() ? borderHalfAfter(false) : LayoutBlockFlow
::borderAfter(); | 896 return table()->collapseBorders() ? borderHalfAfter(false) : LayoutBlockFlow
::borderAfter(); |
| 897 } | 897 } |
| 898 | 898 |
| 899 int LayoutTableCell::borderHalfLeft(bool outer) const | 899 int LayoutTableCell::borderHalfLeft(bool outer) const |
| 900 { | 900 { |
| 901 const LayoutStyle& styleForCellFlow = this->styleForCellFlow(); | 901 const ComputedStyle& styleForCellFlow = this->styleForCellFlow(); |
| 902 if (styleForCellFlow.isHorizontalWritingMode()) | 902 if (styleForCellFlow.isHorizontalWritingMode()) |
| 903 return styleForCellFlow.isLeftToRightDirection() ? borderHalfStart(outer
) : borderHalfEnd(outer); | 903 return styleForCellFlow.isLeftToRightDirection() ? borderHalfStart(outer
) : borderHalfEnd(outer); |
| 904 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfAfter(outer
) : borderHalfBefore(outer); | 904 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfAfter(outer
) : borderHalfBefore(outer); |
| 905 } | 905 } |
| 906 | 906 |
| 907 int LayoutTableCell::borderHalfRight(bool outer) const | 907 int LayoutTableCell::borderHalfRight(bool outer) const |
| 908 { | 908 { |
| 909 const LayoutStyle& styleForCellFlow = this->styleForCellFlow(); | 909 const ComputedStyle& styleForCellFlow = this->styleForCellFlow(); |
| 910 if (styleForCellFlow.isHorizontalWritingMode()) | 910 if (styleForCellFlow.isHorizontalWritingMode()) |
| 911 return styleForCellFlow.isLeftToRightDirection() ? borderHalfEnd(outer)
: borderHalfStart(outer); | 911 return styleForCellFlow.isLeftToRightDirection() ? borderHalfEnd(outer)
: borderHalfStart(outer); |
| 912 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfBefore(oute
r) : borderHalfAfter(outer); | 912 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfBefore(oute
r) : borderHalfAfter(outer); |
| 913 } | 913 } |
| 914 | 914 |
| 915 int LayoutTableCell::borderHalfTop(bool outer) const | 915 int LayoutTableCell::borderHalfTop(bool outer) const |
| 916 { | 916 { |
| 917 const LayoutStyle& styleForCellFlow = this->styleForCellFlow(); | 917 const ComputedStyle& styleForCellFlow = this->styleForCellFlow(); |
| 918 if (styleForCellFlow.isHorizontalWritingMode()) | 918 if (styleForCellFlow.isHorizontalWritingMode()) |
| 919 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfAfter(o
uter) : borderHalfBefore(outer); | 919 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfAfter(o
uter) : borderHalfBefore(outer); |
| 920 return styleForCellFlow.isLeftToRightDirection() ? borderHalfStart(outer) :
borderHalfEnd(outer); | 920 return styleForCellFlow.isLeftToRightDirection() ? borderHalfStart(outer) :
borderHalfEnd(outer); |
| 921 } | 921 } |
| 922 | 922 |
| 923 int LayoutTableCell::borderHalfBottom(bool outer) const | 923 int LayoutTableCell::borderHalfBottom(bool outer) const |
| 924 { | 924 { |
| 925 const LayoutStyle& styleForCellFlow = this->styleForCellFlow(); | 925 const ComputedStyle& styleForCellFlow = this->styleForCellFlow(); |
| 926 if (styleForCellFlow.isHorizontalWritingMode()) | 926 if (styleForCellFlow.isHorizontalWritingMode()) |
| 927 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfBefore(
outer) : borderHalfAfter(outer); | 927 return styleForCellFlow.isFlippedBlocksWritingMode() ? borderHalfBefore(
outer) : borderHalfAfter(outer); |
| 928 return styleForCellFlow.isLeftToRightDirection() ? borderHalfEnd(outer) : bo
rderHalfStart(outer); | 928 return styleForCellFlow.isLeftToRightDirection() ? borderHalfEnd(outer) : bo
rderHalfStart(outer); |
| 929 } | 929 } |
| 930 | 930 |
| 931 int LayoutTableCell::borderHalfStart(bool outer) const | 931 int LayoutTableCell::borderHalfStart(bool outer) const |
| 932 { | 932 { |
| 933 CollapsedBorderValue border = collapsedStartBorder(DoNotIncludeBorderColor); | 933 CollapsedBorderValue border = collapsedStartBorder(DoNotIncludeBorderColor); |
| 934 if (border.exists()) | 934 if (border.exists()) |
| 935 return (border.width() + ((styleForCellFlow().isLeftToRightDirection() ^
outer) ? 1 : 0)) / 2; // Give the extra pixel to top and left. | 935 return (border.width() + ((styleForCellFlow().isLeftToRightDirection() ^
outer) ? 1 : 0)) / 2; // Give the extra pixel to top and left. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 LayoutTableCell* LayoutTableCell::createAnonymous(Document* document) | 1044 LayoutTableCell* LayoutTableCell::createAnonymous(Document* document) |
| 1045 { | 1045 { |
| 1046 LayoutTableCell* renderer = new LayoutTableCell(0); | 1046 LayoutTableCell* renderer = new LayoutTableCell(0); |
| 1047 renderer->setDocumentForAnonymous(document); | 1047 renderer->setDocumentForAnonymous(document); |
| 1048 return renderer; | 1048 return renderer; |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 LayoutTableCell* LayoutTableCell::createAnonymousWithParentRenderer(const Layout
Object* parent) | 1051 LayoutTableCell* LayoutTableCell::createAnonymousWithParentRenderer(const Layout
Object* parent) |
| 1052 { | 1052 { |
| 1053 LayoutTableCell* newCell = LayoutTableCell::createAnonymous(&parent->documen
t()); | 1053 LayoutTableCell* newCell = LayoutTableCell::createAnonymous(&parent->documen
t()); |
| 1054 RefPtr<LayoutStyle> newStyle = LayoutStyle::createAnonymousStyleWithDisplay(
parent->styleRef(), TABLE_CELL); | 1054 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp
lay(parent->styleRef(), TABLE_CELL); |
| 1055 newCell->setStyle(newStyle.release()); | 1055 newCell->setStyle(newStyle.release()); |
| 1056 return newCell; | 1056 return newCell; |
| 1057 } | 1057 } |
| 1058 | 1058 |
| 1059 } // namespace blink | 1059 } // namespace blink |
| OLD | NEW |