Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTable.cpp

Issue 2850633003: Rename LayoutTable::CollapseBorders() to ShouldCollapseBorders() (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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, 2010, 2013 Apple Inc. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
10 * 10 *
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 LayoutTable::~LayoutTable() {} 74 LayoutTable::~LayoutTable() {}
75 75
76 void LayoutTable::StyleDidChange(StyleDifference diff, 76 void LayoutTable::StyleDidChange(StyleDifference diff,
77 const ComputedStyle* old_style) { 77 const ComputedStyle* old_style) {
78 LayoutBlock::StyleDidChange(diff, old_style); 78 LayoutBlock::StyleDidChange(diff, old_style);
79 79
80 bool old_fixed_table_layout = 80 bool old_fixed_table_layout =
81 old_style ? old_style->IsFixedTableLayout() : false; 81 old_style ? old_style->IsFixedTableLayout() : false;
82 82
83 // In the collapsed border model, there is no cell spacing. 83 // In the collapsed border model, there is no cell spacing.
84 h_spacing_ = CollapseBorders() ? 0 : Style()->HorizontalBorderSpacing(); 84 h_spacing_ = ShouldCollapseBorders() ? 0 : Style()->HorizontalBorderSpacing();
85 v_spacing_ = CollapseBorders() ? 0 : Style()->VerticalBorderSpacing(); 85 v_spacing_ = ShouldCollapseBorders() ? 0 : Style()->VerticalBorderSpacing();
86 effective_column_positions_[0] = h_spacing_; 86 effective_column_positions_[0] = h_spacing_;
87 87
88 if (!table_layout_ || 88 if (!table_layout_ ||
89 Style()->IsFixedTableLayout() != old_fixed_table_layout) { 89 Style()->IsFixedTableLayout() != old_fixed_table_layout) {
90 if (table_layout_) 90 if (table_layout_)
91 table_layout_->WillChangeTableLayout(); 91 table_layout_->WillChangeTableLayout();
92 92
93 // According to the CSS2 spec, you only use fixed table layout if an 93 // According to the CSS2 spec, you only use fixed table layout if an
94 // explicit width is specified on the table. Auto width implies auto table 94 // explicit width is specified on the table. Auto width implies auto table
95 // layout. 95 // layout.
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 return ComputeIntrinsicLogicalWidthUsing( 376 return ComputeIntrinsicLogicalWidthUsing(
377 style_logical_width, available_width, 377 style_logical_width, available_width,
378 BordersPaddingAndSpacingInRowDirection()); 378 BordersPaddingAndSpacingInRowDirection());
379 379
380 // HTML tables' width styles already include borders and paddings, but CSS 380 // HTML tables' width styles already include borders and paddings, but CSS
381 // tables' width styles do not. 381 // tables' width styles do not.
382 LayoutUnit borders; 382 LayoutUnit borders;
383 bool is_css_table = !isHTMLTableElement(GetNode()); 383 bool is_css_table = !isHTMLTableElement(GetNode());
384 if (is_css_table && style_logical_width.IsSpecified() && 384 if (is_css_table && style_logical_width.IsSpecified() &&
385 style_logical_width.IsPositive() && 385 style_logical_width.IsPositive() &&
386 Style()->BoxSizing() == EBoxSizing::kContentBox) 386 Style()->BoxSizing() == EBoxSizing::kContentBox) {
387 borders = 387 borders = BorderStart() + BorderEnd() +
388 BorderStart() + BorderEnd() + 388 (ShouldCollapseBorders() ? LayoutUnit()
389 (CollapseBorders() ? LayoutUnit() : PaddingStart() + PaddingEnd()); 389 : PaddingStart() + PaddingEnd());
390 }
390 391
391 return MinimumValueForLength(style_logical_width, available_width) + borders; 392 return MinimumValueForLength(style_logical_width, available_width) + borders;
392 } 393 }
393 394
394 LayoutUnit LayoutTable::ConvertStyleLogicalHeightToComputedHeight( 395 LayoutUnit LayoutTable::ConvertStyleLogicalHeightToComputedHeight(
395 const Length& style_logical_height) const { 396 const Length& style_logical_height) const {
396 LayoutUnit border_and_padding_before = 397 LayoutUnit border_and_padding_before =
397 BorderBefore() + (CollapseBorders() ? LayoutUnit() : PaddingBefore()); 398 BorderBefore() +
399 (ShouldCollapseBorders() ? LayoutUnit() : PaddingBefore());
398 LayoutUnit border_and_padding_after = 400 LayoutUnit border_and_padding_after =
399 BorderAfter() + (CollapseBorders() ? LayoutUnit() : PaddingAfter()); 401 BorderAfter() + (ShouldCollapseBorders() ? LayoutUnit() : PaddingAfter());
400 LayoutUnit border_and_padding = 402 LayoutUnit border_and_padding =
401 border_and_padding_before + border_and_padding_after; 403 border_and_padding_before + border_and_padding_after;
402 LayoutUnit computed_logical_height; 404 LayoutUnit computed_logical_height;
403 if (style_logical_height.IsFixed()) { 405 if (style_logical_height.IsFixed()) {
404 // HTML tables size as though CSS height includes border/padding, CSS tables 406 // HTML tables size as though CSS height includes border/padding, CSS tables
405 // do not. 407 // do not.
406 LayoutUnit borders = LayoutUnit(); 408 LayoutUnit borders = LayoutUnit();
407 // FIXME: We cannot apply box-sizing: content-box on <table> which other 409 // FIXME: We cannot apply box-sizing: content-box on <table> which other
408 // browsers allow. 410 // browsers allow.
409 if (isHTMLTableElement(GetNode()) || 411 if (isHTMLTableElement(GetNode()) ||
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 } 617 }
616 618
617 LayoutTableSection* top_section = this->TopSection(); 619 LayoutTableSection* top_section = this->TopSection();
618 LayoutTableSection* bottom_section = this->BottomSection(); 620 LayoutTableSection* bottom_section = this->BottomSection();
619 621
620 // This is the border-before edge of the "table box", relative to the "table 622 // This is the border-before edge of the "table box", relative to the "table
621 // wrapper box", i.e. right after all top captions. 623 // wrapper box", i.e. right after all top captions.
622 // https://www.w3.org/TR/2011/REC-CSS2-20110607/tables.html#model 624 // https://www.w3.org/TR/2011/REC-CSS2-20110607/tables.html#model
623 LayoutUnit table_box_logical_top = LogicalHeight(); 625 LayoutUnit table_box_logical_top = LogicalHeight();
624 626
625 bool collapsing = CollapseBorders(); 627 bool collapsing = ShouldCollapseBorders();
626 if (collapsing) { 628 if (collapsing) {
627 // Need to set up the table borders before we can position the sections. 629 // Need to set up the table borders before we can position the sections.
628 for (LayoutTableSection* section = top_section; section; 630 for (LayoutTableSection* section = top_section; section;
629 section = SectionBelow(section)) 631 section = SectionBelow(section))
630 section->RecalcOuterBorder(); 632 section->RecalcOuterBorder();
631 } 633 }
632 634
633 LayoutUnit border_and_padding_before = 635 LayoutUnit border_and_padding_before =
634 BorderBefore() + (collapsing ? LayoutUnit() : PaddingBefore()); 636 BorderBefore() + (collapsing ? LayoutUnit() : PaddingBefore());
635 LayoutUnit border_and_padding_after = 637 LayoutUnit border_and_padding_after =
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 } 778 }
777 779
778 void LayoutTable::InvalidateCollapsedBorders() { 780 void LayoutTable::InvalidateCollapsedBorders() {
779 collapsed_borders_.clear(); 781 collapsed_borders_.clear();
780 collapsed_borders_valid_ = false; 782 collapsed_borders_valid_ = false;
781 needs_invalidate_collapsed_borders_for_all_cells_ = true; 783 needs_invalidate_collapsed_borders_for_all_cells_ = true;
782 SetMayNeedPaintInvalidation(); 784 SetMayNeedPaintInvalidation();
783 } 785 }
784 786
785 void LayoutTable::InvalidateCollapsedBordersForAllCellsIfNeeded() { 787 void LayoutTable::InvalidateCollapsedBordersForAllCellsIfNeeded() {
786 DCHECK(CollapseBorders()); 788 DCHECK(ShouldCollapseBorders());
787 789
788 if (!needs_invalidate_collapsed_borders_for_all_cells_) 790 if (!needs_invalidate_collapsed_borders_for_all_cells_)
789 return; 791 return;
790 needs_invalidate_collapsed_borders_for_all_cells_ = false; 792 needs_invalidate_collapsed_borders_for_all_cells_ = false;
791 793
792 for (LayoutObject* section = FirstChild(); section; 794 for (LayoutObject* section = FirstChild(); section;
793 section = section->NextSibling()) { 795 section = section->NextSibling()) {
794 if (!section->IsTableSection()) 796 if (!section->IsTableSection())
795 continue; 797 continue;
796 for (LayoutTableRow* row = ToLayoutTableSection(section)->FirstRow(); row; 798 for (LayoutTableRow* row = ToLayoutTableSection(section)->FirstRow(); row;
797 row = row->NextRow()) { 799 row = row->NextRow()) {
798 for (LayoutTableCell* cell = row->FirstCell(); cell; 800 for (LayoutTableCell* cell = row->FirstCell(); cell;
799 cell = cell->NextCell()) { 801 cell = cell->NextCell()) {
800 DCHECK_EQ(cell->Table(), this); 802 DCHECK_EQ(cell->Table(), this);
801 cell->InvalidateCollapsedBorderValues(); 803 cell->InvalidateCollapsedBorderValues();
802 } 804 }
803 } 805 }
804 } 806 }
805 } 807 }
806 808
807 // Collect all the unique border values that we want to paint in a sorted list. 809 // Collect all the unique border values that we want to paint in a sorted list.
808 // During the collection, each cell saves its recalculated borders into the 810 // During the collection, each cell saves its recalculated borders into the
809 // cache of its containing section, and invalidates itself if any border 811 // cache of its containing section, and invalidates itself if any border
810 // changes. This method doesn't affect layout. 812 // changes. This method doesn't affect layout.
811 void LayoutTable::RecalcCollapsedBordersIfNeeded() { 813 void LayoutTable::RecalcCollapsedBordersIfNeeded() {
812 if (collapsed_borders_valid_ || !CollapseBorders()) 814 if (collapsed_borders_valid_ || !ShouldCollapseBorders())
813 return; 815 return;
814 collapsed_borders_valid_ = true; 816 collapsed_borders_valid_ = true;
815 collapsed_borders_.clear(); 817 collapsed_borders_.clear();
816 for (LayoutObject* section = FirstChild(); section; 818 for (LayoutObject* section = FirstChild(); section;
817 section = section->NextSibling()) { 819 section = section->NextSibling()) {
818 if (!section->IsTableSection()) 820 if (!section->IsTableSection())
819 continue; 821 continue;
820 for (LayoutTableRow* row = ToLayoutTableSection(section)->FirstRow(); row; 822 for (LayoutTableRow* row = ToLayoutTableSection(section)->FirstRow(); row;
821 row = row->NextRow()) { 823 row = row->NextRow()) {
822 for (LayoutTableCell* cell = row->FirstCell(); cell; 824 for (LayoutTableCell* cell = row->FirstCell(); cell;
823 cell = cell->NextCell()) { 825 cell = cell->NextCell()) {
824 DCHECK_EQ(cell->Table(), this); 826 DCHECK_EQ(cell->Table(), this);
825 cell->CollectCollapsedBorderValues(collapsed_borders_); 827 cell->CollectCollapsedBorderValues(collapsed_borders_);
826 } 828 }
827 } 829 }
828 } 830 }
829 LayoutTableCell::SortCollapsedBorderValues(collapsed_borders_); 831 LayoutTableCell::SortCollapsedBorderValues(collapsed_borders_);
830 } 832 }
831 833
832 void LayoutTable::AddOverflowFromChildren() { 834 void LayoutTable::AddOverflowFromChildren() {
833 // Add overflow from borders. 835 // Add overflow from borders.
834 // Technically it's odd that we are incorporating the borders into layout 836 // Technically it's odd that we are incorporating the borders into layout
835 // overflow, which is only supposed to be about overflow from our 837 // overflow, which is only supposed to be about overflow from our
836 // descendant objects, but since tables don't support overflow:auto, this 838 // descendant objects, but since tables don't support overflow:auto, this
837 // works out fine. 839 // works out fine.
838 if (CollapseBorders()) { 840 if (ShouldCollapseBorders()) {
839 LayoutUnit right_border_overflow = 841 LayoutUnit right_border_overflow =
840 Size().Width() + OuterBorderRight() - BorderRight(); 842 Size().Width() + OuterBorderRight() - BorderRight();
841 LayoutUnit left_border_overflow = BorderLeft() - OuterBorderLeft(); 843 LayoutUnit left_border_overflow = BorderLeft() - OuterBorderLeft();
842 LayoutUnit bottom_border_overflow = 844 LayoutUnit bottom_border_overflow =
843 Size().Height() + OuterBorderBottom() - BorderBottom(); 845 Size().Height() + OuterBorderBottom() - BorderBottom();
844 LayoutUnit top_border_overflow = BorderTop() - OuterBorderTop(); 846 LayoutUnit top_border_overflow = BorderTop() - OuterBorderTop();
845 IntRect border_overflow_rect( 847 IntRect border_overflow_rect(
846 left_border_overflow.ToInt(), top_border_overflow.ToInt(), 848 left_border_overflow.ToInt(), top_border_overflow.ToInt(),
847 (right_border_overflow - left_border_overflow).ToInt(), 849 (right_border_overflow - left_border_overflow).ToInt(),
848 (bottom_border_overflow - top_border_overflow).ToInt()); 850 (bottom_border_overflow - top_border_overflow).ToInt());
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 effective_columns_.resize(max_cols); 1173 effective_columns_.resize(max_cols);
1172 effective_column_positions_.resize(max_cols + 1); 1174 effective_column_positions_.resize(max_cols + 1);
1173 no_cell_colspan_at_least_ = CalcNoCellColspanAtLeast(); 1175 no_cell_colspan_at_least_ = CalcNoCellColspanAtLeast();
1174 1176
1175 DCHECK(SelfNeedsLayout()); 1177 DCHECK(SelfNeedsLayout());
1176 1178
1177 needs_section_recalc_ = false; 1179 needs_section_recalc_ = false;
1178 } 1180 }
1179 1181
1180 int LayoutTable::CalcBorderStart() const { 1182 int LayoutTable::CalcBorderStart() const {
1181 if (!CollapseBorders()) 1183 if (!ShouldCollapseBorders())
1182 return LayoutBlock::BorderStart().ToInt(); 1184 return LayoutBlock::BorderStart().ToInt();
1183 1185
1184 // Determined by the first cell of the first row. See the CSS 2.1 spec, 1186 // Determined by the first cell of the first row. See the CSS 2.1 spec,
1185 // section 17.6.2. 1187 // section 17.6.2.
1186 if (!NumEffectiveColumns()) 1188 if (!NumEffectiveColumns())
1187 return 0; 1189 return 0;
1188 1190
1189 int border_width = 0; 1191 int border_width = 0;
1190 1192
1191 const BorderValue& table_start_border = Style()->BorderStart(); 1193 const BorderValue& table_start_border = Style()->BorderStart();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 if (first_row_adjoining_border.Style() > kBorderStyleHidden) { 1240 if (first_row_adjoining_border.Style() > kBorderStyleHidden) {
1239 border_width = 1241 border_width =
1240 std::max<int>(border_width, first_row_adjoining_border.Width()); 1242 std::max<int>(border_width, first_row_adjoining_border.Width());
1241 } 1243 }
1242 } 1244 }
1243 } 1245 }
1244 return (border_width + (Style()->IsLeftToRightDirection() ? 0 : 1)) / 2; 1246 return (border_width + (Style()->IsLeftToRightDirection() ? 0 : 1)) / 2;
1245 } 1247 }
1246 1248
1247 int LayoutTable::CalcBorderEnd() const { 1249 int LayoutTable::CalcBorderEnd() const {
1248 if (!CollapseBorders()) 1250 if (!ShouldCollapseBorders())
1249 return LayoutBlock::BorderEnd().ToInt(); 1251 return LayoutBlock::BorderEnd().ToInt();
1250 1252
1251 // Determined by the last cell of the first row. See the CSS 2.1 spec, section 1253 // Determined by the last cell of the first row. See the CSS 2.1 spec, section
1252 // 17.6.2. 1254 // 17.6.2.
1253 if (!NumEffectiveColumns()) 1255 if (!NumEffectiveColumns())
1254 return 0; 1256 return 0;
1255 1257
1256 int border_width = 0; 1258 int border_width = 0;
1257 1259
1258 const BorderValue& table_end_border = Style()->BorderEnd(); 1260 const BorderValue& table_end_border = Style()->BorderEnd();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 } 1316 }
1315 1317
1316 void LayoutTable::RecalcBordersInRowDirection() { 1318 void LayoutTable::RecalcBordersInRowDirection() {
1317 // FIXME: We need to compute the collapsed before / after borders in the same 1319 // FIXME: We need to compute the collapsed before / after borders in the same
1318 // fashion. 1320 // fashion.
1319 border_start_ = CalcBorderStart(); 1321 border_start_ = CalcBorderStart();
1320 border_end_ = CalcBorderEnd(); 1322 border_end_ = CalcBorderEnd();
1321 } 1323 }
1322 1324
1323 LayoutUnit LayoutTable::BorderBefore() const { 1325 LayoutUnit LayoutTable::BorderBefore() const {
1324 if (CollapseBorders()) { 1326 if (ShouldCollapseBorders()) {
1325 RecalcSectionsIfNeeded(); 1327 RecalcSectionsIfNeeded();
1326 return LayoutUnit(OuterBorderBefore()); 1328 return LayoutUnit(OuterBorderBefore());
1327 } 1329 }
1328 return LayoutBlock::BorderBefore(); 1330 return LayoutBlock::BorderBefore();
1329 } 1331 }
1330 1332
1331 LayoutUnit LayoutTable::BorderAfter() const { 1333 LayoutUnit LayoutTable::BorderAfter() const {
1332 if (CollapseBorders()) { 1334 if (ShouldCollapseBorders()) {
1333 RecalcSectionsIfNeeded(); 1335 RecalcSectionsIfNeeded();
1334 return LayoutUnit(OuterBorderAfter()); 1336 return LayoutUnit(OuterBorderAfter());
1335 } 1337 }
1336 return LayoutBlock::BorderAfter(); 1338 return LayoutBlock::BorderAfter();
1337 } 1339 }
1338 1340
1339 int LayoutTable::OuterBorderBefore() const { 1341 int LayoutTable::OuterBorderBefore() const {
1340 if (!CollapseBorders()) 1342 if (!ShouldCollapseBorders())
1341 return 0; 1343 return 0;
1342 int border_width = 0; 1344 int border_width = 0;
1343 if (LayoutTableSection* top_section = this->TopSection()) { 1345 if (LayoutTableSection* top_section = this->TopSection()) {
1344 border_width = top_section->OuterBorderBefore(); 1346 border_width = top_section->OuterBorderBefore();
1345 if (border_width < 0) 1347 if (border_width < 0)
1346 return 0; // Overridden by hidden 1348 return 0; // Overridden by hidden
1347 } 1349 }
1348 const BorderValue& tb = Style()->BorderBefore(); 1350 const BorderValue& tb = Style()->BorderBefore();
1349 if (tb.Style() == kBorderStyleHidden) 1351 if (tb.Style() == kBorderStyleHidden)
1350 return 0; 1352 return 0;
1351 if (tb.Style() > kBorderStyleHidden) 1353 if (tb.Style() > kBorderStyleHidden)
1352 border_width = std::max<int>(border_width, tb.Width() / 2); 1354 border_width = std::max<int>(border_width, tb.Width() / 2);
1353 return border_width; 1355 return border_width;
1354 } 1356 }
1355 1357
1356 int LayoutTable::OuterBorderAfter() const { 1358 int LayoutTable::OuterBorderAfter() const {
1357 if (!CollapseBorders()) 1359 if (!ShouldCollapseBorders())
1358 return 0; 1360 return 0;
1359 int border_width = 0; 1361 int border_width = 0;
1360 1362
1361 if (LayoutTableSection* section = BottomSection()) { 1363 if (LayoutTableSection* section = BottomSection()) {
1362 border_width = section->OuterBorderAfter(); 1364 border_width = section->OuterBorderAfter();
1363 if (border_width < 0) 1365 if (border_width < 0)
1364 return 0; // Overridden by hidden 1366 return 0; // Overridden by hidden
1365 } 1367 }
1366 const BorderValue& tb = Style()->BorderAfter(); 1368 const BorderValue& tb = Style()->BorderAfter();
1367 if (tb.Style() == kBorderStyleHidden) 1369 if (tb.Style() == kBorderStyleHidden)
1368 return 0; 1370 return 0;
1369 if (tb.Style() > kBorderStyleHidden) 1371 if (tb.Style() > kBorderStyleHidden)
1370 border_width = std::max<int>(border_width, (tb.Width() + 1) / 2); 1372 border_width = std::max<int>(border_width, (tb.Width() + 1) / 2);
1371 return border_width; 1373 return border_width;
1372 } 1374 }
1373 1375
1374 int LayoutTable::OuterBorderStart() const { 1376 int LayoutTable::OuterBorderStart() const {
1375 if (!CollapseBorders()) 1377 if (!ShouldCollapseBorders())
1376 return 0; 1378 return 0;
1377 1379
1378 int border_width = 0; 1380 int border_width = 0;
1379 1381
1380 const BorderValue& tb = Style()->BorderStart(); 1382 const BorderValue& tb = Style()->BorderStart();
1381 if (tb.Style() == kBorderStyleHidden) 1383 if (tb.Style() == kBorderStyleHidden)
1382 return 0; 1384 return 0;
1383 if (tb.Style() > kBorderStyleHidden) 1385 if (tb.Style() > kBorderStyleHidden)
1384 border_width = 1386 border_width =
1385 (tb.Width() + (Style()->IsLeftToRightDirection() ? 0 : 1)) / 2; 1387 (tb.Width() + (Style()->IsLeftToRightDirection() ? 0 : 1)) / 2;
1386 1388
1387 bool all_hidden = true; 1389 bool all_hidden = true;
1388 for (LayoutTableSection* section = TopSection(); section; 1390 for (LayoutTableSection* section = TopSection(); section;
1389 section = SectionBelow(section)) { 1391 section = SectionBelow(section)) {
1390 int sw = section->OuterBorderStart(); 1392 int sw = section->OuterBorderStart();
1391 if (sw < 0) 1393 if (sw < 0)
1392 continue; 1394 continue;
1393 all_hidden = false; 1395 all_hidden = false;
1394 border_width = std::max(border_width, sw); 1396 border_width = std::max(border_width, sw);
1395 } 1397 }
1396 if (all_hidden) 1398 if (all_hidden)
1397 return 0; 1399 return 0;
1398 1400
1399 return border_width; 1401 return border_width;
1400 } 1402 }
1401 1403
1402 int LayoutTable::OuterBorderEnd() const { 1404 int LayoutTable::OuterBorderEnd() const {
1403 if (!CollapseBorders()) 1405 if (!ShouldCollapseBorders())
1404 return 0; 1406 return 0;
1405 1407
1406 int border_width = 0; 1408 int border_width = 0;
1407 1409
1408 const BorderValue& tb = Style()->BorderEnd(); 1410 const BorderValue& tb = Style()->BorderEnd();
1409 if (tb.Style() == kBorderStyleHidden) 1411 if (tb.Style() == kBorderStyleHidden)
1410 return 0; 1412 return 0;
1411 if (tb.Style() > kBorderStyleHidden) 1413 if (tb.Style() > kBorderStyleHidden)
1412 border_width = 1414 border_width =
1413 (tb.Width() + (Style()->IsLeftToRightDirection() ? 1 : 0)) / 2; 1415 (tb.Width() + (Style()->IsLeftToRightDirection() ? 1 : 0)) / 2;
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 return Style()->BorderStart(); 1720 return Style()->BorderStart();
1719 } 1721 }
1720 1722
1721 void LayoutTable::EnsureIsReadyForPaintInvalidation() { 1723 void LayoutTable::EnsureIsReadyForPaintInvalidation() {
1722 LayoutBlock::EnsureIsReadyForPaintInvalidation(); 1724 LayoutBlock::EnsureIsReadyForPaintInvalidation();
1723 RecalcCollapsedBordersIfNeeded(); 1725 RecalcCollapsedBordersIfNeeded();
1724 } 1726 }
1725 1727
1726 PaintInvalidationReason LayoutTable::InvalidatePaint( 1728 PaintInvalidationReason LayoutTable::InvalidatePaint(
1727 const PaintInvalidationState& paint_invalidation_state) { 1729 const PaintInvalidationState& paint_invalidation_state) {
1728 if (CollapseBorders() && !collapsed_borders_.IsEmpty()) 1730 if (ShouldCollapseBorders() && !collapsed_borders_.IsEmpty())
1729 paint_invalidation_state.PaintingLayer() 1731 paint_invalidation_state.PaintingLayer()
1730 .SetNeedsPaintPhaseDescendantBlockBackgrounds(); 1732 .SetNeedsPaintPhaseDescendantBlockBackgrounds();
1731 1733
1732 return LayoutBlock::InvalidatePaint(paint_invalidation_state); 1734 return LayoutBlock::InvalidatePaint(paint_invalidation_state);
1733 } 1735 }
1734 1736
1735 PaintInvalidationReason LayoutTable::InvalidatePaint( 1737 PaintInvalidationReason LayoutTable::InvalidatePaint(
1736 const PaintInvalidatorContext& context) const { 1738 const PaintInvalidatorContext& context) const {
1737 return TablePaintInvalidator(*this, context).InvalidatePaint(); 1739 return TablePaintInvalidator(*this, context).InvalidatePaint();
1738 } 1740 }
1739 1741
1740 LayoutUnit LayoutTable::PaddingTop() const { 1742 LayoutUnit LayoutTable::PaddingTop() const {
1741 if (CollapseBorders()) 1743 if (ShouldCollapseBorders())
1742 return LayoutUnit(); 1744 return LayoutUnit();
1743 1745
1744 return LayoutBlock::PaddingTop(); 1746 return LayoutBlock::PaddingTop();
1745 } 1747 }
1746 1748
1747 LayoutUnit LayoutTable::PaddingBottom() const { 1749 LayoutUnit LayoutTable::PaddingBottom() const {
1748 if (CollapseBorders()) 1750 if (ShouldCollapseBorders())
1749 return LayoutUnit(); 1751 return LayoutUnit();
1750 1752
1751 return LayoutBlock::PaddingBottom(); 1753 return LayoutBlock::PaddingBottom();
1752 } 1754 }
1753 1755
1754 LayoutUnit LayoutTable::PaddingLeft() const { 1756 LayoutUnit LayoutTable::PaddingLeft() const {
1755 if (CollapseBorders()) 1757 if (ShouldCollapseBorders())
1756 return LayoutUnit(); 1758 return LayoutUnit();
1757 1759
1758 return LayoutBlock::PaddingLeft(); 1760 return LayoutBlock::PaddingLeft();
1759 } 1761 }
1760 1762
1761 LayoutUnit LayoutTable::PaddingRight() const { 1763 LayoutUnit LayoutTable::PaddingRight() const {
1762 if (CollapseBorders()) 1764 if (ShouldCollapseBorders())
1763 return LayoutUnit(); 1765 return LayoutUnit();
1764 1766
1765 return LayoutBlock::PaddingRight(); 1767 return LayoutBlock::PaddingRight();
1766 } 1768 }
1767 1769
1768 } // namespace blink 1770 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.h ('k') | third_party/WebKit/Source/core/layout/LayoutTableBoxComponent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698