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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTableCell.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, 2007, 2009, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2013 Apple Inc. All rights reserved.
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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 #if ENABLE(ASSERT) 264 #if ENABLE(ASSERT)
265 bool isFirstOrLastCellInRow() const 265 bool isFirstOrLastCellInRow() const
266 { 266 {
267 return !table()->cellAfter(this) || !table()->cellBefore(this); 267 return !table()->cellAfter(this) || !table()->cellBefore(this);
268 } 268 }
269 #endif 269 #endif
270 270
271 const char* name() const override { return "LayoutTableCell"; } 271 const char* name() const override { return "LayoutTableCell"; }
272 272
273 struct CollapsedBorderValues {
274 CollapsedBorderValue startBorder;
275 CollapsedBorderValue endBorder;
276 CollapsedBorderValue beforeBorder;
277 CollapsedBorderValue afterBorder;
278 };
279 const CollapsedBorderValues* collapsedBorderValues() const { return m_collap sedBorderValues.get(); }
280
273 protected: 281 protected:
274 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override ; 282 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override ;
275 void computePreferredLogicalWidths() override; 283 void computePreferredLogicalWidths() override;
276 284
277 void addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentCompo sitedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) con st override; 285 void addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentCompo sitedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) con st override;
278 286
279 private: 287 private:
280 bool isOfType(LayoutObjectType type) const override { return type == LayoutO bjectTableCell || LayoutBlockFlow::isOfType(type); } 288 bool isOfType(LayoutObjectType type) const override { return type == LayoutO bjectTableCell || LayoutBlockFlow::isOfType(type); }
281 289
282 void willBeRemovedFromTree() override; 290 void willBeRemovedFromTree() override;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 unsigned m_hasColSpan: 1; 356 unsigned m_hasColSpan: 1;
349 unsigned m_hasRowSpan: 1; 357 unsigned m_hasRowSpan: 1;
350 358
351 // The intrinsic padding. 359 // The intrinsic padding.
352 // See class comment for what they are. 360 // See class comment for what they are.
353 // 361 //
354 // Note: Those fields are using non-subpixel units (int) 362 // Note: Those fields are using non-subpixel units (int)
355 // because we don't do fractional arithmetic on tables. 363 // because we don't do fractional arithmetic on tables.
356 int m_intrinsicPaddingBefore; 364 int m_intrinsicPaddingBefore;
357 int m_intrinsicPaddingAfter; 365 int m_intrinsicPaddingAfter;
366
367 OwnPtr<CollapsedBorderValues> m_collapsedBorderValues;
Xianzhu 2015/12/28 21:27:16 Using this field (instead of global maps), we will
Julien - ping for review 2016/01/08 14:18:15 I also think it's a good tradeoff to make but do w
Xianzhu 2016/01/08 17:50:45 For the performance issue of small mutation in a l
Julien - ping for review 2016/01/11 18:11:36 I also prefer having the code separated. FF has th
358 }; 368 };
359 369
360 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCell, isTableCell()); 370 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCell, isTableCell());
361 371
362 inline LayoutTableCell* LayoutTableCell::previousCell() const 372 inline LayoutTableCell* LayoutTableCell::previousCell() const
363 { 373 {
364 return toLayoutTableCell(LayoutObject::previousSibling()); 374 return toLayoutTableCell(LayoutObject::previousSibling());
365 } 375 }
366 376
367 inline LayoutTableCell* LayoutTableCell::nextCell() const 377 inline LayoutTableCell* LayoutTableCell::nextCell() const
368 { 378 {
369 return toLayoutTableCell(LayoutObject::nextSibling()); 379 return toLayoutTableCell(LayoutObject::nextSibling());
370 } 380 }
371 381
372 inline LayoutTableCell* LayoutTableRow::firstCell() const 382 inline LayoutTableCell* LayoutTableRow::firstCell() const
373 { 383 {
374 ASSERT(children() == virtualChildren()); 384 ASSERT(children() == virtualChildren());
375 return toLayoutTableCell(children()->firstChild()); 385 return toLayoutTableCell(children()->firstChild());
376 } 386 }
377 387
378 inline LayoutTableCell* LayoutTableRow::lastCell() const 388 inline LayoutTableCell* LayoutTableRow::lastCell() const
379 { 389 {
380 ASSERT(children() == virtualChildren()); 390 ASSERT(children() == virtualChildren());
381 return toLayoutTableCell(children()->lastChild()); 391 return toLayoutTableCell(children()->lastChild());
382 } 392 }
383 393
384 } // namespace blink 394 } // namespace blink
385 395
386 #endif // LayoutTableCell_h 396 #endif // LayoutTableCell_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698