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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 279 |
281 #if ENABLE(ASSERT) | 280 #if ENABLE(ASSERT) |
282 bool isFirstOrLastCellInRow() const { | 281 bool isFirstOrLastCellInRow() const { |
283 return !table()->cellAfter(this) || !table()->cellBefore(this); | 282 return !table()->cellAfter(this) || !table()->cellBefore(this); |
284 } | 283 } |
285 #endif | 284 #endif |
286 | 285 |
287 const char* name() const override { return "LayoutTableCell"; } | 286 const char* name() const override { return "LayoutTableCell"; } |
288 | 287 |
289 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override; | 288 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override; |
| 289 void invalidateDisplayItemClients(PaintInvalidationReason) const override; |
290 | 290 |
291 struct CollapsedBorderValues { | 291 // TODO(wkorman): Consider renaming to more clearly differentiate from |
292 CollapsedBorderValue startBorder; | 292 // CollapsedBorderValue. |
293 CollapsedBorderValue endBorder; | 293 class CollapsedBorderValues : public DisplayItemClient { |
294 CollapsedBorderValue beforeBorder; | 294 public: |
295 CollapsedBorderValue afterBorder; | 295 CollapsedBorderValues(const LayoutTable&, |
| 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; |
296 }; | 318 }; |
297 | 319 |
| 320 bool usesTableAsAdditionalDisplayItemClient() const; |
298 const CollapsedBorderValues* collapsedBorderValues() const { | 321 const CollapsedBorderValues* collapsedBorderValues() const { |
299 return m_collapsedBorderValues.get(); | 322 return m_collapsedBorderValues.get(); |
300 } | 323 } |
301 | 324 |
302 LayoutRect debugRect() const override; | 325 LayoutRect debugRect() const override; |
303 | 326 |
304 void adjustChildDebugRect(LayoutRect&) const override; | 327 void adjustChildDebugRect(LayoutRect&) const override; |
305 | 328 |
306 // A table cell's location is relative to its containing section. | 329 // A table cell's location is relative to its containing section. |
307 LayoutBox* locationContainer() const override { return section(); } | 330 LayoutBox* locationContainer() const override { return section(); } |
308 | 331 |
309 LayoutRect localVisualRect() const override; | |
310 | |
311 protected: | 332 protected: |
312 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; | 333 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; |
313 void computePreferredLogicalWidths() override; | 334 void computePreferredLogicalWidths() override; |
314 | 335 |
315 void addLayerHitTestRects(LayerHitTestRects&, | 336 void addLayerHitTestRects(LayerHitTestRects&, |
316 const PaintLayer* currentCompositedLayer, | 337 const PaintLayer* currentCompositedLayer, |
317 const LayoutPoint& layerOffset, | 338 const LayoutPoint& layerOffset, |
318 const LayoutRect& containerRect) const override; | 339 const LayoutRect& containerRect) const override; |
319 | 340 |
320 private: | 341 private: |
321 bool isOfType(LayoutObjectType type) const override { | 342 bool isOfType(LayoutObjectType type) const override { |
322 return type == LayoutObjectTableCell || LayoutBlockFlow::isOfType(type); | 343 return type == LayoutObjectTableCell || LayoutBlockFlow::isOfType(type); |
323 } | 344 } |
324 | 345 |
325 void willBeRemovedFromTree() override; | 346 void willBeRemovedFromTree() override; |
326 | 347 |
327 void updateLogicalWidth() override; | 348 void updateLogicalWidth() override; |
328 | 349 |
329 void paintBoxDecorationBackground(const PaintInfo&, | 350 void paintBoxDecorationBackground(const PaintInfo&, |
330 const LayoutPoint&) const override; | 351 const LayoutPoint&) const override; |
331 void paintMask(const PaintInfo&, const LayoutPoint&) const override; | 352 void paintMask(const PaintInfo&, const LayoutPoint&) const override; |
332 | 353 |
333 LayoutSize offsetFromContainer(const LayoutObject*) const override; | 354 LayoutSize offsetFromContainer(const LayoutObject*) const override; |
| 355 LayoutRect localVisualRect() const override; |
334 | 356 |
335 int borderHalfLeft(bool outer) const; | 357 int borderHalfLeft(bool outer) const; |
336 int borderHalfRight(bool outer) const; | 358 int borderHalfRight(bool outer) const; |
337 int borderHalfTop(bool outer) const; | 359 int borderHalfTop(bool outer) const; |
338 int borderHalfBottom(bool outer) const; | 360 int borderHalfBottom(bool outer) const; |
339 | 361 |
340 int borderHalfStart(bool outer) const; | 362 int borderHalfStart(bool outer) const; |
341 int borderHalfEnd(bool outer) const; | 363 int borderHalfEnd(bool outer) const; |
342 int borderHalfBefore(bool outer) const; | 364 int borderHalfBefore(bool outer) const; |
343 int borderHalfAfter(bool outer) const; | 365 int borderHalfAfter(bool outer) const; |
(...skipping 17 matching lines...) Expand all Loading... |
361 // column, column group). | 383 // column, column group). |
362 // TODO(jchaffraix): It should be easier to compute all the borders in | 384 // TODO(jchaffraix): It should be easier to compute all the borders in |
363 // physical coordinates. However this is not the design of the current code. | 385 // physical coordinates. However this is not the design of the current code. |
364 // | 386 // |
365 // Blink's support for mixed directionality is currently partial. We only | 387 // Blink's support for mixed directionality is currently partial. We only |
366 // support the directionality up to |styleForCellFlow|. See comment on the | 388 // support the directionality up to |styleForCellFlow|. See comment on the |
367 // function above for more details. | 389 // function above for more details. |
368 // See also https://code.google.com/p/chromium/issues/detail?id=128227 for | 390 // See also https://code.google.com/p/chromium/issues/detail?id=128227 for |
369 // some history. | 391 // some history. |
370 // | 392 // |
371 // Those functions are called before paint invalidation if the collapsed | 393 // Those functions are called when the cache (m_collapsedBorders) is |
372 // borders cache is invalidated on LayoutTable. | 394 // invalidated on LayoutTable. |
373 CollapsedBorderValue computeCollapsedStartBorder( | 395 CollapsedBorderValue computeCollapsedStartBorder( |
374 IncludeBorderColorOrNot = IncludeBorderColor) const; | 396 IncludeBorderColorOrNot = IncludeBorderColor) const; |
375 CollapsedBorderValue computeCollapsedEndBorder( | 397 CollapsedBorderValue computeCollapsedEndBorder( |
376 IncludeBorderColorOrNot = IncludeBorderColor) const; | 398 IncludeBorderColorOrNot = IncludeBorderColor) const; |
377 CollapsedBorderValue computeCollapsedBeforeBorder( | 399 CollapsedBorderValue computeCollapsedBeforeBorder( |
378 IncludeBorderColorOrNot = IncludeBorderColor) const; | 400 IncludeBorderColorOrNot = IncludeBorderColor) const; |
379 CollapsedBorderValue computeCollapsedAfterBorder( | 401 CollapsedBorderValue computeCollapsedAfterBorder( |
380 IncludeBorderColorOrNot = IncludeBorderColor) const; | 402 IncludeBorderColorOrNot = IncludeBorderColor) const; |
381 | 403 |
382 Length logicalWidthFromColumns(LayoutTableCol* firstColForThisCell, | 404 Length logicalWidthFromColumns(LayoutTableCol* firstColForThisCell, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 return toLayoutTableCell(firstChild()); | 444 return toLayoutTableCell(firstChild()); |
423 } | 445 } |
424 | 446 |
425 inline LayoutTableCell* LayoutTableRow::lastCell() const { | 447 inline LayoutTableCell* LayoutTableRow::lastCell() const { |
426 return toLayoutTableCell(lastChild()); | 448 return toLayoutTableCell(lastChild()); |
427 } | 449 } |
428 | 450 |
429 } // namespace blink | 451 } // namespace blink |
430 | 452 |
431 #endif // LayoutTableCell_h | 453 #endif // LayoutTableCell_h |
OLD | NEW |