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

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

Issue 2861773004: Move border-*-width out of BorderValue and store on SurroundData in ComputedStyle instead (Closed)
Patch Set: meade@'s suggestion 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/LayoutTableBoxComponent.h" 5 #include "core/layout/LayoutTableBoxComponent.h"
6 6
7 #include "core/layout/LayoutTable.h" 7 #include "core/layout/LayoutTable.h"
8 #include "core/paint/ObjectPaintInvalidator.h" 8 #include "core/paint/ObjectPaintInvalidator.h"
9 #include "core/style/ComputedStyle.h" 9 #include "core/style/ComputedStyle.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 void LayoutTableBoxComponent::InvalidateCollapsedBordersOnStyleChange( 13 void LayoutTableBoxComponent::InvalidateCollapsedBordersOnStyleChange(
14 const LayoutObject& table_part, 14 const LayoutObject& table_part,
15 LayoutTable& table, 15 LayoutTable& table,
16 const StyleDifference& diff, 16 const StyleDifference& diff,
17 const ComputedStyle& old_style) { 17 const ComputedStyle& old_style) {
18 if (!table.ShouldCollapseBorders()) 18 if (!table.ShouldCollapseBorders())
19 return; 19 return;
20 if (old_style.Border() != table_part.StyleRef().Border() || 20 if (old_style.Border() != table_part.StyleRef().Border() ||
21 !old_style.RadiiEqual(table_part.StyleRef()) || 21 !old_style.RadiiEqual(table_part.StyleRef()) ||
22 !old_style.BorderSizeEquals(table_part.StyleRef()) ||
22 (diff.TextDecorationOrColorChanged() && 23 (diff.TextDecorationOrColorChanged() &&
23 table_part.StyleRef().HasBorderColorReferencingCurrentColor())) 24 table_part.StyleRef().HasBorderColorReferencingCurrentColor()))
24 table.InvalidateCollapsedBorders(); 25 table.InvalidateCollapsedBorders();
25 } 26 }
26 27
27 bool LayoutTableBoxComponent::DoCellsHaveDirtyWidth( 28 bool LayoutTableBoxComponent::DoCellsHaveDirtyWidth(
28 const LayoutObject& table_part, 29 const LayoutObject& table_part,
29 const LayoutTable& table, 30 const LayoutTable& table,
30 const StyleDifference& diff, 31 const StyleDifference& diff,
31 const ComputedStyle& old_style) { 32 const ComputedStyle& old_style) {
32 // ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation sets needsFullLayout 33 // ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation sets needsFullLayout
33 // when border sizes change: checking diff.needsFullLayout() is an 34 // when border sizes change: checking diff.needsFullLayout() is an
34 // optimization, not required for correctness. 35 // optimization, not required for correctness.
35 // TODO(dgrogan): Remove tablePart.needsLayout()? Perhaps it was an old 36 // TODO(dgrogan): Remove tablePart.needsLayout()? Perhaps it was an old
36 // optimization but now it seems that diff.needsFullLayout() implies 37 // optimization but now it seems that diff.needsFullLayout() implies
37 // tablePart.needsLayout(). 38 // tablePart.needsLayout().
38 return diff.NeedsFullLayout() && table_part.NeedsLayout() && 39 return diff.NeedsFullLayout() && table_part.NeedsLayout() &&
39 table.ShouldCollapseBorders() && 40 table.ShouldCollapseBorders() &&
40 !old_style.Border().SizeEquals(table_part.Style()->Border()); 41 !old_style.BorderSizeEquals(*table_part.Style());
41 } 42 }
42 43
43 void LayoutTableBoxComponent::MutableForPainting::UpdatePaintResult( 44 void LayoutTableBoxComponent::MutableForPainting::UpdatePaintResult(
44 PaintResult paint_result, 45 PaintResult paint_result,
45 const CullRect& paint_rect) { 46 const CullRect& paint_rect) {
46 DCHECK_EQ(layout_object_.GetDocument().Lifecycle().GetState(), 47 DCHECK_EQ(layout_object_.GetDocument().Lifecycle().GetState(),
47 DocumentLifecycle::LifecycleState::kInPaint); 48 DocumentLifecycle::LifecycleState::kInPaint);
48 49
49 // A table row or section may paint large background display item which 50 // A table row or section may paint large background display item which
50 // contains paint operations of the background in each contained cell. 51 // contains paint operations of the background in each contained cell.
51 // The display item can be clipped by the paint rect to avoid painting 52 // The display item can be clipped by the paint rect to avoid painting
52 // on areas not interested. If we didn't fully paint and paint rect changes, 53 // on areas not interested. If we didn't fully paint and paint rect changes,
53 // we need to invalidate the display item (using setDisplayItemUncached() 54 // we need to invalidate the display item (using setDisplayItemUncached()
54 // because we are already in painting.) 55 // because we are already in painting.)
55 auto& box = static_cast<LayoutTableBoxComponent&>(layout_object_); 56 auto& box = static_cast<LayoutTableBoxComponent&>(layout_object_);
56 if (box.last_paint_result_ != kFullyPainted && 57 if (box.last_paint_result_ != kFullyPainted &&
57 box.last_paint_rect_ != paint_rect) 58 box.last_paint_rect_ != paint_rect)
58 layout_object_.SetDisplayItemsUncached(); 59 layout_object_.SetDisplayItemsUncached();
59 60
60 box.last_paint_result_ = paint_result; 61 box.last_paint_result_ = paint_result;
61 box.last_paint_rect_ = paint_rect; 62 box.last_paint_rect_ = paint_rect;
62 } 63 }
63 64
64 } // namespace blink 65 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTableCell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698