| OLD | NEW |
| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 making this a struct again as it once was. |
| 291 // TODO(wkorman): Consider renaming to more clearly differentiate from | 292 // TODO(wkorman): Consider renaming to more clearly differentiate from |
| 292 // CollapsedBorderValue. | 293 // CollapsedBorderValue. |
| 293 class CollapsedBorderValues : public DisplayItemClient { | 294 class CollapsedBorderValues { |
| 294 public: | 295 public: |
| 295 CollapsedBorderValues(const LayoutTable&, | 296 CollapsedBorderValues(const CollapsedBorderValue& startBorder, |
| 296 const CollapsedBorderValue& startBorder, | |
| 297 const CollapsedBorderValue& endBorder, | 297 const CollapsedBorderValue& endBorder, |
| 298 const CollapsedBorderValue& beforeBorder, | 298 const CollapsedBorderValue& beforeBorder, |
| 299 const CollapsedBorderValue& afterBorder); | 299 const CollapsedBorderValue& afterBorder); |
| 300 | 300 |
| 301 const CollapsedBorderValue& startBorder() const { return m_startBorder; } | 301 const CollapsedBorderValue& startBorder() const { return m_startBorder; } |
| 302 const CollapsedBorderValue& endBorder() const { return m_endBorder; } | 302 const CollapsedBorderValue& endBorder() const { return m_endBorder; } |
| 303 const CollapsedBorderValue& beforeBorder() const { return m_beforeBorder; } | 303 const CollapsedBorderValue& beforeBorder() const { return m_beforeBorder; } |
| 304 const CollapsedBorderValue& afterBorder() const { return m_afterBorder; } | 304 const CollapsedBorderValue& afterBorder() const { return m_afterBorder; } |
| 305 | 305 |
| 306 void setCollapsedBorderValues(const CollapsedBorderValues& other); | 306 void setCollapsedBorderValues(const CollapsedBorderValues& other); |
| 307 | 307 |
| 308 private: |
| 309 CollapsedBorderValue m_startBorder; |
| 310 CollapsedBorderValue m_endBorder; |
| 311 CollapsedBorderValue m_beforeBorder; |
| 312 CollapsedBorderValue m_afterBorder; |
| 313 }; |
| 314 |
| 315 // Composited table cells may paint content such as borders and backgrounds |
| 316 // into their table's graphics layer. In such cases we must use the table's |
| 317 // visual rect for that painting. Thus, we use this class to act as a separate |
| 318 // display item client for unique id purposes on a per-cell basis. |
| 319 class CompositedTableCell : public DisplayItemClient { |
| 320 public: |
| 321 CompositedTableCell(const LayoutTable&); |
| 322 |
| 308 // DisplayItemClient methods. | 323 // DisplayItemClient methods. |
| 309 String debugName() const; | 324 String debugName() const; |
| 310 LayoutRect visualRect() const; | 325 LayoutRect visualRect() const; |
| 311 | 326 |
| 312 private: | 327 private: |
| 313 const LayoutTable& m_layoutTable; | 328 const LayoutTable& m_layoutTable; |
| 314 CollapsedBorderValue m_startBorder; | |
| 315 CollapsedBorderValue m_endBorder; | |
| 316 CollapsedBorderValue m_beforeBorder; | |
| 317 CollapsedBorderValue m_afterBorder; | |
| 318 }; | 329 }; |
| 319 | 330 |
| 320 bool usesTableAsAdditionalDisplayItemClient() const; | 331 bool usesTableAsAdditionalDisplayItemClient() const; |
| 332 const CompositedTableCell* compositedTableCell() const; |
| 321 const CollapsedBorderValues* collapsedBorderValues() const { | 333 const CollapsedBorderValues* collapsedBorderValues() const { |
| 322 return m_collapsedBorderValues.get(); | 334 return m_collapsedBorderValues.get(); |
| 323 } | 335 } |
| 324 | 336 |
| 325 LayoutRect debugRect() const override; | 337 LayoutRect debugRect() const override; |
| 326 | 338 |
| 327 void adjustChildDebugRect(LayoutRect&) const override; | 339 void adjustChildDebugRect(LayoutRect&) const override; |
| 328 | 340 |
| 329 // A table cell's location is relative to its containing section. | 341 // A table cell's location is relative to its containing section. |
| 330 LayoutBox* locationContainer() const override { return section(); } | 342 LayoutBox* locationContainer() const override { return section(); } |
| 331 | 343 |
| 332 protected: | 344 protected: |
| 345 void ensureIsReadyForPaintInvalidation() override; |
| 333 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; | 346 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; |
| 334 void computePreferredLogicalWidths() override; | 347 void computePreferredLogicalWidths() override; |
| 335 | 348 |
| 336 void addLayerHitTestRects(LayerHitTestRects&, | 349 void addLayerHitTestRects(LayerHitTestRects&, |
| 337 const PaintLayer* currentCompositedLayer, | 350 const PaintLayer* currentCompositedLayer, |
| 338 const LayoutPoint& layerOffset, | 351 const LayoutPoint& layerOffset, |
| 339 const LayoutRect& containerRect) const override; | 352 const LayoutRect& containerRect) const override; |
| 340 | 353 |
| 341 private: | 354 private: |
| 342 bool isOfType(LayoutObjectType type) const override { | 355 bool isOfType(LayoutObjectType type) const override { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 438 |
| 426 // The intrinsic padding. | 439 // The intrinsic padding. |
| 427 // See class comment for what they are. | 440 // See class comment for what they are. |
| 428 // | 441 // |
| 429 // Note: Those fields are using non-subpixel units (int) | 442 // Note: Those fields are using non-subpixel units (int) |
| 430 // because we don't do fractional arithmetic on tables. | 443 // because we don't do fractional arithmetic on tables. |
| 431 int m_intrinsicPaddingBefore; | 444 int m_intrinsicPaddingBefore; |
| 432 int m_intrinsicPaddingAfter; | 445 int m_intrinsicPaddingAfter; |
| 433 | 446 |
| 434 std::unique_ptr<CollapsedBorderValues> m_collapsedBorderValues; | 447 std::unique_ptr<CollapsedBorderValues> m_collapsedBorderValues; |
| 448 std::unique_ptr<CompositedTableCell> m_compositedTableCell; |
| 435 }; | 449 }; |
| 436 | 450 |
| 437 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCell, isTableCell()); | 451 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCell, isTableCell()); |
| 438 | 452 |
| 439 inline LayoutTableCell* LayoutTableCell::previousCell() const { | 453 inline LayoutTableCell* LayoutTableCell::previousCell() const { |
| 440 return toLayoutTableCell(LayoutObject::previousSibling()); | 454 return toLayoutTableCell(LayoutObject::previousSibling()); |
| 441 } | 455 } |
| 442 | 456 |
| 443 inline LayoutTableCell* LayoutTableCell::nextCell() const { | 457 inline LayoutTableCell* LayoutTableCell::nextCell() const { |
| 444 return toLayoutTableCell(LayoutObject::nextSibling()); | 458 return toLayoutTableCell(LayoutObject::nextSibling()); |
| 445 } | 459 } |
| 446 | 460 |
| 447 inline LayoutTableCell* LayoutTableRow::firstCell() const { | 461 inline LayoutTableCell* LayoutTableRow::firstCell() const { |
| 448 return toLayoutTableCell(firstChild()); | 462 return toLayoutTableCell(firstChild()); |
| 449 } | 463 } |
| 450 | 464 |
| 451 inline LayoutTableCell* LayoutTableRow::lastCell() const { | 465 inline LayoutTableCell* LayoutTableRow::lastCell() const { |
| 452 return toLayoutTableCell(lastChild()); | 466 return toLayoutTableCell(lastChild()); |
| 453 } | 467 } |
| 454 | 468 |
| 455 } // namespace blink | 469 } // namespace blink |
| 456 | 470 |
| 457 #endif // LayoutTableCell_h | 471 #endif // LayoutTableCell_h |
| OLD | NEW |