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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 // to update the value as its used by flexbox layout. crbug.com/367324 | 249 // to update the value as its used by flexbox layout. crbug.com/367324 |
250 setIntrinsicContentLogicalHeight(contentLogicalHeight()); | 250 setIntrinsicContentLogicalHeight(contentLogicalHeight()); |
251 | 251 |
252 setCellWidthChanged(false); | 252 setCellWidthChanged(false); |
253 } | 253 } |
254 | 254 |
255 LayoutUnit LayoutTableCell::paddingTop() const | 255 LayoutUnit LayoutTableCell::paddingTop() const |
256 { | 256 { |
257 LayoutUnit result = computedCSSPaddingTop(); | 257 LayoutUnit result = computedCSSPaddingTop(); |
258 if (isHorizontalWritingMode()) | 258 if (isHorizontalWritingMode()) |
259 result += (style()->writingMode() == TopToBottomWritingMode ? intrinsicP
addingBefore() : intrinsicPaddingAfter()); | 259 result += (style()->getWritingMode() == TopToBottomWritingMode ? intrins
icPaddingBefore() : intrinsicPaddingAfter()); |
260 // TODO(leviw): The floor call should be removed when Table is sub-pixel awa
re. crbug.com/377847 | 260 // TODO(leviw): The floor call should be removed when Table is sub-pixel awa
re. crbug.com/377847 |
261 return LayoutUnit(result.floor()); | 261 return LayoutUnit(result.floor()); |
262 } | 262 } |
263 | 263 |
264 LayoutUnit LayoutTableCell::paddingBottom() const | 264 LayoutUnit LayoutTableCell::paddingBottom() const |
265 { | 265 { |
266 LayoutUnit result = computedCSSPaddingBottom(); | 266 LayoutUnit result = computedCSSPaddingBottom(); |
267 if (isHorizontalWritingMode()) | 267 if (isHorizontalWritingMode()) |
268 result += (style()->writingMode() == TopToBottomWritingMode ? intrinsicP
addingAfter() : intrinsicPaddingBefore()); | 268 result += (style()->getWritingMode() == TopToBottomWritingMode ? intrins
icPaddingAfter() : intrinsicPaddingBefore()); |
269 // TODO(leviw): The floor call should be removed when Table is sub-pixel awa
re. crbug.com/377847 | 269 // TODO(leviw): The floor call should be removed when Table is sub-pixel awa
re. crbug.com/377847 |
270 return LayoutUnit(result.floor()); | 270 return LayoutUnit(result.floor()); |
271 } | 271 } |
272 | 272 |
273 LayoutUnit LayoutTableCell::paddingLeft() const | 273 LayoutUnit LayoutTableCell::paddingLeft() const |
274 { | 274 { |
275 LayoutUnit result = computedCSSPaddingLeft(); | 275 LayoutUnit result = computedCSSPaddingLeft(); |
276 if (!isHorizontalWritingMode()) | 276 if (!isHorizontalWritingMode()) |
277 result += (style()->writingMode() == LeftToRightWritingMode ? intrinsicP
addingBefore() : intrinsicPaddingAfter()); | 277 result += (style()->getWritingMode() == LeftToRightWritingMode ? intrins
icPaddingBefore() : intrinsicPaddingAfter()); |
278 // TODO(leviw): The floor call should be removed when Table is sub-pixel awa
re. crbug.com/377847 | 278 // TODO(leviw): The floor call should be removed when Table is sub-pixel awa
re. crbug.com/377847 |
279 return LayoutUnit(result.floor()); | 279 return LayoutUnit(result.floor()); |
280 } | 280 } |
281 | 281 |
282 LayoutUnit LayoutTableCell::paddingRight() const | 282 LayoutUnit LayoutTableCell::paddingRight() const |
283 { | 283 { |
284 LayoutUnit result = computedCSSPaddingRight(); | 284 LayoutUnit result = computedCSSPaddingRight(); |
285 if (!isHorizontalWritingMode()) | 285 if (!isHorizontalWritingMode()) |
286 result += (style()->writingMode() == LeftToRightWritingMode ? intrinsicP
addingAfter() : intrinsicPaddingBefore()); | 286 result += (style()->getWritingMode() == LeftToRightWritingMode ? intrins
icPaddingAfter() : intrinsicPaddingBefore()); |
287 // TODO(leviw): The floor call should be removed when Table is sub-pixel awa
re. crbug.com/377847 | 287 // TODO(leviw): The floor call should be removed when Table is sub-pixel awa
re. crbug.com/377847 |
288 return LayoutUnit(result.floor()); | 288 return LayoutUnit(result.floor()); |
289 } | 289 } |
290 | 290 |
291 LayoutUnit LayoutTableCell::paddingBefore() const | 291 LayoutUnit LayoutTableCell::paddingBefore() const |
292 { | 292 { |
293 return LayoutUnit(computedCSSPaddingBefore().floor() + intrinsicPaddingBefor
e()); | 293 return LayoutUnit(computedCSSPaddingBefore().floor() + intrinsicPaddingBefor
e()); |
294 } | 294 } |
295 | 295 |
296 LayoutUnit LayoutTableCell::paddingAfter() const | 296 LayoutUnit LayoutTableCell::paddingAfter() const |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 // we have a common border with the table (think a ltr table with ltr end ce
ll). | 487 // we have a common border with the table (think a ltr table with ltr end ce
ll). |
488 return (isStartColumn && !hasSameDirectionAsTable) || (isEndColumn && hasSam
eDirectionAsTable); | 488 return (isStartColumn && !hasSameDirectionAsTable) || (isEndColumn && hasSam
eDirectionAsTable); |
489 } | 489 } |
490 | 490 |
491 CollapsedBorderValue LayoutTableCell::computeCollapsedStartBorder(IncludeBorderC
olorOrNot includeColor) const | 491 CollapsedBorderValue LayoutTableCell::computeCollapsedStartBorder(IncludeBorderC
olorOrNot includeColor) const |
492 { | 492 { |
493 LayoutTable* table = this->table(); | 493 LayoutTable* table = this->table(); |
494 | 494 |
495 // For the start border, we need to check, in order of precedence: | 495 // For the start border, we need to check, in order of precedence: |
496 // (1) Our start border. | 496 // (1) Our start border. |
497 int startColorProperty = includeColor ? CSSProperty::resolveDirectionAwarePr
operty(CSSPropertyWebkitBorderStartColor, styleForCellFlow().direction(), styleF
orCellFlow().writingMode()) : 0; | 497 int startColorProperty = includeColor ? CSSProperty::resolveDirectionAwarePr
operty(CSSPropertyWebkitBorderStartColor, styleForCellFlow().direction(), styleF
orCellFlow().getWritingMode()) : 0; |
498 int endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProp
erty(CSSPropertyWebkitBorderEndColor, styleForCellFlow().direction(), styleForCe
llFlow().writingMode()) : 0; | 498 int endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProp
erty(CSSPropertyWebkitBorderEndColor, styleForCellFlow().direction(), styleForCe
llFlow().getWritingMode()) : 0; |
499 CollapsedBorderValue result(style()->borderStart(), includeColor ? resolveCo
lor(startColorProperty) : Color(), BCELL); | 499 CollapsedBorderValue result(style()->borderStart(), includeColor ? resolveCo
lor(startColorProperty) : Color(), BCELL); |
500 | 500 |
501 // (2) The end border of the preceding cell. | 501 // (2) The end border of the preceding cell. |
502 LayoutTableCell* cellBefore = table->cellBefore(this); | 502 LayoutTableCell* cellBefore = table->cellBefore(this); |
503 if (cellBefore) { | 503 if (cellBefore) { |
504 CollapsedBorderValue cellBeforeAdjoiningBorder = CollapsedBorderValue(ce
llBefore->borderAdjoiningCellAfter(this), includeColor ? cellBefore->resolveColo
r(endColorProperty) : Color(), BCELL); | 504 CollapsedBorderValue cellBeforeAdjoiningBorder = CollapsedBorderValue(ce
llBefore->borderAdjoiningCellAfter(this), includeColor ? cellBefore->resolveColo
r(endColorProperty) : Color(), BCELL); |
505 // |result| should be the 2nd argument as |cellBefore| should win in cas
e of equality per CSS 2.1 (Border conflict resolution, point 4). | 505 // |result| should be the 2nd argument as |cellBefore| should win in cas
e of equality per CSS 2.1 (Border conflict resolution, point 4). |
506 result = chooseBorder(cellBeforeAdjoiningBorder, result); | 506 result = chooseBorder(cellBeforeAdjoiningBorder, result); |
507 if (!result.exists()) | 507 if (!result.exists()) |
508 return result; | 508 return result; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 | 569 |
570 CollapsedBorderValue LayoutTableCell::computeCollapsedEndBorder(IncludeBorderCol
orOrNot includeColor) const | 570 CollapsedBorderValue LayoutTableCell::computeCollapsedEndBorder(IncludeBorderCol
orOrNot includeColor) const |
571 { | 571 { |
572 LayoutTable* table = this->table(); | 572 LayoutTable* table = this->table(); |
573 // Note: We have to use the effective column information instead of whether
we have a cell after as a table doesn't | 573 // Note: We have to use the effective column information instead of whether
we have a cell after as a table doesn't |
574 // have to be regular (any row can have less cells than the total cell count
). | 574 // have to be regular (any row can have less cells than the total cell count
). |
575 bool isEndColumn = table->absoluteColumnToEffectiveColumn(absoluteColumnInde
x() + colSpan() - 1) == table->numEffectiveColumns() - 1; | 575 bool isEndColumn = table->absoluteColumnToEffectiveColumn(absoluteColumnInde
x() + colSpan() - 1) == table->numEffectiveColumns() - 1; |
576 | 576 |
577 // For end border, we need to check, in order of precedence: | 577 // For end border, we need to check, in order of precedence: |
578 // (1) Our end border. | 578 // (1) Our end border. |
579 int startColorProperty = includeColor ? CSSProperty::resolveDirectionAwarePr
operty(CSSPropertyWebkitBorderStartColor, styleForCellFlow().direction(), styleF
orCellFlow().writingMode()) : 0; | 579 int startColorProperty = includeColor ? CSSProperty::resolveDirectionAwarePr
operty(CSSPropertyWebkitBorderStartColor, styleForCellFlow().direction(), styleF
orCellFlow().getWritingMode()) : 0; |
580 int endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProp
erty(CSSPropertyWebkitBorderEndColor, styleForCellFlow().direction(), styleForCe
llFlow().writingMode()) : 0; | 580 int endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProp
erty(CSSPropertyWebkitBorderEndColor, styleForCellFlow().direction(), styleForCe
llFlow().getWritingMode()) : 0; |
581 CollapsedBorderValue result = CollapsedBorderValue(style()->borderEnd(), inc
ludeColor ? resolveColor(endColorProperty) : Color(), BCELL); | 581 CollapsedBorderValue result = CollapsedBorderValue(style()->borderEnd(), inc
ludeColor ? resolveColor(endColorProperty) : Color(), BCELL); |
582 | 582 |
583 // (2) The start border of the following cell. | 583 // (2) The start border of the following cell. |
584 if (!isEndColumn) { | 584 if (!isEndColumn) { |
585 if (LayoutTableCell* cellAfter = table->cellAfter(this)) { | 585 if (LayoutTableCell* cellAfter = table->cellAfter(this)) { |
586 CollapsedBorderValue cellAfterAdjoiningBorder = CollapsedBorderValue
(cellAfter->borderAdjoiningCellBefore(this), includeColor ? cellAfter->resolveCo
lor(startColorProperty) : Color(), BCELL); | 586 CollapsedBorderValue cellAfterAdjoiningBorder = CollapsedBorderValue
(cellAfter->borderAdjoiningCellBefore(this), includeColor ? cellAfter->resolveCo
lor(startColorProperty) : Color(), BCELL); |
587 result = chooseBorder(result, cellAfterAdjoiningBorder); | 587 result = chooseBorder(result, cellAfterAdjoiningBorder); |
588 if (!result.exists()) | 588 if (!result.exists()) |
589 return result; | 589 return result; |
590 } | 590 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 | 648 |
649 return result; | 649 return result; |
650 } | 650 } |
651 | 651 |
652 CollapsedBorderValue LayoutTableCell::computeCollapsedBeforeBorder(IncludeBorder
ColorOrNot includeColor) const | 652 CollapsedBorderValue LayoutTableCell::computeCollapsedBeforeBorder(IncludeBorder
ColorOrNot includeColor) const |
653 { | 653 { |
654 LayoutTable* table = this->table(); | 654 LayoutTable* table = this->table(); |
655 | 655 |
656 // For before border, we need to check, in order of precedence: | 656 // For before border, we need to check, in order of precedence: |
657 // (1) Our before border. | 657 // (1) Our before border. |
658 int beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareP
roperty(CSSPropertyWebkitBorderBeforeColor, styleForCellFlow().direction(), styl
eForCellFlow().writingMode()) : 0; | 658 int beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareP
roperty(CSSPropertyWebkitBorderBeforeColor, styleForCellFlow().direction(), styl
eForCellFlow().getWritingMode()) : 0; |
659 int afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwarePr
operty(CSSPropertyWebkitBorderAfterColor, styleForCellFlow().direction(), styleF
orCellFlow().writingMode()) : 0; | 659 int afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwarePr
operty(CSSPropertyWebkitBorderAfterColor, styleForCellFlow().direction(), styleF
orCellFlow().getWritingMode()) : 0; |
660 CollapsedBorderValue result = CollapsedBorderValue(style()->borderBefore(),
includeColor ? resolveColor(beforeColorProperty) : Color(), BCELL); | 660 CollapsedBorderValue result = CollapsedBorderValue(style()->borderBefore(),
includeColor ? resolveColor(beforeColorProperty) : Color(), BCELL); |
661 | 661 |
662 LayoutTableCell* prevCell = table->cellAbove(this); | 662 LayoutTableCell* prevCell = table->cellAbove(this); |
663 if (prevCell) { | 663 if (prevCell) { |
664 // (2) A before cell's after border. | 664 // (2) A before cell's after border. |
665 result = chooseBorder(CollapsedBorderValue(prevCell->style()->borderAfte
r(), includeColor ? prevCell->resolveColor(afterColorProperty) : Color(), BCELL)
, result); | 665 result = chooseBorder(CollapsedBorderValue(prevCell->style()->borderAfte
r(), includeColor ? prevCell->resolveColor(afterColorProperty) : Color(), BCELL)
, result); |
666 if (!result.exists()) | 666 if (!result.exists()) |
667 return result; | 667 return result; |
668 } | 668 } |
669 | 669 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 | 726 |
727 return result; | 727 return result; |
728 } | 728 } |
729 | 729 |
730 CollapsedBorderValue LayoutTableCell::computeCollapsedAfterBorder(IncludeBorderC
olorOrNot includeColor) const | 730 CollapsedBorderValue LayoutTableCell::computeCollapsedAfterBorder(IncludeBorderC
olorOrNot includeColor) const |
731 { | 731 { |
732 LayoutTable* table = this->table(); | 732 LayoutTable* table = this->table(); |
733 | 733 |
734 // For after border, we need to check, in order of precedence: | 734 // For after border, we need to check, in order of precedence: |
735 // (1) Our after border. | 735 // (1) Our after border. |
736 int beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareP
roperty(CSSPropertyWebkitBorderBeforeColor, styleForCellFlow().direction(), styl
eForCellFlow().writingMode()) : 0; | 736 int beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareP
roperty(CSSPropertyWebkitBorderBeforeColor, styleForCellFlow().direction(), styl
eForCellFlow().getWritingMode()) : 0; |
737 int afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwarePr
operty(CSSPropertyWebkitBorderAfterColor, styleForCellFlow().direction(), styleF
orCellFlow().writingMode()) : 0; | 737 int afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwarePr
operty(CSSPropertyWebkitBorderAfterColor, styleForCellFlow().direction(), styleF
orCellFlow().getWritingMode()) : 0; |
738 CollapsedBorderValue result = CollapsedBorderValue(style()->borderAfter(), i
ncludeColor ? resolveColor(afterColorProperty) : Color(), BCELL); | 738 CollapsedBorderValue result = CollapsedBorderValue(style()->borderAfter(), i
ncludeColor ? resolveColor(afterColorProperty) : Color(), BCELL); |
739 | 739 |
740 LayoutTableCell* nextCell = table->cellBelow(this); | 740 LayoutTableCell* nextCell = table->cellBelow(this); |
741 if (nextCell) { | 741 if (nextCell) { |
742 // (2) An after cell's before border. | 742 // (2) An after cell's before border. |
743 result = chooseBorder(result, CollapsedBorderValue(nextCell->style()->bo
rderBefore(), includeColor ? nextCell->resolveColor(beforeColorProperty) : Color
(), BCELL)); | 743 result = chooseBorder(result, CollapsedBorderValue(nextCell->style()->bo
rderBefore(), includeColor ? nextCell->resolveColor(beforeColorProperty) : Color
(), BCELL)); |
744 if (!result.exists()) | 744 if (!result.exists()) |
745 return result; | 745 return result; |
746 } | 746 } |
747 | 747 |
(...skipping 269 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 |