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. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. |
8 * All rights reserved. | 8 * All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 // The border have the same width and style. Rely on precedence (cell over | 565 // The border have the same width and style. Rely on precedence (cell over |
566 // row over row group, etc.) | 566 // row over row group, etc.) |
567 return border1.Precedence() < border2.Precedence(); | 567 return border1.Precedence() < border2.Precedence(); |
568 } | 568 } |
569 | 569 |
570 static CollapsedBorderValue ChooseBorder(const CollapsedBorderValue& border1, | 570 static CollapsedBorderValue ChooseBorder(const CollapsedBorderValue& border1, |
571 const CollapsedBorderValue& border2) { | 571 const CollapsedBorderValue& border2) { |
572 return CompareBorders(border1, border2) ? border2 : border1; | 572 return CompareBorders(border1, border2) ? border2 : border1; |
573 } | 573 } |
574 | 574 |
| 575 bool LayoutTableCell::IsInStartColumn() const { |
| 576 return !AbsoluteColumnIndex(); |
| 577 } |
| 578 |
| 579 bool LayoutTableCell::IsInEndColumn() const { |
| 580 return Table()->AbsoluteColumnToEffectiveColumn(AbsoluteColumnIndex() + |
| 581 ColSpan() - 1) == |
| 582 Table()->NumEffectiveColumns() - 1; |
| 583 } |
| 584 |
575 bool LayoutTableCell::HasStartBorderAdjoiningTable() const { | 585 bool LayoutTableCell::HasStartBorderAdjoiningTable() const { |
576 bool is_start_column = !AbsoluteColumnIndex(); | |
577 bool is_end_column = Table()->AbsoluteColumnToEffectiveColumn( | |
578 AbsoluteColumnIndex() + ColSpan() - 1) == | |
579 Table()->NumEffectiveColumns() - 1; | |
580 bool has_same_direction_as_table = HasSameDirectionAs(Table()); | |
581 | |
582 // The table direction determines the row direction. In mixed directionality, | 586 // The table direction determines the row direction. In mixed directionality, |
583 // we cannot guarantee that we have a common border with the table (think a | 587 // we cannot guarantee that we have a common border with the table (think a |
584 // ltr table with rtl start cell). | 588 // ltr table with rtl start cell). |
585 return (is_start_column && has_same_direction_as_table) || | 589 return HasSameDirectionAs(Table()) ? IsInStartColumn() : IsInEndColumn(); |
586 (is_end_column && !has_same_direction_as_table); | |
587 } | 590 } |
588 | 591 |
589 bool LayoutTableCell::HasEndBorderAdjoiningTable() const { | 592 bool LayoutTableCell::HasEndBorderAdjoiningTable() const { |
590 bool is_start_column = !AbsoluteColumnIndex(); | |
591 bool is_end_column = Table()->AbsoluteColumnToEffectiveColumn( | |
592 AbsoluteColumnIndex() + ColSpan() - 1) == | |
593 Table()->NumEffectiveColumns() - 1; | |
594 bool has_same_direction_as_table = HasSameDirectionAs(Table()); | |
595 | |
596 // The table direction determines the row direction. In mixed directionality, | 593 // The table direction determines the row direction. In mixed directionality, |
597 // we cannot guarantee that we have a common border with the table (think a | 594 // we cannot guarantee that we have a common border with the table (think a |
598 // ltr table with ltr end cell). | 595 // ltr table with ltr end cell). |
599 return (is_start_column && !has_same_direction_as_table) || | 596 return HasSameDirectionAs(Table()) ? IsInEndColumn() : IsInStartColumn(); |
600 (is_end_column && has_same_direction_as_table); | |
601 } | 597 } |
602 | 598 |
603 CollapsedBorderValue LayoutTableCell::ComputeCollapsedStartBorder( | 599 CollapsedBorderValue LayoutTableCell::ComputeCollapsedStartBorder( |
604 IncludeBorderColorOrNot include_color) const { | 600 IncludeBorderColorOrNot include_color) const { |
605 LayoutTable* table = this->Table(); | 601 LayoutTable* table = this->Table(); |
606 | 602 |
607 // For the start border, we need to check, in order of precedence: | 603 // For the start border, we need to check, in order of precedence: |
608 // (1) Our start border. | 604 // (1) Our start border. |
609 int start_color_property = include_color | 605 int start_color_property = include_color |
610 ? CSSProperty::ResolveDirectionAwareProperty( | 606 ? CSSProperty::ResolveDirectionAwareProperty( |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 } | 1478 } |
1483 | 1479 |
1484 bool LayoutTableCell::HasLineIfEmpty() const { | 1480 bool LayoutTableCell::HasLineIfEmpty() const { |
1485 if (GetNode() && HasEditableStyle(*GetNode())) | 1481 if (GetNode() && HasEditableStyle(*GetNode())) |
1486 return true; | 1482 return true; |
1487 | 1483 |
1488 return LayoutBlock::HasLineIfEmpty(); | 1484 return LayoutBlock::HasLineIfEmpty(); |
1489 } | 1485 } |
1490 | 1486 |
1491 } // namespace blink | 1487 } // namespace blink |
OLD | NEW |