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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp

Issue 2906253003: Replace call sites to BorderValue functions to save the BorderValue construction cost (Closed)
Patch Set: Redo LayoutTable/LayoutTableSection 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
index bbe7690929d04d6e3e256850ff0f48bee10f4e18..1fb14bff7d333b336e06c8c2b96ffd70345f7dff 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -1350,22 +1350,24 @@ int LayoutTableSection::CalcBlockDirectionOuterBorder(
int border_width = 0;
- const BorderValue& sb =
- side == kBorderBefore ? Style()->BorderBefore() : Style()->BorderAfter();
- if (sb.Style() == EBorderStyle::kHidden)
+ EBorderStyle sbs = side == kBorderBefore ? Style()->BorderBeforeStyle()
rune 2017/05/31 09:02:02 Could we use some more descriptive variable names
nainar 2017/05/31 09:31:57 I can try. Some suggestions: sbs -> style_border
rune 2017/05/31 11:02:09 I think the s is for section (as in LayoutTableSec
nainar 2017/05/31 12:32:48 Done.
+ : Style()->BorderAfterStyle();
+ if (sbs == EBorderStyle::kHidden)
return -1;
- if (ComputedStyle::BorderStyleIsVisible(sb.Style()))
- border_width = sb.Width();
+ if (ComputedStyle::BorderStyleIsVisible(sbs)) {
+ border_width = side == kBorderBefore ? Style()->BorderBeforeWidth()
+ : Style()->BorderAfterWidth();
+ }
- const BorderValue& rb = side == kBorderBefore
- ? FirstRow()->Style()->BorderBefore()
- : LastRow()->Style()->BorderAfter();
- if (rb.Style() == EBorderStyle::kHidden)
+ EBorderStyle rbs = side == kBorderBefore
nainar 2017/05/31 09:31:56 rbs -> row_border_style
nainar 2017/05/31 09:31:56 rbs -> row_border_style
rune 2017/05/31 11:02:10 Acknowledged.
nainar 2017/05/31 12:32:48 Done.
+ ? FirstRow()->Style()->BorderBeforeStyle()
+ : LastRow()->Style()->BorderAfterStyle();
+ float rbw = side == kBorderBefore ? FirstRow()->Style()->BorderBeforeWidth()
nainar 2017/05/31 09:31:56 rbw -> row_border_width
rune 2017/05/31 11:02:10 Acknowledged.
nainar 2017/05/31 12:32:48 Done
+ : LastRow()->Style()->BorderAfterWidth();
+ if (rbs == EBorderStyle::kHidden)
return -1;
- if (ComputedStyle::BorderStyleIsVisible(rb.Style()) &&
- rb.Width() > border_width)
- border_width = rb.Width();
-
+ if (ComputedStyle::BorderStyleIsVisible(rbs) && rbw > border_width)
+ border_width = rbw;
bool all_hidden = true;
unsigned r = side == kBorderBefore ? 0 : grid_.size() - 1;
unsigned n_cols = NumCols(r);
@@ -1376,33 +1378,34 @@ int LayoutTableSection::CalcBlockDirectionOuterBorder(
const ComputedStyle& primary_cell_style =
grid_cell.PrimaryCell()->StyleRef();
// FIXME: Make this work with perpendicular and flipped cells.
- const BorderValue& cb = side == kBorderBefore
- ? primary_cell_style.BorderBefore()
- : primary_cell_style.BorderAfter();
+ EBorderStyle cbs = side == kBorderBefore
nainar 2017/05/31 09:31:56 cbs -> cell_border_style
rune 2017/05/31 11:02:09 Acknowledged.
nainar 2017/05/31 12:32:49 Done
+ ? primary_cell_style.BorderBeforeStyle()
+ : primary_cell_style.BorderAfterStyle();
+ float cbw = side == kBorderBefore ? primary_cell_style.BorderBeforeWidth()
nainar 2017/05/31 09:31:56 cbw -> cell_border_width
rune 2017/05/31 11:02:09 Acknowledged.
nainar 2017/05/31 12:32:48 Done.
+ : primary_cell_style.BorderAfterWidth();
// FIXME: Don't repeat for the same col group
LayoutTableCol* col =
Table()->ColElementAtAbsoluteColumn(c).InnermostColOrColGroup();
if (col) {
- const BorderValue& gb = side == kBorderBefore
- ? col->Style()->BorderBefore()
- : col->Style()->BorderAfter();
- if (gb.Style() == EBorderStyle::kHidden ||
- cb.Style() == EBorderStyle::kHidden)
+ EBorderStyle gbs = side == kBorderBefore
nainar 2017/05/31 09:31:56 gbs -> col_border_style
rune 2017/05/31 11:02:10 Acknowledged.
nainar 2017/05/31 12:32:48 Done
+ ? col->Style()->BorderBeforeStyle()
+ : col->Style()->BorderAfterStyle();
+ const float gbw = side == kBorderBefore
nainar 2017/05/31 09:31:56 gbw -> col_border_width
rune 2017/05/31 11:02:09 Acknowledged.
nainar 2017/05/31 12:32:48 Done.
+ ? col->Style()->BorderBeforeWidth()
+ : col->Style()->BorderAfterWidth();
+ if (gbs == EBorderStyle::kHidden || cbs == EBorderStyle::kHidden)
continue;
all_hidden = false;
- if (ComputedStyle::BorderStyleIsVisible(gb.Style()) &&
- gb.Width() > border_width)
- border_width = gb.Width();
- if (ComputedStyle::BorderStyleIsVisible(cb.Style()) &&
- cb.Width() > border_width)
- border_width = cb.Width();
+ if (ComputedStyle::BorderStyleIsVisible(gbs) && gbw > border_width)
+ border_width = gbw;
+ if (ComputedStyle::BorderStyleIsVisible(cbs) && cbw > border_width)
+ border_width = cbw;
} else {
- if (cb.Style() == EBorderStyle::kHidden)
+ if (cbs == EBorderStyle::kHidden)
continue;
all_hidden = false;
- if (ComputedStyle::BorderStyleIsVisible(cb.Style()) &&
- cb.Width() > border_width)
- border_width = cb.Width();
+ if (ComputedStyle::BorderStyleIsVisible(cbs) && cbw > border_width)
+ border_width = cbw;
}
}
if (all_hidden)
@@ -1422,23 +1425,26 @@ int LayoutTableSection::CalcInlineDirectionOuterBorder(
int border_width = 0;
- const BorderValue& sb =
- side == kBorderStart ? Style()->BorderStart() : Style()->BorderEnd();
- if (sb.Style() == EBorderStyle::kHidden)
+ EBorderStyle sbs = side == kBorderStart ? Style()->BorderStartStyle()
nainar 2017/05/31 09:31:56 sbs -> style_border_style
rune 2017/05/31 11:02:09 section_border_style?
nainar 2017/05/31 12:32:48 Done.
+ : Style()->BorderEndStyle();
+ const float sbw = side == kBorderStart ? Style()->BorderStartWidth()
nainar 2017/05/31 09:31:56 sbw -> style_border_width
rune 2017/05/31 11:02:09 section_border_width?
nainar 2017/05/31 12:32:49 Done
+ : Style()->BorderEndWidth();
+ if (sbs == EBorderStyle::kHidden)
return -1;
- if (ComputedStyle::BorderStyleIsVisible(sb.Style()))
- border_width = sb.Width();
+ if (ComputedStyle::BorderStyleIsVisible(sbs))
+ border_width = sbw;
if (LayoutTableCol* col = Table()
->ColElementAtAbsoluteColumn(col_index)
.InnermostColOrColGroup()) {
- const BorderValue& gb = side == kBorderStart ? col->Style()->BorderStart()
- : col->Style()->BorderEnd();
- if (gb.Style() == EBorderStyle::kHidden)
+ EBorderStyle gbs = side == kBorderStart ? col->Style()->BorderStartStyle()
nainar 2017/05/31 09:31:56 gbs -> col_border_style
rune 2017/05/31 11:02:09 Acknowledged.
nainar 2017/05/31 12:32:48 Done.
+ : col->Style()->BorderEndStyle();
+ const float gbw = side == kBorderStart ? col->Style()->BorderStartWidth()
nainar 2017/05/31 09:31:56 gbw -> col_border_width
rune 2017/05/31 11:02:09 Acknowledged.
nainar 2017/05/31 12:32:48 Done
+ : col->Style()->BorderEndWidth();
+ if (gbs == EBorderStyle::kHidden)
return -1;
- if (ComputedStyle::BorderStyleIsVisible(gb.Style()) &&
- gb.Width() > border_width)
- border_width = gb.Width();
+ if (ComputedStyle::BorderStyleIsVisible(gbs) && gbw > border_width)
+ border_width = gbw;
}
bool all_hidden = true;
@@ -1454,22 +1460,25 @@ int LayoutTableSection::CalcInlineDirectionOuterBorder(
const ComputedStyle& primary_cell_parent_style =
grid_cell.PrimaryCell()->Parent()->StyleRef();
// FIXME: Make this work with perpendicular and flipped cells.
- const BorderValue& cb = side == kBorderStart
- ? primary_cell_style.BorderStart()
- : primary_cell_style.BorderEnd();
- const BorderValue& rb = side == kBorderStart
- ? primary_cell_parent_style.BorderStart()
- : primary_cell_parent_style.BorderEnd();
- if (cb.Style() == EBorderStyle::kHidden ||
- rb.Style() == EBorderStyle::kHidden)
+ EBorderStyle cbs = side == kBorderStart
nainar 2017/05/31 09:31:56 cbs -> cell_border_style
rune 2017/05/31 11:02:09 Acknowledged.
nainar 2017/05/31 12:32:48 Done.
+ ? primary_cell_style.BorderStartStyle()
+ : primary_cell_style.BorderEndStyle();
+ EBorderStyle rbs = side == kBorderStart
nainar 2017/05/31 09:31:57 rbs -> cell_parent_border_style
rune 2017/05/31 11:02:09 row_border_style?
nainar 2017/05/31 12:32:48 Done
+ ? primary_cell_parent_style.BorderStartStyle()
+ : primary_cell_parent_style.BorderEndStyle();
+ const float cbw = side == kBorderStart
nainar 2017/05/31 09:31:56 cbw -> cell_border_width
rune 2017/05/31 11:02:09 Acknowledged.
nainar 2017/05/31 12:32:48 Done
+ ? primary_cell_style.BorderStartWidth()
+ : primary_cell_style.BorderEndWidth();
+ const float rbw = side == kBorderStart
nainar 2017/05/31 09:31:56 rbw -> cell_parent_border_width
rune 2017/05/31 11:02:09 row_border_width?
nainar 2017/05/31 12:32:48 Done
+ ? primary_cell_parent_style.BorderStartWidth()
+ : primary_cell_parent_style.BorderEndWidth();
+ if (cbs == EBorderStyle::kHidden || rbs == EBorderStyle::kHidden)
continue;
all_hidden = false;
- if (ComputedStyle::BorderStyleIsVisible(cb.Style()) &&
- cb.Width() > border_width)
- border_width = cb.Width();
- if (ComputedStyle::BorderStyleIsVisible(rb.Style()) &&
- rb.Width() > border_width)
- border_width = rb.Width();
+ if (ComputedStyle::BorderStyleIsVisible(cbs) && cbw > border_width)
+ border_width = cbw;
+ if (ComputedStyle::BorderStyleIsVisible(rbs) && rbw > border_width)
+ border_width = rbw;
}
if (all_hidden)
return -1;

Powered by Google App Engine
This is Rietveld 408576698