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

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

Issue 2805103003: Optimize collapsed border calculation (step 2) (Closed)
Patch Set: - 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 bool LayoutTableBoxComponent::NeedsInvalidateCollapsedBordersOnStyleChange(
14 const LayoutObject& table_part, 14 const LayoutObject& table_part,
15 LayoutTable& table, 15 const LayoutTable& table,
16 const StyleDifference& diff, 16 const StyleDifference& diff,
17 const ComputedStyle& old_style) { 17 const ComputedStyle& old_style) {
18 if (!table.CollapseBorders()) 18 if (!table.CollapseBorders())
19 return; 19 return false;
20 if (old_style.Border() != table_part.StyleRef().Border() || 20 return old_style.Border() != table_part.StyleRef().Border() ||
21 (diff.TextDecorationOrColorChanged() && 21 (diff.TextDecorationOrColorChanged() &&
22 table_part.StyleRef().HasBorderColorReferencingCurrentColor())) 22 table_part.StyleRef().HasBorderColorReferencingCurrentColor());
23 table.InvalidateCollapsedBorders();
24 } 23 }
25 24
26 bool LayoutTableBoxComponent::DoCellsHaveDirtyWidth( 25 bool LayoutTableBoxComponent::DoCellsHaveDirtyWidth(
27 const LayoutObject& table_part, 26 const LayoutObject& table_part,
28 const LayoutTable& table, 27 const LayoutTable& table,
29 const StyleDifference& diff, 28 const StyleDifference& diff,
30 const ComputedStyle& old_style) { 29 const ComputedStyle& old_style) {
31 // ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation sets needsFullLayout 30 // ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation sets needsFullLayout
32 // when border sizes change: checking diff.needsFullLayout() is an 31 // when border sizes change: checking diff.needsFullLayout() is an
33 // optimization, not required for correctness. 32 // optimization, not required for correctness.
(...skipping 20 matching lines...) Expand all
54 auto& box = static_cast<LayoutTableBoxComponent&>(layout_object_); 53 auto& box = static_cast<LayoutTableBoxComponent&>(layout_object_);
55 if (box.last_paint_result_ != kFullyPainted && 54 if (box.last_paint_result_ != kFullyPainted &&
56 box.last_paint_rect_ != paint_rect) 55 box.last_paint_rect_ != paint_rect)
57 layout_object_.SetDisplayItemsUncached(); 56 layout_object_.SetDisplayItemsUncached();
58 57
59 box.last_paint_result_ = paint_result; 58 box.last_paint_result_ = paint_result;
60 box.last_paint_rect_ = paint_rect; 59 box.last_paint_rect_ = paint_rect;
61 } 60 }
62 61
63 } // namespace blink 62 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698