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

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

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

Powered by Google App Engine
This is Rietveld 408576698