OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the render object implementation for KHTML. | 2 * This file is part of the render object implementation for KHTML. |
3 * | 3 * |
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
5 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 5 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
6 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. | 6 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 RenderBox::destroy(); | 88 RenderBox::destroy(); |
89 } | 89 } |
90 | 90 |
91 RenderInline* RenderInline::inlineContinuation() const | 91 RenderInline* RenderInline::inlineContinuation() const |
92 { | 92 { |
93 if (!m_continuation || m_continuation->isInline()) | 93 if (!m_continuation || m_continuation->isInline()) |
94 return toRenderInline(m_continuation); | 94 return toRenderInline(m_continuation); |
95 return toRenderBlock(m_continuation)->inlineContinuation(); | 95 return toRenderBlock(m_continuation)->inlineContinuation(); |
96 } | 96 } |
97 | 97 |
| 98 void RenderInline::updateBoxModelInfoFromStyle() |
| 99 { |
| 100 RenderBoxModelObject::updateBoxModelInfoFromStyle(); |
| 101 |
| 102 setInline(true); // Needed for run-ins, since run-in is considered a block d
isplay type. |
| 103 |
| 104 // FIXME: Support transforms and reflections on inline flows someday. |
| 105 setHasTransform(false); |
| 106 setHasReflection(false); |
| 107 } |
| 108 |
98 void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
yle) | 109 void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
yle) |
99 { | 110 { |
100 RenderBox::styleDidChange(diff, oldStyle); | 111 RenderBox::styleDidChange(diff, oldStyle); |
101 | 112 |
102 setInline(true); | |
103 setHasReflection(false); | |
104 | |
105 // Ensure that all of the split inlines pick up the new style. We | 113 // Ensure that all of the split inlines pick up the new style. We |
106 // only do this if we're an inline, since we don't want to propagate | 114 // only do this if we're an inline, since we don't want to propagate |
107 // a block's style to the other inlines. | 115 // a block's style to the other inlines. |
108 // e.g., <font>foo <h4>goo</h4> moo</font>. The <font> inlines before | 116 // e.g., <font>foo <h4>goo</h4> moo</font>. The <font> inlines before |
109 // and after the block share the same style, but the block doesn't | 117 // and after the block share the same style, but the block doesn't |
110 // need to pass its style on to anyone else. | 118 // need to pass its style on to anyone else. |
111 for (RenderInline* currCont = inlineContinuation(); currCont; currCont = cur
rCont->inlineContinuation()) { | 119 for (RenderInline* currCont = inlineContinuation(); currCont; currCont = cur
rCont->inlineContinuation()) { |
112 RenderBox* nextCont = currCont->continuation(); | 120 RenderBox* nextCont = currCont->continuation(); |
113 currCont->setContinuation(0); | 121 currCont->setContinuation(0); |
114 currCont->setStyle(style()); | 122 currCont->setStyle(style()); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 } | 520 } |
513 result.setWidth(rightSide - leftSide); | 521 result.setWidth(rightSide - leftSide); |
514 result.setX(leftSide); | 522 result.setX(leftSide); |
515 result.setHeight(lastLineBox()->yPos() + lastLineBox()->height() - first
LineBox()->yPos()); | 523 result.setHeight(lastLineBox()->yPos() + lastLineBox()->height() - first
LineBox()->yPos()); |
516 result.setY(firstLineBox()->yPos()); | 524 result.setY(firstLineBox()->yPos()); |
517 } | 525 } |
518 | 526 |
519 return result; | 527 return result; |
520 } | 528 } |
521 | 529 |
522 IntRect RenderInline::clippedOverflowRectForRepaint(RenderBox* repaintContainer) | 530 IntRect RenderInline::clippedOverflowRectForRepaint(RenderBoxModelObject* repain
tContainer) |
523 { | 531 { |
524 // Only run-ins are allowed in here during layout. | 532 // Only run-ins are allowed in here during layout. |
525 ASSERT(!view() || !view()->layoutStateEnabled() || isRunIn()); | 533 ASSERT(!view() || !view()->layoutStateEnabled() || isRunIn()); |
526 | 534 |
527 if (!firstLineBox() && !continuation()) | 535 if (!firstLineBox() && !continuation()) |
528 return IntRect(); | 536 return IntRect(); |
529 | 537 |
530 // Find our leftmost position. | 538 // Find our leftmost position. |
531 IntRect boundingBox(linesBoundingBox()); | 539 IntRect boundingBox(linesBoundingBox()); |
532 int left = boundingBox.x(); | 540 int left = boundingBox.x(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 583 |
576 if (continuation() && !continuation()->isInline()) { | 584 if (continuation() && !continuation()->isInline()) { |
577 IntRect contRect = continuation()->rectWithOutlineForRepaint(repaint
Container, ow); | 585 IntRect contRect = continuation()->rectWithOutlineForRepaint(repaint
Container, ow); |
578 r.unite(contRect); | 586 r.unite(contRect); |
579 } | 587 } |
580 } | 588 } |
581 | 589 |
582 return r; | 590 return r; |
583 } | 591 } |
584 | 592 |
585 IntRect RenderInline::rectWithOutlineForRepaint(RenderBox* repaintContainer, int
outlineWidth) | 593 IntRect RenderInline::rectWithOutlineForRepaint(RenderBoxModelObject* repaintCon
tainer, int outlineWidth) |
586 { | 594 { |
587 IntRect r(RenderBox::rectWithOutlineForRepaint(repaintContainer, outlineWidt
h)); | 595 IntRect r(RenderBox::rectWithOutlineForRepaint(repaintContainer, outlineWidt
h)); |
588 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { | 596 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { |
589 if (!curr->isText()) | 597 if (!curr->isText()) |
590 r.unite(curr->rectWithOutlineForRepaint(repaintContainer, outlineWid
th)); | 598 r.unite(curr->rectWithOutlineForRepaint(repaintContainer, outlineWid
th)); |
591 } | 599 } |
592 return r; | 600 return r; |
593 } | 601 } |
594 | 602 |
595 void RenderInline::updateDragState(bool dragOn) | 603 void RenderInline::updateDragState(bool dragOn) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 if (s != style()) | 668 if (s != style()) |
661 return s->computedLineHeight(); | 669 return s->computedLineHeight(); |
662 } | 670 } |
663 | 671 |
664 if (m_lineHeight == -1) | 672 if (m_lineHeight == -1) |
665 m_lineHeight = style()->computedLineHeight(); | 673 m_lineHeight = style()->computedLineHeight(); |
666 | 674 |
667 return m_lineHeight; | 675 return m_lineHeight; |
668 } | 676 } |
669 | 677 |
670 IntSize RenderInline::relativePositionedInlineOffset(const RenderObject* child)
const | 678 IntSize RenderInline::relativePositionedInlineOffset(const RenderBox* child) con
st |
671 { | 679 { |
672 ASSERT(isRelPositioned()); | 680 ASSERT(isRelPositioned()); |
673 if (!isRelPositioned()) | 681 if (!isRelPositioned()) |
674 return IntSize(); | 682 return IntSize(); |
675 | 683 |
676 // When we have an enclosing relpositioned inline, we need to add in the off
set of the first line | 684 // When we have an enclosing relpositioned inline, we need to add in the off
set of the first line |
677 // box from the rest of the content, but only in the cases where we know we'
re positioned | 685 // box from the rest of the content, but only in the cases where we know we'
re positioned |
678 // relative to the inline itself. | 686 // relative to the inline itself. |
679 | 687 |
680 IntSize offset; | 688 IntSize offset; |
681 int sx; | 689 int sx; |
682 int sy; | 690 int sy; |
683 if (firstLineBox()) { | 691 if (firstLineBox()) { |
684 sx = firstLineBox()->xPos(); | 692 sx = firstLineBox()->xPos(); |
685 sy = firstLineBox()->yPos(); | 693 sy = firstLineBox()->yPos(); |
686 } else { | 694 } else { |
687 sx = staticX(); | 695 sx = layer()->staticX(); |
688 sy = staticY(); | 696 sy = layer()->staticY(); |
689 } | 697 } |
690 | 698 |
691 if (!child->hasStaticX()) | 699 if (!child->style()->hasStaticX()) |
692 offset.setWidth(sx); | 700 offset.setWidth(sx); |
693 // This is not terribly intuitive, but we have to match other browsers. Des
pite being a block display type inside | 701 // This is not terribly intuitive, but we have to match other browsers. Des
pite being a block display type inside |
694 // an inline, we still keep our x locked to the left of the relative positio
ned inline. Arguably the correct | 702 // an inline, we still keep our x locked to the left of the relative positio
ned inline. Arguably the correct |
695 // behavior would be to go flush left to the block that contains the inline,
but that isn't what other browsers | 703 // behavior would be to go flush left to the block that contains the inline,
but that isn't what other browsers |
696 // do. | 704 // do. |
697 else if (!child->style()->isOriginalDisplayInlineType()) | 705 else if (!child->style()->isOriginalDisplayInlineType()) |
698 // Avoid adding in the left border/padding of the containing block twice
. Subtract it out. | 706 // Avoid adding in the left border/padding of the containing block twice
. Subtract it out. |
699 offset.setWidth(sx - (child->containingBlock()->borderLeft() + child->co
ntainingBlock()->paddingLeft())); | 707 offset.setWidth(sx - (child->containingBlock()->borderLeft() + child->co
ntainingBlock()->paddingLeft())); |
700 | 708 |
701 if (!child->hasStaticY()) | 709 if (!child->style()->hasStaticY()) |
702 offset.setHeight(sy); | 710 offset.setHeight(sy); |
703 | 711 |
704 return offset; | 712 return offset; |
705 } | 713 } |
706 | 714 |
707 void RenderInline::addFocusRingRects(GraphicsContext* graphicsContext, int tx, i
nt ty) | 715 void RenderInline::addFocusRingRects(GraphicsContext* graphicsContext, int tx, i
nt ty) |
708 { | 716 { |
709 for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) | 717 for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) |
710 graphicsContext->addFocusRingRect(IntRect(tx + curr->xPos(), ty + curr->
yPos(), curr->width(), curr->height())); | 718 graphicsContext->addFocusRingRect(IntRect(tx + curr->xPos(), ty + curr->
yPos(), curr->width(), curr->height())); |
711 | 719 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 region.clip.scale(pageScaleFactor); | 897 region.clip.scale(pageScaleFactor); |
890 } | 898 } |
891 } | 899 } |
892 | 900 |
893 regions.append(region); | 901 regions.append(region); |
894 } | 902 } |
895 } | 903 } |
896 #endif | 904 #endif |
897 | 905 |
898 } // namespace WebCore | 906 } // namespace WebCore |
OLD | NEW |