OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. |
5 * All rights reserved. | 5 * All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 if (beforeChild) { | 564 if (beforeChild) { |
565 beforeChildParent = toLayoutBoxModelObject(beforeChild->parent()); | 565 beforeChildParent = toLayoutBoxModelObject(beforeChild->parent()); |
566 } else { | 566 } else { |
567 LayoutBoxModelObject* cont = nextContinuation(flow); | 567 LayoutBoxModelObject* cont = nextContinuation(flow); |
568 if (cont) | 568 if (cont) |
569 beforeChildParent = cont; | 569 beforeChildParent = cont; |
570 else | 570 else |
571 beforeChildParent = flow; | 571 beforeChildParent = flow; |
572 } | 572 } |
573 | 573 |
574 // TODO(rhogan): Should we treat out-of-flows and floats as through they're | 574 // If the two candidates are the same, no further checking is necessary. |
575 // inline below? | |
576 if (newChild->isFloatingOrOutOfFlowPositioned()) | |
577 return beforeChildParent->addChildIgnoringContinuation(newChild, | |
578 beforeChild); | |
579 | |
580 // A table part will be wrapped by an inline anonymous table when it is added | |
581 // to the layout tree, so treat it as inline when deciding where to add it. | |
582 bool childInline = newChild->isInline() || newChild->isTablePart(); | |
583 bool bcpInline = beforeChildParent->isInline(); | |
584 bool flowInline = flow->isInline(); | |
585 | |
586 if (flow == beforeChildParent) | 575 if (flow == beforeChildParent) |
587 return flow->addChildIgnoringContinuation(newChild, beforeChild); | 576 return flow->addChildIgnoringContinuation(newChild, beforeChild); |
588 | 577 |
| 578 // A table part will be wrapped by an inline anonymous table when it is added |
| 579 // to the layout tree, so treat it as inline when deciding where to add |
| 580 // it. Floating and out-of-flow-positioned objects can also live under |
| 581 // inlines, and since this about adding a child to an inline parent, we |
| 582 // should not put them into a block continuation. |
| 583 bool addInsideInline = newChild->isInline() || newChild->isTablePart() || |
| 584 newChild->isFloatingOrOutOfFlowPositioned(); |
| 585 |
589 // The goal here is to match up if we can, so that we can coalesce and create | 586 // The goal here is to match up if we can, so that we can coalesce and create |
590 // the minimal # of continuations needed for the inline. | 587 // the minimal # of continuations needed for the inline. |
591 if (childInline == bcpInline || (beforeChild && beforeChild->isInline())) | 588 if (addInsideInline == beforeChildParent->isInline() || |
| 589 (beforeChild && beforeChild->isInline())) { |
592 return beforeChildParent->addChildIgnoringContinuation(newChild, | 590 return beforeChildParent->addChildIgnoringContinuation(newChild, |
593 beforeChild); | 591 beforeChild); |
594 if (flowInline == childInline) { | 592 } |
| 593 if (addInsideInline == flow->isInline()) { |
595 // Just treat like an append. | 594 // Just treat like an append. |
596 return flow->addChildIgnoringContinuation(newChild, 0); | 595 return flow->addChildIgnoringContinuation(newChild); |
597 } | 596 } |
598 return beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild); | 597 return beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild); |
599 } | 598 } |
600 | 599 |
601 void LayoutInline::paint(const PaintInfo& paintInfo, | 600 void LayoutInline::paint(const PaintInfo& paintInfo, |
602 const LayoutPoint& paintOffset) const { | 601 const LayoutPoint& paintOffset) const { |
603 InlinePainter(*this).paint(paintInfo, paintOffset); | 602 InlinePainter(*this).paint(paintInfo, paintOffset); |
604 } | 603 } |
605 | 604 |
606 template <typename GeneratorContext> | 605 template <typename GeneratorContext> |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); | 1517 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); |
1519 } | 1518 } |
1520 | 1519 |
1521 // TODO(lunalu): Not to just dump 0, 0 as the x and y here | 1520 // TODO(lunalu): Not to just dump 0, 0 as the x and y here |
1522 LayoutRect LayoutInline::debugRect() const { | 1521 LayoutRect LayoutInline::debugRect() const { |
1523 IntRect linesBox = enclosingIntRect(linesBoundingBox()); | 1522 IntRect linesBox = enclosingIntRect(linesBoundingBox()); |
1524 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height())); | 1523 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height())); |
1525 } | 1524 } |
1526 | 1525 |
1527 } // namespace blink | 1526 } // namespace blink |
OLD | NEW |