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

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

Issue 2502353003: Paint collapsed borders of a table as one display item (Closed)
Patch Set: rebaseline-cl Created 4 years 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 bool isFirstOrLastCellInRow() const { 283 bool isFirstOrLastCellInRow() const {
283 return !table()->cellAfter(this) || !table()->cellBefore(this); 284 return !table()->cellAfter(this) || !table()->cellBefore(this);
284 } 285 }
285 #endif 286 #endif
286 287
287 const char* name() const override { return "LayoutTableCell"; } 288 const char* name() const override { return "LayoutTableCell"; }
288 289
289 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override; 290 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override;
290 void invalidateDisplayItemClients(PaintInvalidationReason) const override; 291 void invalidateDisplayItemClients(PaintInvalidationReason) const override;
291 292
292 // TODO(wkorman): Consider renaming to more clearly differentiate from 293 struct CollapsedBorderValues {
293 // CollapsedBorderValue. 294 CollapsedBorderValue startBorder;
294 class CollapsedBorderValues : public DisplayItemClient { 295 CollapsedBorderValue endBorder;
295 public: 296 CollapsedBorderValue beforeBorder;
296 CollapsedBorderValues(const LayoutTable&, 297 CollapsedBorderValue afterBorder;
297 const CollapsedBorderValue& startBorder,
298 const CollapsedBorderValue& endBorder,
299 const CollapsedBorderValue& beforeBorder,
300 const CollapsedBorderValue& afterBorder);
301
302 const CollapsedBorderValue& startBorder() const { return m_startBorder; }
303 const CollapsedBorderValue& endBorder() const { return m_endBorder; }
304 const CollapsedBorderValue& beforeBorder() const { return m_beforeBorder; }
305 const CollapsedBorderValue& afterBorder() const { return m_afterBorder; }
306
307 void setCollapsedBorderValues(const CollapsedBorderValues& other);
308
309 // DisplayItemClient methods.
310 String debugName() const;
311 LayoutRect visualRect() const;
312
313 private:
314 const LayoutTable& m_layoutTable;
315 CollapsedBorderValue m_startBorder;
316 CollapsedBorderValue m_endBorder;
317 CollapsedBorderValue m_beforeBorder;
318 CollapsedBorderValue m_afterBorder;
319 }; 298 };
320 299
321 class RowBackgroundDisplayItemClient : public DisplayItemClient { 300 class RowBackgroundDisplayItemClient : public DisplayItemClient {
322 public: 301 public:
323 RowBackgroundDisplayItemClient(const LayoutTableCell&); 302 RowBackgroundDisplayItemClient(const LayoutTableCell&);
324 303
325 // DisplayItemClient methods. 304 // DisplayItemClient methods.
326 String debugName() const; 305 String debugName() const;
327 LayoutRect visualRect() const; 306 LayoutRect visualRect() const;
328 307
329 private: 308 private:
330 const LayoutTableCell& m_layoutTableCell; 309 const LayoutTableCell& m_layoutTableCell;
331 }; 310 };
332 311
333 bool usesCompositedCellDisplayItemClients() const; 312 bool usesCompositedCellDisplayItemClients() const;
313
334 const CollapsedBorderValues* collapsedBorderValues() const { 314 const CollapsedBorderValues* collapsedBorderValues() const {
335 return m_collapsedBorderValues.get(); 315 return m_collapsedBorderValues.get();
336 } 316 }
337 const DisplayItemClient& backgroundDisplayItemClient() const { 317 const DisplayItemClient& backgroundDisplayItemClient() const {
338 return m_rowBackgroundDisplayItemClient 318 return m_rowBackgroundDisplayItemClient
339 ? static_cast<const DisplayItemClient&>( 319 ? static_cast<const DisplayItemClient&>(
340 *m_rowBackgroundDisplayItemClient) 320 *m_rowBackgroundDisplayItemClient)
341 : *this; 321 : *this;
342 } 322 }
343 323
344 LayoutRect debugRect() const override; 324 LayoutRect debugRect() const override;
345 325
346 void adjustChildDebugRect(LayoutRect&) const override; 326 void adjustChildDebugRect(LayoutRect&) const override;
347 327
348 // A table cell's location is relative to its containing section. 328 // A table cell's location is relative to its containing section.
349 LayoutBox* locationContainer() const override { return section(); } 329 LayoutBox* locationContainer() const override { return section(); }
350 330
351 void ensureIsReadyForPaintInvalidation() override; 331 void ensureIsReadyForPaintInvalidation() override;
352 332
333 LayoutRect localVisualRect() const override;
334
353 protected: 335 protected:
354 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; 336 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
355 void computePreferredLogicalWidths() override; 337 void computePreferredLogicalWidths() override;
356 338
357 void addLayerHitTestRects(LayerHitTestRects&, 339 void addLayerHitTestRects(LayerHitTestRects&,
358 const PaintLayer* currentCompositedLayer, 340 const PaintLayer* currentCompositedLayer,
359 const LayoutPoint& layerOffset, 341 const LayoutPoint& layerOffset,
360 const LayoutRect& containerRect) const override; 342 const LayoutRect& containerRect) const override;
361 343
362 private: 344 private:
363 bool isOfType(LayoutObjectType type) const override { 345 bool isOfType(LayoutObjectType type) const override {
364 return type == LayoutObjectTableCell || LayoutBlockFlow::isOfType(type); 346 return type == LayoutObjectTableCell || LayoutBlockFlow::isOfType(type);
365 } 347 }
366 348
367 void willBeRemovedFromTree() override; 349 void willBeRemovedFromTree() override;
368 350
369 void updateLogicalWidth() override; 351 void updateLogicalWidth() override;
370 352
371 void paintBoxDecorationBackground(const PaintInfo&, 353 void paintBoxDecorationBackground(const PaintInfo&,
372 const LayoutPoint&) const override; 354 const LayoutPoint&) const override;
373 void paintMask(const PaintInfo&, const LayoutPoint&) const override; 355 void paintMask(const PaintInfo&, const LayoutPoint&) const override;
374 356
375 LayoutSize offsetFromContainer(const LayoutObject*) const override; 357 LayoutSize offsetFromContainer(const LayoutObject*) const override;
376 LayoutRect localVisualRect() const override;
377 358
378 int borderHalfLeft(bool outer) const; 359 int borderHalfLeft(bool outer) const;
379 int borderHalfRight(bool outer) const; 360 int borderHalfRight(bool outer) const;
380 int borderHalfTop(bool outer) const; 361 int borderHalfTop(bool outer) const;
381 int borderHalfBottom(bool outer) const; 362 int borderHalfBottom(bool outer) const;
382 363
383 int borderHalfStart(bool outer) const; 364 int borderHalfStart(bool outer) const;
384 int borderHalfEnd(bool outer) const; 365 int borderHalfEnd(bool outer) const;
385 int borderHalfBefore(bool outer) const; 366 int borderHalfBefore(bool outer) const;
386 int borderHalfAfter(bool outer) const; 367 int borderHalfAfter(bool outer) const;
(...skipping 17 matching lines...) Expand all
404 // column, column group). 385 // column, column group).
405 // TODO(jchaffraix): It should be easier to compute all the borders in 386 // TODO(jchaffraix): It should be easier to compute all the borders in
406 // physical coordinates. However this is not the design of the current code. 387 // physical coordinates. However this is not the design of the current code.
407 // 388 //
408 // Blink's support for mixed directionality is currently partial. We only 389 // Blink's support for mixed directionality is currently partial. We only
409 // support the directionality up to |styleForCellFlow|. See comment on the 390 // support the directionality up to |styleForCellFlow|. See comment on the
410 // function above for more details. 391 // function above for more details.
411 // See also https://code.google.com/p/chromium/issues/detail?id=128227 for 392 // See also https://code.google.com/p/chromium/issues/detail?id=128227 for
412 // some history. 393 // some history.
413 // 394 //
414 // Those functions are called when the cache (m_collapsedBorders) is 395 // Those functions are called before paint invalidation if the collapsed
415 // invalidated on LayoutTable. 396 // borders cache is invalidated on LayoutTable.
416 CollapsedBorderValue computeCollapsedStartBorder( 397 CollapsedBorderValue computeCollapsedStartBorder(
417 IncludeBorderColorOrNot = IncludeBorderColor) const; 398 IncludeBorderColorOrNot = IncludeBorderColor) const;
418 CollapsedBorderValue computeCollapsedEndBorder( 399 CollapsedBorderValue computeCollapsedEndBorder(
419 IncludeBorderColorOrNot = IncludeBorderColor) const; 400 IncludeBorderColorOrNot = IncludeBorderColor) const;
420 CollapsedBorderValue computeCollapsedBeforeBorder( 401 CollapsedBorderValue computeCollapsedBeforeBorder(
421 IncludeBorderColorOrNot = IncludeBorderColor) const; 402 IncludeBorderColorOrNot = IncludeBorderColor) const;
422 CollapsedBorderValue computeCollapsedAfterBorder( 403 CollapsedBorderValue computeCollapsedAfterBorder(
423 IncludeBorderColorOrNot = IncludeBorderColor) const; 404 IncludeBorderColorOrNot = IncludeBorderColor) const;
424 405
425 Length logicalWidthFromColumns(LayoutTableCol* firstColForThisCell, 406 Length logicalWidthFromColumns(LayoutTableCol* firstColForThisCell,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 return toLayoutTableCell(firstChild()); 448 return toLayoutTableCell(firstChild());
468 } 449 }
469 450
470 inline LayoutTableCell* LayoutTableRow::lastCell() const { 451 inline LayoutTableCell* LayoutTableRow::lastCell() const {
471 return toLayoutTableCell(lastChild()); 452 return toLayoutTableCell(lastChild());
472 } 453 }
473 454
474 } // namespace blink 455 } // namespace blink
475 456
476 #endif // LayoutTableCell_h 457 #endif // LayoutTableCell_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698