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

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

Issue 2430313004: Paint collapsed borders of a table as one display item (Closed)
Patch Set: Improve raster performance Created 4 years, 1 month 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. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 int borderLeft() const override; 179 int borderLeft() const override;
180 int borderRight() const override; 180 int borderRight() const override;
181 int borderTop() const override; 181 int borderTop() const override;
182 int borderBottom() const override; 182 int borderBottom() const override;
183 int borderStart() const override; 183 int borderStart() const override;
184 int borderEnd() const override; 184 int borderEnd() const override;
185 int borderBefore() const override; 185 int borderBefore() const override;
186 int borderAfter() const override; 186 int borderAfter() const override;
187 187
188 void collectBorderValues(LayoutTable::CollapsedBorderValues&); 188 // Returns true if any collapsed borders related to this cell changed.
189 static void sortBorderValues(LayoutTable::CollapsedBorderValues&); 189 bool collectBorderValues(Vector<CollapsedBorderValue>&);
190 static void sortBorderValues(Vector<CollapsedBorderValue>&);
190 191
191 void layout() override; 192 void layout() override;
192 193
193 void paint(const PaintInfo&, const LayoutPoint&) const override; 194 void paint(const PaintInfo&, const LayoutPoint&) const override;
194 195
195 int cellBaselinePosition() const; 196 int cellBaselinePosition() const;
196 bool isBaselineAligned() const { 197 bool isBaselineAligned() const {
197 EVerticalAlign va = style()->verticalAlign(); 198 EVerticalAlign va = style()->verticalAlign();
198 return va == VerticalAlignBaseline || va == VerticalAlignTextBottom || 199 return va == VerticalAlignBaseline || va == VerticalAlignTextBottom ||
199 va == VerticalAlignTextTop || va == VerticalAlignSuper || 200 va == VerticalAlignTextTop || va == VerticalAlignSuper ||
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 280
280 #if ENABLE(ASSERT) 281 #if ENABLE(ASSERT)
281 bool isFirstOrLastCellInRow() const { 282 bool isFirstOrLastCellInRow() const {
282 return !table()->cellAfter(this) || !table()->cellBefore(this); 283 return !table()->cellAfter(this) || !table()->cellBefore(this);
283 } 284 }
284 #endif 285 #endif
285 286
286 const char* name() const override { return "LayoutTableCell"; } 287 const char* name() const override { return "LayoutTableCell"; }
287 288
288 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override; 289 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override;
289 void invalidateDisplayItemClients(PaintInvalidationReason) const override;
290 290
291 // TODO(wkorman): Consider renaming to more clearly differentiate from 291 struct CollapsedBorderValues {
292 // CollapsedBorderValue. 292 CollapsedBorderValue startBorder;
293 class CollapsedBorderValues : public DisplayItemClient { 293 CollapsedBorderValue endBorder;
294 public: 294 CollapsedBorderValue beforeBorder;
295 CollapsedBorderValues(const LayoutTable&, 295 CollapsedBorderValue afterBorder;
296 const CollapsedBorderValue& startBorder,
297 const CollapsedBorderValue& endBorder,
298 const CollapsedBorderValue& beforeBorder,
299 const CollapsedBorderValue& afterBorder);
300
301 const CollapsedBorderValue& startBorder() const { return m_startBorder; }
302 const CollapsedBorderValue& endBorder() const { return m_endBorder; }
303 const CollapsedBorderValue& beforeBorder() const { return m_beforeBorder; }
304 const CollapsedBorderValue& afterBorder() const { return m_afterBorder; }
305
306 void setCollapsedBorderValues(const CollapsedBorderValues& other);
307
308 // DisplayItemClient methods.
309 String debugName() const;
310 LayoutRect visualRect() const;
311
312 private:
313 const LayoutTable& m_layoutTable;
314 CollapsedBorderValue m_startBorder;
315 CollapsedBorderValue m_endBorder;
316 CollapsedBorderValue m_beforeBorder;
317 CollapsedBorderValue m_afterBorder;
318 }; 296 };
319 297
320 bool usesTableAsAdditionalDisplayItemClient() const;
321 const CollapsedBorderValues* collapsedBorderValues() const { 298 const CollapsedBorderValues* collapsedBorderValues() const {
322 return m_collapsedBorderValues.get(); 299 return m_collapsedBorderValues.get();
323 } 300 }
324 301
325 LayoutRect debugRect() const override; 302 LayoutRect debugRect() const override;
326 303
327 void adjustChildDebugRect(LayoutRect&) const override; 304 void adjustChildDebugRect(LayoutRect&) const override;
328 305
329 // A table cell's location is relative to its containing section. 306 // A table cell's location is relative to its containing section.
330 LayoutBox* locationContainer() const override { return section(); } 307 LayoutBox* locationContainer() const override { return section(); }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 // column, column group). 360 // column, column group).
384 // TODO(jchaffraix): It should be easier to compute all the borders in 361 // TODO(jchaffraix): It should be easier to compute all the borders in
385 // physical coordinates. However this is not the design of the current code. 362 // physical coordinates. However this is not the design of the current code.
386 // 363 //
387 // Blink's support for mixed directionality is currently partial. We only 364 // Blink's support for mixed directionality is currently partial. We only
388 // support the directionality up to |styleForCellFlow|. See comment on the 365 // support the directionality up to |styleForCellFlow|. See comment on the
389 // function above for more details. 366 // function above for more details.
390 // See also https://code.google.com/p/chromium/issues/detail?id=128227 for 367 // See also https://code.google.com/p/chromium/issues/detail?id=128227 for
391 // some history. 368 // some history.
392 // 369 //
393 // Those functions are called when the cache (m_collapsedBorders) is 370 // Those functions are called before paint invalidation if the collapsed
394 // invalidated on LayoutTable. 371 // borders cache is invalidated on LayoutTable.
395 CollapsedBorderValue computeCollapsedStartBorder( 372 CollapsedBorderValue computeCollapsedStartBorder(
396 IncludeBorderColorOrNot = IncludeBorderColor) const; 373 IncludeBorderColorOrNot = IncludeBorderColor) const;
397 CollapsedBorderValue computeCollapsedEndBorder( 374 CollapsedBorderValue computeCollapsedEndBorder(
398 IncludeBorderColorOrNot = IncludeBorderColor) const; 375 IncludeBorderColorOrNot = IncludeBorderColor) const;
399 CollapsedBorderValue computeCollapsedBeforeBorder( 376 CollapsedBorderValue computeCollapsedBeforeBorder(
400 IncludeBorderColorOrNot = IncludeBorderColor) const; 377 IncludeBorderColorOrNot = IncludeBorderColor) const;
401 CollapsedBorderValue computeCollapsedAfterBorder( 378 CollapsedBorderValue computeCollapsedAfterBorder(
402 IncludeBorderColorOrNot = IncludeBorderColor) const; 379 IncludeBorderColorOrNot = IncludeBorderColor) const;
403 380
404 Length logicalWidthFromColumns(LayoutTableCol* firstColForThisCell, 381 Length logicalWidthFromColumns(LayoutTableCol* firstColForThisCell,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 return toLayoutTableCell(firstChild()); 421 return toLayoutTableCell(firstChild());
445 } 422 }
446 423
447 inline LayoutTableCell* LayoutTableRow::lastCell() const { 424 inline LayoutTableCell* LayoutTableRow::lastCell() const {
448 return toLayoutTableCell(lastChild()); 425 return toLayoutTableCell(lastChild());
449 } 426 }
450 427
451 } // namespace blink 428 } // namespace blink
452 429
453 #endif // LayoutTableCell_h 430 #endif // LayoutTableCell_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698