| 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 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
| 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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 if (node && node->hasTagName(formTag) && static_cast<HTMLFormElement*>(n
ode)->isMalformed()) { | 766 if (node && node->hasTagName(formTag) && static_cast<HTMLFormElement*>(n
ode)->isMalformed()) { |
| 767 // See if this form is malformed (i.e., unclosed). If so, don't give
the form | 767 // See if this form is malformed (i.e., unclosed). If so, don't give
the form |
| 768 // a bottom margin. | 768 // a bottom margin. |
| 769 setMaxBottomMargins(0, 0); | 769 setMaxBottomMargins(0, 0); |
| 770 } | 770 } |
| 771 } | 771 } |
| 772 | 772 |
| 773 // For overflow:scroll blocks, ensure we have both scrollbars in place alway
s. | 773 // For overflow:scroll blocks, ensure we have both scrollbars in place alway
s. |
| 774 if (scrollsOverflow()) { | 774 if (scrollsOverflow()) { |
| 775 if (style()->overflowX() == OSCROLL) | 775 if (style()->overflowX() == OSCROLL) |
| 776 layer()->setHasHorizontalScrollbar(true); | 776 m_layer->setHasHorizontalScrollbar(true); |
| 777 if (style()->overflowY() == OSCROLL) | 777 if (style()->overflowY() == OSCROLL) |
| 778 layer()->setHasVerticalScrollbar(true); | 778 m_layer->setHasVerticalScrollbar(true); |
| 779 } | 779 } |
| 780 | 780 |
| 781 int repaintTop = 0; | 781 int repaintTop = 0; |
| 782 int repaintBottom = 0; | 782 int repaintBottom = 0; |
| 783 int maxFloatBottom = 0; | 783 int maxFloatBottom = 0; |
| 784 if (childrenInline()) | 784 if (childrenInline()) |
| 785 layoutInlineChildren(relayoutChildren, repaintTop, repaintBottom); | 785 layoutInlineChildren(relayoutChildren, repaintTop, repaintBottom); |
| 786 else | 786 else |
| 787 layoutBlockChildren(relayoutChildren, maxFloatBottom); | 787 layoutBlockChildren(relayoutChildren, maxFloatBottom); |
| 788 | 788 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 m_overflowTop = min(m_overflowTop, reflectionBox().y()); | 844 m_overflowTop = min(m_overflowTop, reflectionBox().y()); |
| 845 m_overflowHeight = max(m_overflowHeight, reflectionBox().bottom()); | 845 m_overflowHeight = max(m_overflowHeight, reflectionBox().bottom()); |
| 846 } | 846 } |
| 847 } | 847 } |
| 848 | 848 |
| 849 statePusher.pop(); | 849 statePusher.pop(); |
| 850 | 850 |
| 851 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if | 851 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if |
| 852 // we overflow or not. | 852 // we overflow or not. |
| 853 if (hasOverflowClip()) | 853 if (hasOverflowClip()) |
| 854 layer()->updateScrollInfoAfterLayout(); | 854 m_layer->updateScrollInfoAfterLayout(); |
| 855 | 855 |
| 856 // Repaint with our new bounds if they are different from our old bounds. | 856 // Repaint with our new bounds if they are different from our old bounds. |
| 857 bool didFullRepaint = repainter.repaintAfterLayout(); | 857 bool didFullRepaint = repainter.repaintAfterLayout(); |
| 858 if (!didFullRepaint && repaintTop != repaintBottom && (style()->visibility()
== VISIBLE || enclosingLayer()->hasVisibleContent())) { | 858 if (!didFullRepaint && repaintTop != repaintBottom && (style()->visibility()
== VISIBLE || enclosingLayer()->hasVisibleContent())) { |
| 859 IntRect repaintRect(m_overflowLeft, repaintTop, m_overflowWidth - m_over
flowLeft, repaintBottom - repaintTop); | 859 IntRect repaintRect(m_overflowLeft, repaintTop, m_overflowWidth - m_over
flowLeft, repaintBottom - repaintTop); |
| 860 | 860 |
| 861 // FIXME: Deal with multiple column repainting. We have to split the re
paint | 861 // FIXME: Deal with multiple column repainting. We have to split the re
paint |
| 862 // rect up into multiple rects if it spans columns. | 862 // rect up into multiple rects if it spans columns. |
| 863 | 863 |
| 864 repaintRect.inflate(maximalOutlineSize(PaintPhaseOutline)); | 864 repaintRect.inflate(maximalOutlineSize(PaintPhaseOutline)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 885 setNeedsLayout(false); | 885 setNeedsLayout(false); |
| 886 } | 886 } |
| 887 | 887 |
| 888 bool RenderBlock::expandsToEncloseOverhangingFloats() const | 888 bool RenderBlock::expandsToEncloseOverhangingFloats() const |
| 889 { | 889 { |
| 890 return isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverfl
owClip() || (parent() && parent()->isFlexibleBox()) || hasColumns() || isTableCe
ll() || isFieldset(); | 890 return isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverfl
owClip() || (parent() && parent()->isFlexibleBox()) || hasColumns() || isTableCe
ll() || isFieldset(); |
| 891 } | 891 } |
| 892 | 892 |
| 893 void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marg
inInfo) | 893 void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marg
inInfo) |
| 894 { | 894 { |
| 895 if (child->style()->hasStaticX()) { | 895 if (child->hasStaticX()) { |
| 896 if (style()->direction() == LTR) | 896 if (style()->direction() == LTR) |
| 897 child->layer()->setStaticX(borderLeft() + paddingLeft()); | 897 child->setStaticX(borderLeft() + paddingLeft()); |
| 898 else | 898 else |
| 899 child->layer()->setStaticX(borderRight() + paddingRight()); | 899 child->setStaticX(borderRight() + paddingRight()); |
| 900 } | 900 } |
| 901 | 901 |
| 902 if (child->style()->hasStaticY()) { | 902 if (child->hasStaticY()) { |
| 903 int y = height(); | 903 int y = height(); |
| 904 if (!marginInfo.canCollapseWithTop()) { | 904 if (!marginInfo.canCollapseWithTop()) { |
| 905 child->calcVerticalMargins(); | 905 child->calcVerticalMargins(); |
| 906 int marginTop = child->marginTop(); | 906 int marginTop = child->marginTop(); |
| 907 int collapsedTopPos = marginInfo.posMargin(); | 907 int collapsedTopPos = marginInfo.posMargin(); |
| 908 int collapsedTopNeg = marginInfo.negMargin(); | 908 int collapsedTopNeg = marginInfo.negMargin(); |
| 909 if (marginTop > 0) { | 909 if (marginTop > 0) { |
| 910 if (marginTop > collapsedTopPos) | 910 if (marginTop > collapsedTopPos) |
| 911 collapsedTopPos = marginTop; | 911 collapsedTopPos = marginTop; |
| 912 } else { | 912 } else { |
| 913 if (-marginTop > collapsedTopNeg) | 913 if (-marginTop > collapsedTopNeg) |
| 914 collapsedTopNeg = -marginTop; | 914 collapsedTopNeg = -marginTop; |
| 915 } | 915 } |
| 916 y += (collapsedTopPos - collapsedTopNeg) - marginTop; | 916 y += (collapsedTopPos - collapsedTopNeg) - marginTop; |
| 917 } | 917 } |
| 918 child->layer()->setStaticY(y); | 918 child->setStaticY(y); |
| 919 } | 919 } |
| 920 } | 920 } |
| 921 | 921 |
| 922 void RenderBlock::adjustFloatingBlock(const MarginInfo& marginInfo) | 922 void RenderBlock::adjustFloatingBlock(const MarginInfo& marginInfo) |
| 923 { | 923 { |
| 924 // The float should be positioned taking into account the bottom margin | 924 // The float should be positioned taking into account the bottom margin |
| 925 // of the previous flow. We add that margin into the height, get the | 925 // of the previous flow. We add that margin into the height, get the |
| 926 // float positioned properly, and then subtract the margin out of the | 926 // float positioned properly, and then subtract the margin out of the |
| 927 // height again. In the case of self-collapsing blocks, we always just | 927 // height again. In the case of self-collapsing blocks, we always just |
| 928 // use the top margins, since the self-collapsing block collapsed its | 928 // use the top margins, since the self-collapsing block collapsed its |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 if (needsLayout()) | 1478 if (needsLayout()) |
| 1479 return false; | 1479 return false; |
| 1480 } | 1480 } |
| 1481 | 1481 |
| 1482 // All we have to is lay out our positioned objects. | 1482 // All we have to is lay out our positioned objects. |
| 1483 layoutPositionedObjects(false); | 1483 layoutPositionedObjects(false); |
| 1484 | 1484 |
| 1485 statePusher.pop(); | 1485 statePusher.pop(); |
| 1486 | 1486 |
| 1487 if (hasOverflowClip()) | 1487 if (hasOverflowClip()) |
| 1488 layer()->updateScrollInfoAfterLayout(); | 1488 m_layer->updateScrollInfoAfterLayout(); |
| 1489 | 1489 |
| 1490 setNeedsLayout(false); | 1490 setNeedsLayout(false); |
| 1491 return true; | 1491 return true; |
| 1492 } | 1492 } |
| 1493 | 1493 |
| 1494 void RenderBlock::layoutPositionedObjects(bool relayoutChildren) | 1494 void RenderBlock::layoutPositionedObjects(bool relayoutChildren) |
| 1495 { | 1495 { |
| 1496 if (m_positionedObjects) { | 1496 if (m_positionedObjects) { |
| 1497 RenderBox* r; | 1497 RenderBox* r; |
| 1498 Iterator end = m_positionedObjects->end(); | 1498 Iterator end = m_positionedObjects->end(); |
| 1499 for (Iterator it = m_positionedObjects->begin(); it != end; ++it) { | 1499 for (Iterator it = m_positionedObjects->begin(); it != end; ++it) { |
| 1500 r = *it; | 1500 r = *it; |
| 1501 // When a non-positioned block element moves, it may have positioned
children that are implicitly positioned relative to the | 1501 // When a non-positioned block element moves, it may have positioned
children that are implicitly positioned relative to the |
| 1502 // non-positioned block. Rather than trying to detect all of these
movement cases, we just always lay out positioned | 1502 // non-positioned block. Rather than trying to detect all of these
movement cases, we just always lay out positioned |
| 1503 // objects that are positioned implicitly like this. Such objects a
re rare, and so in typical DHTML menu usage (where everything is | 1503 // objects that are positioned implicitly like this. Such objects a
re rare, and so in typical DHTML menu usage (where everything is |
| 1504 // positioned explicitly) this should not incur a performance penalt
y. | 1504 // positioned explicitly) this should not incur a performance penalt
y. |
| 1505 if (relayoutChildren || (r->style()->hasStaticY() && r->parent() !=
this && r->parent()->isBlockFlow())) | 1505 if (relayoutChildren || (r->hasStaticY() && r->parent() != this && r
->parent()->isBlockFlow())) |
| 1506 r->setChildNeedsLayout(true, false); | 1506 r->setChildNeedsLayout(true, false); |
| 1507 | 1507 |
| 1508 // If relayoutChildren is set and we have percentage padding, we als
o need to invalidate the child's pref widths. | 1508 // If relayoutChildren is set and we have percentage padding, we als
o need to invalidate the child's pref widths. |
| 1509 //if (relayoutChildren && (r->style()->paddingLeft().isPercent() ||
r->style()->paddingRight().isPercent())) | 1509 //if (relayoutChildren && (r->style()->paddingLeft().isPercent() ||
r->style()->paddingRight().isPercent())) |
| 1510 r->setPrefWidthsDirty(true, false); | 1510 r->setPrefWidthsDirty(true, false); |
| 1511 | 1511 |
| 1512 // We don't have to do a full layout. We just have to update our po
sition. Try that first. If we have shrink-to-fit width | 1512 // We don't have to do a full layout. We just have to update our po
sition. Try that first. If we have shrink-to-fit width |
| 1513 // and we hit the available width constraint, the layoutIfNeeded() w
ill catch it and do a full layout. | 1513 // and we hit the available width constraint, the layoutIfNeeded() w
ill catch it and do a full layout. |
| 1514 if (r->needsPositionedMovementLayoutOnly()) | 1514 if (r->needsPositionedMovementLayoutOnly()) |
| 1515 r->tryLayoutDoingPositionedMovementOnly(); | 1515 r->tryLayoutDoingPositionedMovementOnly(); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 } | 1753 } |
| 1754 | 1754 |
| 1755 // We're done. We don't bother painting any children. | 1755 // We're done. We don't bother painting any children. |
| 1756 if (paintPhase == PaintPhaseBlockBackground) | 1756 if (paintPhase == PaintPhaseBlockBackground) |
| 1757 return; | 1757 return; |
| 1758 | 1758 |
| 1759 // Adjust our painting position if we're inside a scrolled layer (e.g., an o
verflow:auto div).s | 1759 // Adjust our painting position if we're inside a scrolled layer (e.g., an o
verflow:auto div).s |
| 1760 int scrolledX = tx; | 1760 int scrolledX = tx; |
| 1761 int scrolledY = ty; | 1761 int scrolledY = ty; |
| 1762 if (hasOverflowClip()) | 1762 if (hasOverflowClip()) |
| 1763 layer()->subtractScrolledContentOffset(scrolledX, scrolledY); | 1763 m_layer->subtractScrolledContentOffset(scrolledX, scrolledY); |
| 1764 | 1764 |
| 1765 // 2. paint contents | 1765 // 2. paint contents |
| 1766 if (paintPhase != PaintPhaseSelfOutline) { | 1766 if (paintPhase != PaintPhaseSelfOutline) { |
| 1767 if (hasColumns()) | 1767 if (hasColumns()) |
| 1768 paintColumns(paintInfo, scrolledX, scrolledY); | 1768 paintColumns(paintInfo, scrolledX, scrolledY); |
| 1769 else | 1769 else |
| 1770 paintContents(paintInfo, scrolledX, scrolledY); | 1770 paintContents(paintInfo, scrolledX, scrolledY); |
| 1771 } | 1771 } |
| 1772 | 1772 |
| 1773 // 3. paint selection | 1773 // 3. paint selection |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 | 1955 |
| 1956 if (view() && view()->selectionStart()) { | 1956 if (view() && view()->selectionStart()) { |
| 1957 Node* startElement = view()->selectionStart()->element(); | 1957 Node* startElement = view()->selectionStart()->element(); |
| 1958 if (startElement && startElement->rootEditableElement() == element()) | 1958 if (startElement && startElement->rootEditableElement() == element()) |
| 1959 return true; | 1959 return true; |
| 1960 } | 1960 } |
| 1961 | 1961 |
| 1962 return false; | 1962 return false; |
| 1963 } | 1963 } |
| 1964 | 1964 |
| 1965 GapRects RenderBlock::selectionGapRectsForRepaint(RenderBoxModelObject* /*repain
tContainer*/) | 1965 GapRects RenderBlock::selectionGapRectsForRepaint(RenderBox* /*repaintContainer*
/) |
| 1966 { | 1966 { |
| 1967 ASSERT(!needsLayout()); | 1967 ASSERT(!needsLayout()); |
| 1968 | 1968 |
| 1969 if (!shouldPaintSelectionGaps()) | 1969 if (!shouldPaintSelectionGaps()) |
| 1970 return GapRects(); | 1970 return GapRects(); |
| 1971 | 1971 |
| 1972 // FIXME: this is broken with transforms and a non-null repaintContainer | 1972 // FIXME: this is broken with transforms and a non-null repaintContainer |
| 1973 FloatPoint absContentPoint = localToAbsolute(FloatPoint()); | 1973 FloatPoint absContentPoint = localToAbsolute(FloatPoint()); |
| 1974 if (hasOverflowClip()) | 1974 if (hasOverflowClip()) |
| 1975 absContentPoint -= layer()->scrolledContentOffset(); | 1975 absContentPoint -= layer()->scrolledContentOffset(); |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2958 RenderObject* prev = previousSibling(); | 2958 RenderObject* prev = previousSibling(); |
| 2959 while (prev && (!prev->isBox() || !prev->isRenderBlock() || prev->avoidsFloa
ts() || prev->isFloatingOrPositioned())) { | 2959 while (prev && (!prev->isBox() || !prev->isRenderBlock() || prev->avoidsFloa
ts() || prev->isFloatingOrPositioned())) { |
| 2960 if (prev->isFloating()) | 2960 if (prev->isFloating()) |
| 2961 parentHasFloats = true; | 2961 parentHasFloats = true; |
| 2962 prev = prev->previousSibling(); | 2962 prev = prev->previousSibling(); |
| 2963 } | 2963 } |
| 2964 | 2964 |
| 2965 // First add in floats from the parent. | 2965 // First add in floats from the parent. |
| 2966 int offset = y(); | 2966 int offset = y(); |
| 2967 if (parentHasFloats) { | 2967 if (parentHasFloats) { |
| 2968 RenderBlock* parentBlock = toRenderBlock(parent()); | 2968 RenderBlock* parentBlock = static_cast<RenderBlock *>(parent()); |
| 2969 addIntrudingFloats(parentBlock, parentBlock->borderLeft() + parentBlock-
>paddingLeft(), offset); | 2969 addIntrudingFloats(parentBlock, parentBlock->borderLeft() + parentBlock-
>paddingLeft(), offset); |
| 2970 } | 2970 } |
| 2971 | 2971 |
| 2972 int xoffset = 0; | 2972 int xoffset = 0; |
| 2973 if (prev) | 2973 if (prev) |
| 2974 offset -= toRenderBox(prev)->y(); | 2974 offset -= toRenderBox(prev)->y(); |
| 2975 else if (parent()->isBox()) { | 2975 else if (parent()->isBox()) { |
| 2976 prev = parent(); | 2976 prev = parent(); |
| 2977 xoffset += toRenderBox(prev)->borderLeft() + toRenderBox(prev)->paddingL
eft(); | 2977 xoffset += toRenderBox(prev)->borderLeft() + toRenderBox(prev)->paddingL
eft(); |
| 2978 } | 2978 } |
| 2979 | 2979 |
| 2980 // Add overhanging floats from the previous RenderBlock, but only if it has
a float that intrudes into our space. | 2980 // Add overhanging floats from the previous RenderBlock, but only if it has
a float that intrudes into our space. |
| 2981 if (!prev || !prev->isRenderBlock()) | 2981 if (!prev || !prev->isRenderBlock()) |
| 2982 return; | 2982 return; |
| 2983 | 2983 |
| 2984 RenderBlock* block = toRenderBlock(prev); | 2984 RenderBlock* block = static_cast<RenderBlock *>(prev); |
| 2985 if (block->m_floatingObjects && block->floatBottom() > offset) | 2985 if (block->m_floatingObjects && block->floatBottom() > offset) |
| 2986 addIntrudingFloats(block, xoffset, offset); | 2986 addIntrudingFloats(block, xoffset, offset); |
| 2987 | 2987 |
| 2988 if (childrenInline()) { | 2988 if (childrenInline()) { |
| 2989 int changeTop = INT_MAX; | 2989 int changeTop = INT_MAX; |
| 2990 int changeBottom = INT_MIN; | 2990 int changeBottom = INT_MIN; |
| 2991 if (m_floatingObjects) { | 2991 if (m_floatingObjects) { |
| 2992 for (FloatingObject* f = m_floatingObjects->first(); f; f = m_floati
ngObjects->next()) { | 2992 for (FloatingObject* f = m_floatingObjects->first(); f; f = m_floati
ngObjects->next()) { |
| 2993 FloatingObject* oldFloatingObject = floatMap.get(f->m_renderer); | 2993 FloatingObject* oldFloatingObject = floatMap.get(f->m_renderer); |
| 2994 if (oldFloatingObject) { | 2994 if (oldFloatingObject) { |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3240 } | 3240 } |
| 3241 return false; | 3241 return false; |
| 3242 } | 3242 } |
| 3243 | 3243 |
| 3244 // If we have lightweight control clipping, then we can't have any spillout
. | 3244 // If we have lightweight control clipping, then we can't have any spillout
. |
| 3245 if (!hasControlClip() || controlClipRect(tx, ty).contains(_x, _y)) { | 3245 if (!hasControlClip() || controlClipRect(tx, ty).contains(_x, _y)) { |
| 3246 // Hit test descendants first. | 3246 // Hit test descendants first. |
| 3247 int scrolledX = tx; | 3247 int scrolledX = tx; |
| 3248 int scrolledY = ty; | 3248 int scrolledY = ty; |
| 3249 if (hasOverflowClip()) | 3249 if (hasOverflowClip()) |
| 3250 layer()->subtractScrolledContentOffset(scrolledX, scrolledY); | 3250 m_layer->subtractScrolledContentOffset(scrolledX, scrolledY); |
| 3251 | 3251 |
| 3252 // Hit test contents if we don't have columns. | 3252 // Hit test contents if we don't have columns. |
| 3253 if (!hasColumns() && hitTestContents(request, result, _x, _y, scrolledX,
scrolledY, hitTestAction)) | 3253 if (!hasColumns() && hitTestContents(request, result, _x, _y, scrolledX,
scrolledY, hitTestAction)) |
| 3254 return true; | 3254 return true; |
| 3255 | 3255 |
| 3256 // Hit test our columns if we do have them. | 3256 // Hit test our columns if we do have them. |
| 3257 if (hasColumns() && hitTestColumns(request, result, _x, _y, scrolledX, s
crolledY, hitTestAction)) | 3257 if (hasColumns() && hitTestColumns(request, result, _x, _y, scrolledX, s
crolledY, hitTestAction)) |
| 3258 return true; | 3258 return true; |
| 3259 | 3259 |
| 3260 // Hit test floats. | 3260 // Hit test floats. |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3496 if (contentsY >= renderer->y() && contentsY < bottom) | 3496 if (contentsY >= renderer->y() && contentsY < bottom) |
| 3497 return renderer->positionForCoordinates(contentsX - renderer->x(), c
ontentsY - renderer->y()); | 3497 return renderer->positionForCoordinates(contentsX - renderer->x(), c
ontentsY - renderer->y()); |
| 3498 } | 3498 } |
| 3499 | 3499 |
| 3500 return RenderBox::positionForCoordinates(x, y); | 3500 return RenderBox::positionForCoordinates(x, y); |
| 3501 } | 3501 } |
| 3502 | 3502 |
| 3503 void RenderBlock::offsetForContents(int& tx, int& ty) const | 3503 void RenderBlock::offsetForContents(int& tx, int& ty) const |
| 3504 { | 3504 { |
| 3505 if (hasOverflowClip()) | 3505 if (hasOverflowClip()) |
| 3506 layer()->addScrolledContentOffset(tx, ty); | 3506 m_layer->addScrolledContentOffset(tx, ty); |
| 3507 | 3507 |
| 3508 if (hasColumns()) { | 3508 if (hasColumns()) { |
| 3509 IntPoint contentsPoint(tx, ty); | 3509 IntPoint contentsPoint(tx, ty); |
| 3510 adjustPointToColumnContents(contentsPoint); | 3510 adjustPointToColumnContents(contentsPoint); |
| 3511 tx = contentsPoint.x(); | 3511 tx = contentsPoint.x(); |
| 3512 ty = contentsPoint.y(); | 3512 ty = contentsPoint.y(); |
| 3513 } | 3513 } |
| 3514 } | 3514 } |
| 3515 | 3515 |
| 3516 int RenderBlock::availableWidth() const | 3516 int RenderBlock::availableWidth() const |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3809 calcInlinePrefWidths(); | 3809 calcInlinePrefWidths(); |
| 3810 else | 3810 else |
| 3811 calcBlockPrefWidths(); | 3811 calcBlockPrefWidths(); |
| 3812 | 3812 |
| 3813 m_maxPrefWidth = max(m_minPrefWidth, m_maxPrefWidth); | 3813 m_maxPrefWidth = max(m_minPrefWidth, m_maxPrefWidth); |
| 3814 | 3814 |
| 3815 if (!style()->autoWrap() && childrenInline()) { | 3815 if (!style()->autoWrap() && childrenInline()) { |
| 3816 m_minPrefWidth = m_maxPrefWidth; | 3816 m_minPrefWidth = m_maxPrefWidth; |
| 3817 | 3817 |
| 3818 // A horizontal marquee with inline children has no minimum width. | 3818 // A horizontal marquee with inline children has no minimum width. |
| 3819 if (layer() && layer()->marquee() && layer()->marquee()->isHorizonta
l()) | 3819 if (m_layer && m_layer->marquee() && m_layer->marquee()->isHorizonta
l()) |
| 3820 m_minPrefWidth = 0; | 3820 m_minPrefWidth = 0; |
| 3821 } | 3821 } |
| 3822 | 3822 |
| 3823 if (isTableCell()) { | 3823 if (isTableCell()) { |
| 3824 Length w = static_cast<const RenderTableCell*>(this)->styleOrColWidt
h(); | 3824 Length w = static_cast<const RenderTableCell*>(this)->styleOrColWidt
h(); |
| 3825 if (w.isFixed() && w.value() > 0) | 3825 if (w.isFixed() && w.value() > 0) |
| 3826 m_maxPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(w.value
())); | 3826 m_maxPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(w.value
())); |
| 3827 } | 3827 } |
| 3828 } | 3828 } |
| 3829 | 3829 |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4361 // is turned off, checkboxes/radios will still have decent baselines. | 4361 // is turned off, checkboxes/radios will still have decent baselines. |
| 4362 if (style()->hasAppearance() && !theme()->isControlContainer(style()->ap
pearance())) | 4362 if (style()->hasAppearance() && !theme()->isControlContainer(style()->ap
pearance())) |
| 4363 return theme()->baselinePosition(this); | 4363 return theme()->baselinePosition(this); |
| 4364 | 4364 |
| 4365 // CSS2.1 states that the baseline of an inline block is the baseline of
the last line box in | 4365 // CSS2.1 states that the baseline of an inline block is the baseline of
the last line box in |
| 4366 // the normal flow. We make an exception for marquees, since their base
lines are meaningless | 4366 // the normal flow. We make an exception for marquees, since their base
lines are meaningless |
| 4367 // (the content inside them moves). This matches WinIE as well, which j
ust bottom-aligns them. | 4367 // (the content inside them moves). This matches WinIE as well, which j
ust bottom-aligns them. |
| 4368 // We also give up on finding a baseline if we have a vertical scrollbar
, or if we are scrolled | 4368 // We also give up on finding a baseline if we have a vertical scrollbar
, or if we are scrolled |
| 4369 // vertically (e.g., an overflow:hidden block that has had scrollTop mov
ed) or if the baseline is outside | 4369 // vertically (e.g., an overflow:hidden block that has had scrollTop mov
ed) or if the baseline is outside |
| 4370 // of our content box. | 4370 // of our content box. |
| 4371 int baselinePos = (layer() && (layer()->marquee() || layer()->verticalSc
rollbar() || layer()->scrollYOffset() != 0)) ? -1 : getBaselineOfLastLineBox(); | 4371 int baselinePos = (m_layer && (m_layer->marquee() || m_layer->verticalSc
rollbar() || m_layer->scrollYOffset() != 0)) ? -1 : getBaselineOfLastLineBox(); |
| 4372 if (baselinePos != -1 && baselinePos <= borderTop() + paddingTop() + con
tentHeight()) | 4372 if (baselinePos != -1 && baselinePos <= borderTop() + paddingTop() + con
tentHeight()) |
| 4373 return marginTop() + baselinePos; | 4373 return marginTop() + baselinePos; |
| 4374 return height() + marginTop() + marginBottom(); | 4374 return height() + marginTop() + marginBottom(); |
| 4375 } | 4375 } |
| 4376 return RenderBox::baselinePosition(b, isRootLineBox); | 4376 return RenderBox::baselinePosition(b, isRootLineBox); |
| 4377 } | 4377 } |
| 4378 | 4378 |
| 4379 int RenderBlock::getBaselineOfFirstLineBox() const | 4379 int RenderBlock::getBaselineOfFirstLineBox() const |
| 4380 { | 4380 { |
| 4381 if (!isBlockFlow()) | 4381 if (!isBlockFlow()) |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4814 // shape). | 4814 // shape). |
| 4815 if (topLevel && inlineContinuation()) { | 4815 if (topLevel && inlineContinuation()) { |
| 4816 FloatRect localRect(0, -collapsedMarginTop(), | 4816 FloatRect localRect(0, -collapsedMarginTop(), |
| 4817 width(), height() + collapsedMarginTop() + collapsed
MarginBottom()); | 4817 width(), height() + collapsedMarginTop() + collapsed
MarginBottom()); |
| 4818 quads.append(localToAbsoluteQuad(localRect)); | 4818 quads.append(localToAbsoluteQuad(localRect)); |
| 4819 inlineContinuation()->absoluteQuads(quads, topLevel); | 4819 inlineContinuation()->absoluteQuads(quads, topLevel); |
| 4820 } else | 4820 } else |
| 4821 quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, width(), hei
ght()))); | 4821 quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, width(), hei
ght()))); |
| 4822 } | 4822 } |
| 4823 | 4823 |
| 4824 IntRect RenderBlock::rectWithOutlineForRepaint(RenderBoxModelObject* repaintCont
ainer, int outlineWidth) | 4824 IntRect RenderBlock::rectWithOutlineForRepaint(RenderBox* repaintContainer, int
outlineWidth) |
| 4825 { | 4825 { |
| 4826 IntRect r(RenderBox::rectWithOutlineForRepaint(repaintContainer, outlineWidt
h)); | 4826 IntRect r(RenderBox::rectWithOutlineForRepaint(repaintContainer, outlineWidt
h)); |
| 4827 if (inlineContinuation()) | 4827 if (inlineContinuation()) |
| 4828 r.inflateY(collapsedMarginTop()); | 4828 r.inflateY(collapsedMarginTop()); |
| 4829 return r; | 4829 return r; |
| 4830 } | 4830 } |
| 4831 | 4831 |
| 4832 RenderObject* RenderBlock::hoverAncestor() const | 4832 RenderObject* RenderBlock::hoverAncestor() const |
| 4833 { | 4833 { |
| 4834 return inlineContinuation() ? inlineContinuation() : RenderBox::hoverAncesto
r(); | 4834 return inlineContinuation() ? inlineContinuation() : RenderBox::hoverAncesto
r(); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5009 return "RenderBlock (generated)"; | 5009 return "RenderBlock (generated)"; |
| 5010 if (isRelPositioned()) | 5010 if (isRelPositioned()) |
| 5011 return "RenderBlock (relative positioned)"; | 5011 return "RenderBlock (relative positioned)"; |
| 5012 if (isRunIn()) | 5012 if (isRunIn()) |
| 5013 return "RenderBlock (run-in)"; | 5013 return "RenderBlock (run-in)"; |
| 5014 return "RenderBlock"; | 5014 return "RenderBlock"; |
| 5015 } | 5015 } |
| 5016 | 5016 |
| 5017 } // namespace WebCore | 5017 } // namespace WebCore |
| 5018 | 5018 |
| OLD | NEW |