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

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: - 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 void collectBorderValues(Vector<CollapsedBorderValue>&);
189 static void sortBorderValues(LayoutTable::CollapsedBorderValues&); 189 static void sortBorderValues(Vector<CollapsedBorderValue>&);
190 190
191 void layout() override; 191 void layout() override;
192 192
193 void paint(const PaintInfo&, const LayoutPoint&) const override; 193 void paint(const PaintInfo&, const LayoutPoint&) const override;
194 194
195 int cellBaselinePosition() const; 195 int cellBaselinePosition() const;
196 bool isBaselineAligned() const { 196 bool isBaselineAligned() const {
197 EVerticalAlign va = style()->verticalAlign(); 197 EVerticalAlign va = style()->verticalAlign();
198 return va == VerticalAlignBaseline || va == VerticalAlignTextBottom || 198 return va == VerticalAlignBaseline || va == VerticalAlignTextBottom ||
199 va == VerticalAlignTextTop || va == VerticalAlignSuper || 199 va == VerticalAlignTextTop || va == VerticalAlignSuper ||
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 bool isFirstOrLastCellInRow() const { 281 bool isFirstOrLastCellInRow() const {
282 return !table()->cellAfter(this) || !table()->cellBefore(this); 282 return !table()->cellAfter(this) || !table()->cellBefore(this);
283 } 283 }
284 #endif 284 #endif
285 285
286 const char* name() const override { return "LayoutTableCell"; } 286 const char* name() const override { return "LayoutTableCell"; }
287 287
288 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override; 288 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override;
289 void invalidateDisplayItemClients(PaintInvalidationReason) 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 // column, column group). 364 // column, column group).
388 // TODO(jchaffraix): It should be easier to compute all the borders in 365 // TODO(jchaffraix): It should be easier to compute all the borders in
389 // physical coordinates. However this is not the design of the current code. 366 // physical coordinates. However this is not the design of the current code.
390 // 367 //
391 // Blink's support for mixed directionality is currently partial. We only 368 // Blink's support for mixed directionality is currently partial. We only
392 // support the directionality up to |styleForCellFlow|. See comment on the 369 // support the directionality up to |styleForCellFlow|. See comment on the
393 // function above for more details. 370 // function above for more details.
394 // See also https://code.google.com/p/chromium/issues/detail?id=128227 for 371 // See also https://code.google.com/p/chromium/issues/detail?id=128227 for
395 // some history. 372 // some history.
396 // 373 //
397 // Those functions are called when the cache (m_collapsedBorders) is 374 // Those functions are called before paint invalidation if the collapsed
398 // invalidated on LayoutTable. 375 // borders cache is invalidated on LayoutTable.
399 CollapsedBorderValue computeCollapsedStartBorder( 376 CollapsedBorderValue computeCollapsedStartBorder(
400 IncludeBorderColorOrNot = IncludeBorderColor) const; 377 IncludeBorderColorOrNot = IncludeBorderColor) const;
401 CollapsedBorderValue computeCollapsedEndBorder( 378 CollapsedBorderValue computeCollapsedEndBorder(
402 IncludeBorderColorOrNot = IncludeBorderColor) const; 379 IncludeBorderColorOrNot = IncludeBorderColor) const;
403 CollapsedBorderValue computeCollapsedBeforeBorder( 380 CollapsedBorderValue computeCollapsedBeforeBorder(
404 IncludeBorderColorOrNot = IncludeBorderColor) const; 381 IncludeBorderColorOrNot = IncludeBorderColor) const;
405 CollapsedBorderValue computeCollapsedAfterBorder( 382 CollapsedBorderValue computeCollapsedAfterBorder(
406 IncludeBorderColorOrNot = IncludeBorderColor) const; 383 IncludeBorderColorOrNot = IncludeBorderColor) const;
407 384
408 Length logicalWidthFromColumns(LayoutTableCol* firstColForThisCell, 385 Length logicalWidthFromColumns(LayoutTableCol* firstColForThisCell,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 return toLayoutTableCell(firstChild()); 425 return toLayoutTableCell(firstChild());
449 } 426 }
450 427
451 inline LayoutTableCell* LayoutTableRow::lastCell() const { 428 inline LayoutTableCell* LayoutTableRow::lastCell() const {
452 return toLayoutTableCell(lastChild()); 429 return toLayoutTableCell(lastChild());
453 } 430 }
454 431
455 } // namespace blink 432 } // namespace blink
456 433
457 #endif // LayoutTableCell_h 434 #endif // LayoutTableCell_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698