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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTableSection.h

Issue 1549693002: Optimize collapsed border painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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, 2009, 2013 Apple Inc. All rights reserv ed. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2013 Apple Inc. All rights reserv ed.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 16 matching lines...) Expand all
27 27
28 #include "core/CoreExport.h" 28 #include "core/CoreExport.h"
29 #include "core/layout/LayoutTable.h" 29 #include "core/layout/LayoutTable.h"
30 #include "wtf/Vector.h" 30 #include "wtf/Vector.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 // This variable is used to balance the memory consumption vs the paint invalida tion time on big tables. 34 // This variable is used to balance the memory consumption vs the paint invalida tion time on big tables.
35 const float gMaxAllowedOverflowingCellRatioForFastPaintPath = 0.1f; 35 const float gMaxAllowedOverflowingCellRatioForFastPaintPath = 0.1f;
36 36
37 enum CollapsedBorderSide {
38 CBSBefore,
39 CBSAfter,
40 CBSStart,
41 CBSEnd
42 };
43
44 // Helper class for paintObject. 37 // Helper class for paintObject.
45 class CellSpan { 38 class CellSpan {
46 STACK_ALLOCATED(); 39 STACK_ALLOCATED();
47 public: 40 public:
48 CellSpan(unsigned start, unsigned end) 41 CellSpan(unsigned start, unsigned end)
49 : m_start(start) 42 : m_start(start)
50 , m_end(end) 43 , m_end(end)
51 { 44 {
52 } 45 }
53 46
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 recalcCells(); 266 recalcCells();
274 } 267 }
275 268
276 bool needsCellRecalc() const { return m_needsCellRecalc; } 269 bool needsCellRecalc() const { return m_needsCellRecalc; }
277 void setNeedsCellRecalc(); 270 void setNeedsCellRecalc();
278 271
279 int rowBaseline(unsigned row) { return m_grid[row].baseline; } 272 int rowBaseline(unsigned row) { return m_grid[row].baseline; }
280 273
281 void rowLogicalHeightChanged(LayoutTableRow*); 274 void rowLogicalHeightChanged(LayoutTableRow*);
282 275
283 void removeCachedCollapsedBorders(const LayoutTableCell*);
284 // Returns true if any collapsed borders of the cell changed.
285 bool setCachedCollapsedBorder(const LayoutTableCell*, CollapsedBorderSide, c onst CollapsedBorderValue&);
286 // Returns null if the border is not cached (there is no such collapsed bord er or the border is invisible).
287 const CollapsedBorderValue* cachedCollapsedBorder(const LayoutTableCell*, Co llapsedBorderSide) const;
288
289 // distributeExtraLogicalHeightToRows methods return the *consumed* extra lo gical height. 276 // distributeExtraLogicalHeightToRows methods return the *consumed* extra lo gical height.
290 // FIXME: We may want to introduce a structure holding the in-flux layout in formation. 277 // FIXME: We may want to introduce a structure holding the in-flux layout in formation.
291 int distributeExtraLogicalHeightToRows(int extraLogicalHeight); 278 int distributeExtraLogicalHeightToRows(int extraLogicalHeight);
292 279
293 static LayoutTableSection* createAnonymousWithParent(const LayoutObject*); 280 static LayoutTableSection* createAnonymousWithParent(const LayoutObject*);
294 LayoutBox* createAnonymousBoxWithSameTypeAs(const LayoutObject* parent) cons t override 281 LayoutBox* createAnonymousBoxWithSameTypeAs(const LayoutObject* parent) cons t override
295 { 282 {
296 return createAnonymousWithParent(parent); 283 return createAnonymousWithParent(parent);
297 } 284 }
298 285
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // and m_forceSlowPaintPathWithOverflowingCell will be set to save memory. 392 // and m_forceSlowPaintPathWithOverflowingCell will be set to save memory.
406 HashSet<LayoutTableCell*> m_overflowingCells; 393 HashSet<LayoutTableCell*> m_overflowingCells;
407 bool m_forceSlowPaintPathWithOverflowingCell; 394 bool m_forceSlowPaintPathWithOverflowingCell;
408 395
409 // This boolean tracks if we have cells overlapping due to rowspan / colspan 396 // This boolean tracks if we have cells overlapping due to rowspan / colspan
410 // (see class comment above about when it could appear). 397 // (see class comment above about when it could appear).
411 // 398 //
412 // The use is to disable a painting optimization where we just paint the 399 // The use is to disable a painting optimization where we just paint the
413 // invalidated cells. 400 // invalidated cells.
414 bool m_hasMultipleCellLevels; 401 bool m_hasMultipleCellLevels;
415
416 // This map holds the collapsed border values for cells with collapsed borde rs.
417 // It is held at LayoutTableSection level to spare memory consumption by tab le cells.
418 // Invisible borders are never stored in this map.
419 using CellsCollapsedBordersMap = HashMap<std::pair<const LayoutTableCell*, i nt>, CollapsedBorderValue>;
420 CellsCollapsedBordersMap m_cellsCollapsedBorders;
421 }; 402 };
422 403
423 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection()); 404 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection());
424 405
425 } // namespace blink 406 } // namespace blink
426 407
427 #endif // LayoutTableSection_h 408 #endif // LayoutTableSection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698