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 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 Loading... |
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 | 298 |
302 const CollapsedBorderValue& startBorder() const { return m_startBorder; } | 299 bool allBordersAreInvisible() const { |
303 const CollapsedBorderValue& endBorder() const { return m_endBorder; } | 300 return !startBorder.isVisible() && !endBorder.isVisible() && |
304 const CollapsedBorderValue& beforeBorder() const { return m_beforeBorder; } | 301 !beforeBorder.isVisible() && !afterBorder.isVisible(); |
305 const CollapsedBorderValue& afterBorder() const { return m_afterBorder; } | 302 } |
306 | 303 bool bordersVisuallyEqual(const CollapsedBorderValues& other) const { |
307 void setCollapsedBorderValues(const CollapsedBorderValues& other); | 304 return startBorder.visuallyEquals(other.startBorder) && |
308 | 305 endBorder.visuallyEquals(other.endBorder) && |
309 // DisplayItemClient methods. | 306 beforeBorder.visuallyEquals(other.beforeBorder) && |
310 String debugName() const; | 307 afterBorder.visuallyEquals(other.afterBorder); |
311 LayoutRect visualRect() const; | 308 } |
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 }; | 309 }; |
320 | 310 |
321 class RowBackgroundDisplayItemClient : public DisplayItemClient { | 311 class RowBackgroundDisplayItemClient : public DisplayItemClient { |
322 public: | 312 public: |
323 RowBackgroundDisplayItemClient(const LayoutTableCell&); | 313 RowBackgroundDisplayItemClient(const LayoutTableCell&); |
324 | 314 |
325 // DisplayItemClient methods. | 315 // DisplayItemClient methods. |
326 String debugName() const; | 316 String debugName() const; |
327 LayoutRect visualRect() const; | 317 LayoutRect visualRect() const; |
328 | 318 |
329 private: | 319 private: |
330 const LayoutTableCell& m_layoutTableCell; | 320 const LayoutTableCell& m_layoutTableCell; |
331 }; | 321 }; |
332 | 322 |
333 bool usesCompositedCellDisplayItemClients() const; | 323 bool usesCompositedCellDisplayItemClients() const; |
| 324 |
334 const CollapsedBorderValues* collapsedBorderValues() const { | 325 const CollapsedBorderValues* collapsedBorderValues() const { |
335 return m_collapsedBorderValues.get(); | 326 return m_collapsedBorderValues.get(); |
336 } | 327 } |
337 const DisplayItemClient& backgroundDisplayItemClient() const { | 328 const DisplayItemClient& backgroundDisplayItemClient() const { |
338 return m_rowBackgroundDisplayItemClient | 329 return m_rowBackgroundDisplayItemClient |
339 ? static_cast<const DisplayItemClient&>( | 330 ? static_cast<const DisplayItemClient&>( |
340 *m_rowBackgroundDisplayItemClient) | 331 *m_rowBackgroundDisplayItemClient) |
341 : *this; | 332 : *this; |
342 } | 333 } |
343 | 334 |
344 LayoutRect debugRect() const override; | 335 LayoutRect debugRect() const override; |
345 | 336 |
346 void adjustChildDebugRect(LayoutRect&) const override; | 337 void adjustChildDebugRect(LayoutRect&) const override; |
347 | 338 |
348 // A table cell's location is relative to its containing section. | 339 // A table cell's location is relative to its containing section. |
349 LayoutBox* locationContainer() const override { return section(); } | 340 LayoutBox* locationContainer() const override { return section(); } |
350 | 341 |
351 void ensureIsReadyForPaintInvalidation() override; | 342 void ensureIsReadyForPaintInvalidation() override; |
352 | 343 |
| 344 LayoutRect localVisualRect() const override; |
| 345 |
353 protected: | 346 protected: |
354 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; | 347 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; |
355 void computePreferredLogicalWidths() override; | 348 void computePreferredLogicalWidths() override; |
356 | 349 |
357 void addLayerHitTestRects(LayerHitTestRects&, | 350 void addLayerHitTestRects(LayerHitTestRects&, |
358 const PaintLayer* currentCompositedLayer, | 351 const PaintLayer* currentCompositedLayer, |
359 const LayoutPoint& layerOffset, | 352 const LayoutPoint& layerOffset, |
360 const LayoutRect& containerRect) const override; | 353 const LayoutRect& containerRect) const override; |
361 | 354 |
362 private: | 355 private: |
363 bool isOfType(LayoutObjectType type) const override { | 356 bool isOfType(LayoutObjectType type) const override { |
364 return type == LayoutObjectTableCell || LayoutBlockFlow::isOfType(type); | 357 return type == LayoutObjectTableCell || LayoutBlockFlow::isOfType(type); |
365 } | 358 } |
366 | 359 |
367 void willBeRemovedFromTree() override; | 360 void willBeRemovedFromTree() override; |
368 | 361 |
369 void updateLogicalWidth() override; | 362 void updateLogicalWidth() override; |
370 | 363 |
371 void paintBoxDecorationBackground(const PaintInfo&, | 364 void paintBoxDecorationBackground(const PaintInfo&, |
372 const LayoutPoint&) const override; | 365 const LayoutPoint&) const override; |
373 void paintMask(const PaintInfo&, const LayoutPoint&) const override; | 366 void paintMask(const PaintInfo&, const LayoutPoint&) const override; |
374 | 367 |
375 LayoutSize offsetFromContainer(const LayoutObject*) const override; | 368 LayoutSize offsetFromContainer(const LayoutObject*) const override; |
376 LayoutRect localVisualRect() const override; | |
377 | 369 |
378 int borderHalfLeft(bool outer) const; | 370 int borderHalfLeft(bool outer) const; |
379 int borderHalfRight(bool outer) const; | 371 int borderHalfRight(bool outer) const; |
380 int borderHalfTop(bool outer) const; | 372 int borderHalfTop(bool outer) const; |
381 int borderHalfBottom(bool outer) const; | 373 int borderHalfBottom(bool outer) const; |
382 | 374 |
383 int borderHalfStart(bool outer) const; | 375 int borderHalfStart(bool outer) const; |
384 int borderHalfEnd(bool outer) const; | 376 int borderHalfEnd(bool outer) const; |
385 int borderHalfBefore(bool outer) const; | 377 int borderHalfBefore(bool outer) const; |
386 int borderHalfAfter(bool outer) const; | 378 int borderHalfAfter(bool outer) const; |
(...skipping 17 matching lines...) Expand all Loading... |
404 // column, column group). | 396 // column, column group). |
405 // TODO(jchaffraix): It should be easier to compute all the borders in | 397 // 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. | 398 // physical coordinates. However this is not the design of the current code. |
407 // | 399 // |
408 // Blink's support for mixed directionality is currently partial. We only | 400 // Blink's support for mixed directionality is currently partial. We only |
409 // support the directionality up to |styleForCellFlow|. See comment on the | 401 // support the directionality up to |styleForCellFlow|. See comment on the |
410 // function above for more details. | 402 // function above for more details. |
411 // See also https://code.google.com/p/chromium/issues/detail?id=128227 for | 403 // See also https://code.google.com/p/chromium/issues/detail?id=128227 for |
412 // some history. | 404 // some history. |
413 // | 405 // |
414 // Those functions are called when the cache (m_collapsedBorders) is | 406 // Those functions are called before paint invalidation if the collapsed |
415 // invalidated on LayoutTable. | 407 // borders cache is invalidated on LayoutTable. |
416 CollapsedBorderValue computeCollapsedStartBorder( | 408 CollapsedBorderValue computeCollapsedStartBorder( |
417 IncludeBorderColorOrNot = IncludeBorderColor) const; | 409 IncludeBorderColorOrNot = IncludeBorderColor) const; |
418 CollapsedBorderValue computeCollapsedEndBorder( | 410 CollapsedBorderValue computeCollapsedEndBorder( |
419 IncludeBorderColorOrNot = IncludeBorderColor) const; | 411 IncludeBorderColorOrNot = IncludeBorderColor) const; |
420 CollapsedBorderValue computeCollapsedBeforeBorder( | 412 CollapsedBorderValue computeCollapsedBeforeBorder( |
421 IncludeBorderColorOrNot = IncludeBorderColor) const; | 413 IncludeBorderColorOrNot = IncludeBorderColor) const; |
422 CollapsedBorderValue computeCollapsedAfterBorder( | 414 CollapsedBorderValue computeCollapsedAfterBorder( |
423 IncludeBorderColorOrNot = IncludeBorderColor) const; | 415 IncludeBorderColorOrNot = IncludeBorderColor) const; |
424 | 416 |
425 Length logicalWidthFromColumns(LayoutTableCol* firstColForThisCell, | 417 Length logicalWidthFromColumns(LayoutTableCol* firstColForThisCell, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 return toLayoutTableCell(firstChild()); | 459 return toLayoutTableCell(firstChild()); |
468 } | 460 } |
469 | 461 |
470 inline LayoutTableCell* LayoutTableRow::lastCell() const { | 462 inline LayoutTableCell* LayoutTableRow::lastCell() const { |
471 return toLayoutTableCell(lastChild()); | 463 return toLayoutTableCell(lastChild()); |
472 } | 464 } |
473 | 465 |
474 } // namespace blink | 466 } // namespace blink |
475 | 467 |
476 #endif // LayoutTableCell_h | 468 #endif // LayoutTableCell_h |
OLD | NEW |