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

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: 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, 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override; 273 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override;
274 274
275 struct CollapsedBorderValues {
276 CollapsedBorderValue startBorder;
277 CollapsedBorderValue endBorder;
278 CollapsedBorderValue beforeBorder;
279 CollapsedBorderValue afterBorder;
280 };
281 const CollapsedBorderValues* collapsedBorderValues() const { return m_collap sedBorderValues.get(); }
282
275 protected: 283 protected:
276 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override ; 284 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override ;
277 void computePreferredLogicalWidths() override; 285 void computePreferredLogicalWidths() override;
278 286
279 void addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentCompo sitedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) con st override; 287 void addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentCompo sitedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) con st override;
280 288
281 private: 289 private:
282 bool isOfType(LayoutObjectType type) const override { return type == LayoutO bjectTableCell || LayoutBlockFlow::isOfType(type); } 290 bool isOfType(LayoutObjectType type) const override { return type == LayoutO bjectTableCell || LayoutBlockFlow::isOfType(type); }
283 291
284 void willBeRemovedFromTree() override; 292 void willBeRemovedFromTree() override;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 unsigned m_hasColSpan: 1; 358 unsigned m_hasColSpan: 1;
351 unsigned m_hasRowSpan: 1; 359 unsigned m_hasRowSpan: 1;
352 360
353 // The intrinsic padding. 361 // The intrinsic padding.
354 // See class comment for what they are. 362 // See class comment for what they are.
355 // 363 //
356 // Note: Those fields are using non-subpixel units (int) 364 // Note: Those fields are using non-subpixel units (int)
357 // because we don't do fractional arithmetic on tables. 365 // because we don't do fractional arithmetic on tables.
358 int m_intrinsicPaddingBefore; 366 int m_intrinsicPaddingBefore;
359 int m_intrinsicPaddingAfter; 367 int m_intrinsicPaddingAfter;
368
369 OwnPtr<CollapsedBorderValues> m_collapsedBorderValues;
chrishtr 2016/05/04 23:24:18 Is border collapsing common enough that we should
Xianzhu 2016/05/05 00:15:51 It's not common: 6.9% cells have visible collapsed
360 }; 370 };
361 371
362 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCell, isTableCell()); 372 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCell, isTableCell());
363 373
364 inline LayoutTableCell* LayoutTableCell::previousCell() const 374 inline LayoutTableCell* LayoutTableCell::previousCell() const
365 { 375 {
366 return toLayoutTableCell(LayoutObject::previousSibling()); 376 return toLayoutTableCell(LayoutObject::previousSibling());
367 } 377 }
368 378
369 inline LayoutTableCell* LayoutTableCell::nextCell() const 379 inline LayoutTableCell* LayoutTableCell::nextCell() const
370 { 380 {
371 return toLayoutTableCell(LayoutObject::nextSibling()); 381 return toLayoutTableCell(LayoutObject::nextSibling());
372 } 382 }
373 383
374 inline LayoutTableCell* LayoutTableRow::firstCell() const 384 inline LayoutTableCell* LayoutTableRow::firstCell() const
375 { 385 {
376 ASSERT(children() == virtualChildren()); 386 ASSERT(children() == virtualChildren());
377 return toLayoutTableCell(children()->firstChild()); 387 return toLayoutTableCell(children()->firstChild());
378 } 388 }
379 389
380 inline LayoutTableCell* LayoutTableRow::lastCell() const 390 inline LayoutTableCell* LayoutTableRow::lastCell() const
381 { 391 {
382 ASSERT(children() == virtualChildren()); 392 ASSERT(children() == virtualChildren());
383 return toLayoutTableCell(children()->lastChild()); 393 return toLayoutTableCell(children()->lastChild());
384 } 394 }
385 395
386 } // namespace blink 396 } // namespace blink
387 397
388 #endif // LayoutTableCell_h 398 #endif // LayoutTableCell_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698