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, 2008, 2009 Apple Inc. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 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 30 matching lines...) Expand all Loading... |
41 #include "wtf/PtrUtil.h" | 41 #include "wtf/PtrUtil.h" |
42 | 42 |
43 namespace blink { | 43 namespace blink { |
44 | 44 |
45 using namespace HTMLNames; | 45 using namespace HTMLNames; |
46 | 46 |
47 struct SameSizeAsLayoutTableCell : public LayoutBlockFlow { | 47 struct SameSizeAsLayoutTableCell : public LayoutBlockFlow { |
48 unsigned bitfields; | 48 unsigned bitfields; |
49 int paddings[2]; | 49 int paddings[2]; |
50 void* pointer1; | 50 void* pointer1; |
51 void* pointer2; | |
52 }; | 51 }; |
53 | 52 |
54 static_assert(sizeof(LayoutTableCell) == sizeof(SameSizeAsLayoutTableCell), | 53 static_assert(sizeof(LayoutTableCell) == sizeof(SameSizeAsLayoutTableCell), |
55 "LayoutTableCell should stay small"); | 54 "LayoutTableCell should stay small"); |
56 static_assert(sizeof(CollapsedBorderValue) == 8, | 55 static_assert(sizeof(CollapsedBorderValue) == 8, |
57 "CollapsedBorderValue should stay small"); | 56 "CollapsedBorderValue should stay small"); |
58 | 57 |
59 LayoutTableCell::LayoutTableCell(Element* element) | 58 LayoutTableCell::LayoutTableCell(Element* element) |
60 : LayoutBlockFlow(element), | 59 : LayoutBlockFlow(element), |
61 m_absoluteColumnIndex(unsetColumnIndex), | 60 m_absoluteColumnIndex(unsetColumnIndex), |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 // The baseline of a cell is the baseline of the first in-flow line box in the | 459 // The baseline of a cell is the baseline of the first in-flow line box in the |
461 // cell, or the first in-flow table-row in the cell, whichever comes first. If | 460 // cell, or the first in-flow table-row in the cell, whichever comes first. If |
462 // there is no such line box or table-row, the baseline is the bottom of | 461 // there is no such line box or table-row, the baseline is the bottom of |
463 // content edge of the cell box. | 462 // content edge of the cell box. |
464 int firstLineBaseline = firstLineBoxBaseline(); | 463 int firstLineBaseline = firstLineBoxBaseline(); |
465 if (firstLineBaseline != -1) | 464 if (firstLineBaseline != -1) |
466 return firstLineBaseline; | 465 return firstLineBaseline; |
467 return (borderBefore() + paddingBefore() + contentLogicalHeight()).toInt(); | 466 return (borderBefore() + paddingBefore() + contentLogicalHeight()).toInt(); |
468 } | 467 } |
469 | 468 |
470 void LayoutTableCell::ensureIsReadyForPaintInvalidation() { | |
471 LayoutBlockFlow::ensureIsReadyForPaintInvalidation(); | |
472 if (!usesCompositedCellDisplayItemClients()) | |
473 return; | |
474 if (!m_rowBackgroundDisplayItemClient) { | |
475 m_rowBackgroundDisplayItemClient = WTF::wrapUnique( | |
476 new LayoutTableCell::RowBackgroundDisplayItemClient(*this)); | |
477 } | |
478 } | |
479 | |
480 void LayoutTableCell::styleDidChange(StyleDifference diff, | 469 void LayoutTableCell::styleDidChange(StyleDifference diff, |
481 const ComputedStyle* oldStyle) { | 470 const ComputedStyle* oldStyle) { |
482 DCHECK_EQ(style()->display(), EDisplay::kTableCell); | 471 DCHECK_EQ(style()->display(), EDisplay::kTableCell); |
483 | 472 |
484 LayoutBlockFlow::styleDidChange(diff, oldStyle); | 473 LayoutBlockFlow::styleDidChange(diff, oldStyle); |
485 setHasBoxDecorationBackground(true); | 474 setHasBoxDecorationBackground(true); |
486 | 475 |
487 if (parent() && section() && oldStyle && | 476 if (parent() && section() && oldStyle && |
488 style()->height() != oldStyle->height()) | 477 style()->height() != oldStyle->height()) |
489 section()->rowLogicalHeightChanged(row()); | 478 section()->rowLogicalHeightChanged(row()); |
(...skipping 25 matching lines...) Expand all Loading... |
515 } | 504 } |
516 if (nextCell()) { | 505 if (nextCell()) { |
517 // TODO(dgrogan) Add a layout test showing that setChildNeedsLayout is | 506 // TODO(dgrogan) Add a layout test showing that setChildNeedsLayout is |
518 // needed instead of setNeedsLayout. | 507 // needed instead of setNeedsLayout. |
519 nextCell()->setChildNeedsLayout(); | 508 nextCell()->setChildNeedsLayout(); |
520 nextCell()->setPreferredLogicalWidthsDirty(MarkOnlyThis); | 509 nextCell()->setPreferredLogicalWidthsDirty(MarkOnlyThis); |
521 } | 510 } |
522 } | 511 } |
523 } | 512 } |
524 | 513 |
525 LayoutTableCell::RowBackgroundDisplayItemClient::RowBackgroundDisplayItemClient( | |
526 const LayoutTableCell& layoutTableCell) | |
527 : m_layoutTableCell(layoutTableCell) {} | |
528 | |
529 String LayoutTableCell::RowBackgroundDisplayItemClient::debugName() const { | |
530 return "RowBackground"; | |
531 } | |
532 | |
533 LayoutRect LayoutTableCell::RowBackgroundDisplayItemClient::visualRect() const { | |
534 return m_layoutTableCell.row()->visualRect(); | |
535 } | |
536 | |
537 // The following rules apply for resolving conflicts and figuring out which | 514 // The following rules apply for resolving conflicts and figuring out which |
538 // border to use. | 515 // border to use. |
539 // (1) Borders with the 'border-style' of 'hidden' take precedence over all | 516 // (1) Borders with the 'border-style' of 'hidden' take precedence over all |
540 // other conflicting borders. Any border with this value suppresses all | 517 // other conflicting borders. Any border with this value suppresses all |
541 // borders at this location. | 518 // borders at this location. |
542 // (2) Borders with a style of 'none' have the lowest priority. Only if the | 519 // (2) Borders with a style of 'none' have the lowest priority. Only if the |
543 // border properties of all the elements meeting at this edge are 'none' | 520 // border properties of all the elements meeting at this edge are 'none' |
544 // will the border be omitted (but note that 'none' is the default value for | 521 // will the border be omitted (but note that 'none' is the default value for |
545 // the border style.) | 522 // the border style.) |
546 // (3) If none of the styles are 'hidden' and at least one of them is not | 523 // (3) If none of the styles are 'hidden' and at least one of them is not |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 void LayoutTableCell::invalidateDisplayItemClients( | 1441 void LayoutTableCell::invalidateDisplayItemClients( |
1465 PaintInvalidationReason reason) const { | 1442 PaintInvalidationReason reason) const { |
1466 LayoutBlockFlow::invalidateDisplayItemClients(reason); | 1443 LayoutBlockFlow::invalidateDisplayItemClients(reason); |
1467 | 1444 |
1468 if (!usesCompositedCellDisplayItemClients()) | 1445 if (!usesCompositedCellDisplayItemClients()) |
1469 return; | 1446 return; |
1470 | 1447 |
1471 ObjectPaintInvalidator invalidator(*this); | 1448 ObjectPaintInvalidator invalidator(*this); |
1472 if (m_collapsedBorderValues) | 1449 if (m_collapsedBorderValues) |
1473 invalidator.invalidateDisplayItemClient(*m_collapsedBorderValues, reason); | 1450 invalidator.invalidateDisplayItemClient(*m_collapsedBorderValues, reason); |
1474 if (m_rowBackgroundDisplayItemClient) { | |
1475 invalidator.invalidateDisplayItemClient(*m_rowBackgroundDisplayItemClient, | |
1476 reason); | |
1477 } | |
1478 } | 1451 } |
1479 | 1452 |
1480 // TODO(lunalu): Deliberately dump the "inner" box of table cells, since that | 1453 // TODO(lunalu): Deliberately dump the "inner" box of table cells, since that |
1481 // is what current results reflect. We'd like to clean up the results to dump | 1454 // is what current results reflect. We'd like to clean up the results to dump |
1482 // both the outer box and the intrinsic padding so that both bits of information | 1455 // both the outer box and the intrinsic padding so that both bits of information |
1483 // are captured by the results. | 1456 // are captured by the results. |
1484 LayoutRect LayoutTableCell::debugRect() const { | 1457 LayoutRect LayoutTableCell::debugRect() const { |
1485 LayoutRect rect = LayoutRect( | 1458 LayoutRect rect = LayoutRect( |
1486 location().x(), location().y() + intrinsicPaddingBefore(), size().width(), | 1459 location().x(), location().y() + intrinsicPaddingBefore(), size().width(), |
1487 size().height() - intrinsicPaddingBefore() - intrinsicPaddingAfter()); | 1460 size().height() - intrinsicPaddingBefore() - intrinsicPaddingAfter()); |
(...skipping 10 matching lines...) Expand all Loading... |
1498 } | 1471 } |
1499 | 1472 |
1500 bool LayoutTableCell::hasLineIfEmpty() const { | 1473 bool LayoutTableCell::hasLineIfEmpty() const { |
1501 if (node() && hasEditableStyle(*node())) | 1474 if (node() && hasEditableStyle(*node())) |
1502 return true; | 1475 return true; |
1503 | 1476 |
1504 return LayoutBlock::hasLineIfEmpty(); | 1477 return LayoutBlock::hasLineIfEmpty(); |
1505 } | 1478 } |
1506 | 1479 |
1507 } // namespace blink | 1480 } // namespace blink |
OLD | NEW |