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

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: Field instead of global HashMap Created 4 years, 12 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 recalcCells(); 264 recalcCells();
272 } 265 }
273 266
274 bool needsCellRecalc() const { return m_needsCellRecalc; } 267 bool needsCellRecalc() const { return m_needsCellRecalc; }
275 void setNeedsCellRecalc(); 268 void setNeedsCellRecalc();
276 269
277 LayoutUnit rowBaseline(unsigned row) { return m_grid[row].baseline; } 270 LayoutUnit rowBaseline(unsigned row) { return m_grid[row].baseline; }
278 271
279 void rowLogicalHeightChanged(LayoutTableRow*); 272 void rowLogicalHeightChanged(LayoutTableRow*);
280 273
281 void removeCachedCollapsedBorders(const LayoutTableCell*);
282 // Returns true if any collapsed borders of the cell changed.
283 bool setCachedCollapsedBorder(const LayoutTableCell*, CollapsedBorderSide, c onst CollapsedBorderValue&);
284 const CollapsedBorderValue& cachedCollapsedBorder(const LayoutTableCell*, Co llapsedBorderSide) const;
285
286 // distributeExtraLogicalHeightToRows methods return the *consumed* extra lo gical height. 274 // distributeExtraLogicalHeightToRows methods return the *consumed* extra lo gical height.
287 // FIXME: We may want to introduce a structure holding the in-flux layout in formation. 275 // FIXME: We may want to introduce a structure holding the in-flux layout in formation.
288 int distributeExtraLogicalHeightToRows(int extraLogicalHeight); 276 int distributeExtraLogicalHeightToRows(int extraLogicalHeight);
289 277
290 static LayoutTableSection* createAnonymousWithParent(const LayoutObject*); 278 static LayoutTableSection* createAnonymousWithParent(const LayoutObject*);
291 LayoutBox* createAnonymousBoxWithSameTypeAs(const LayoutObject* parent) cons t override 279 LayoutBox* createAnonymousBoxWithSameTypeAs(const LayoutObject* parent) cons t override
292 { 280 {
293 return createAnonymousWithParent(parent); 281 return createAnonymousWithParent(parent);
294 } 282 }
295 283
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // and m_forceSlowPaintPathWithOverflowingCell will be set to save memory. 384 // and m_forceSlowPaintPathWithOverflowingCell will be set to save memory.
397 HashSet<LayoutTableCell*> m_overflowingCells; 385 HashSet<LayoutTableCell*> m_overflowingCells;
398 bool m_forceSlowPaintPathWithOverflowingCell; 386 bool m_forceSlowPaintPathWithOverflowingCell;
399 387
400 // This boolean tracks if we have cells overlapping due to rowspan / colspan 388 // This boolean tracks if we have cells overlapping due to rowspan / colspan
401 // (see class comment above about when it could appear). 389 // (see class comment above about when it could appear).
402 // 390 //
403 // The use is to disable a painting optimization where we just paint the 391 // The use is to disable a painting optimization where we just paint the
404 // invalidated cells. 392 // invalidated cells.
405 bool m_hasMultipleCellLevels; 393 bool m_hasMultipleCellLevels;
406
407 // This map holds the collapsed border values for cells with collapsed borde rs.
408 // It is held at LayoutTableSection level to spare memory consumption by tab le cells.
409 using CellsCollapsedBordersMap = HashMap<std::pair<const LayoutTableCell*, i nt>, CollapsedBorderValue>;
410 CellsCollapsedBordersMap m_cellsCollapsedBorders;
411 }; 394 };
412 395
413 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection()); 396 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection());
414 397
415 } // namespace blink 398 } // namespace blink
416 399
417 #endif // LayoutTableSection_h 400 #endif // LayoutTableSection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698