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