| 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, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 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 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 if (!hasColumns()) { | 1707 if (!hasColumns()) { |
| 1708 if (childrenInline()) | 1708 if (childrenInline()) |
| 1709 addOverflowFromInlineChildren(); | 1709 addOverflowFromInlineChildren(); |
| 1710 else | 1710 else |
| 1711 addOverflowFromBlockChildren(); | 1711 addOverflowFromBlockChildren(); |
| 1712 } else { | 1712 } else { |
| 1713 ColumnInfo* colInfo = columnInfo(); | 1713 ColumnInfo* colInfo = columnInfo(); |
| 1714 if (columnCount(colInfo)) { | 1714 if (columnCount(colInfo)) { |
| 1715 LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1
); | 1715 LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1
); |
| 1716 addLayoutOverflow(lastRect); | 1716 addLayoutOverflow(lastRect); |
| 1717 if (!hasOverflowClip()) | 1717 addContentsVisualOverflow(lastRect); |
| 1718 addVisualOverflow(lastRect); | |
| 1719 } | 1718 } |
| 1720 } | 1719 } |
| 1721 } | 1720 } |
| 1722 | 1721 |
| 1723 void RenderBlock::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeF
loats) | 1722 void RenderBlock::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeF
loats) |
| 1724 { | 1723 { |
| 1725 m_overflow.clear(); | 1724 m_overflow.clear(); |
| 1726 | 1725 |
| 1727 // Add overflow from children. | 1726 // Add overflow from children. |
| 1728 addOverflowFromChildren(); | 1727 addOverflowFromChildren(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1746 addLayoutOverflow(rectToApply); | 1745 addLayoutOverflow(rectToApply); |
| 1747 if (hasRenderOverflow()) | 1746 if (hasRenderOverflow()) |
| 1748 m_overflow->setLayoutClientAfterEdge(oldClientAfterEdge); | 1747 m_overflow->setLayoutClientAfterEdge(oldClientAfterEdge); |
| 1749 } | 1748 } |
| 1750 | 1749 |
| 1751 // Allow our overflow to catch cases where the caret in an empty editable el
ement with negative text indent needs to get painted. | 1750 // Allow our overflow to catch cases where the caret in an empty editable el
ement with negative text indent needs to get painted. |
| 1752 LayoutUnit textIndent = textIndentOffset(); | 1751 LayoutUnit textIndent = textIndentOffset(); |
| 1753 if (textIndent < 0) { | 1752 if (textIndent < 0) { |
| 1754 LayoutRect clientRect(noOverflowRect()); | 1753 LayoutRect clientRect(noOverflowRect()); |
| 1755 LayoutRect rectToApply = LayoutRect(clientRect.x() + min<LayoutUnit>(0,
textIndent), clientRect.y(), clientRect.width() - min<LayoutUnit>(0, textIndent)
, clientRect.height()); | 1754 LayoutRect rectToApply = LayoutRect(clientRect.x() + min<LayoutUnit>(0,
textIndent), clientRect.y(), clientRect.width() - min<LayoutUnit>(0, textIndent)
, clientRect.height()); |
| 1756 addVisualOverflow(rectToApply); | 1755 addContentsVisualOverflow(rectToApply); |
| 1757 } | 1756 } |
| 1758 | 1757 |
| 1759 // Add visual overflow from box-shadow and border-image-outset. | 1758 // Add visual overflow from box-shadow and border-image-outset. |
| 1760 addVisualEffectOverflow(); | 1759 addVisualEffectOverflow(); |
| 1761 | 1760 |
| 1762 // Add visual overflow from theme. | 1761 // Add visual overflow from theme. |
| 1763 addVisualOverflowFromTheme(); | 1762 addVisualOverflowFromTheme(); |
| 1764 | 1763 |
| 1765 if (isRenderNamedFlowThread()) | 1764 if (isRenderNamedFlowThread()) |
| 1766 toRenderNamedFlowThread(this)->computeOversetStateForRegions(oldClientAf
terEdge); | 1765 toRenderNamedFlowThread(this)->computeOversetStateForRegions(oldClientAf
terEdge); |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2897 // paints the root's background. | 2896 // paints the root's background. |
| 2898 if (!isRoot()) { | 2897 if (!isRoot()) { |
| 2899 LayoutRect overflowBox = overflowRectForPaintRejection(); | 2898 LayoutRect overflowBox = overflowRectForPaintRejection(); |
| 2900 flipForWritingMode(overflowBox); | 2899 flipForWritingMode(overflowBox); |
| 2901 overflowBox.inflate(maximalOutlineSize(paintInfo.phase)); | 2900 overflowBox.inflate(maximalOutlineSize(paintInfo.phase)); |
| 2902 overflowBox.moveBy(adjustedPaintOffset); | 2901 overflowBox.moveBy(adjustedPaintOffset); |
| 2903 if (!overflowBox.intersects(paintInfo.rect)) | 2902 if (!overflowBox.intersects(paintInfo.rect)) |
| 2904 return; | 2903 return; |
| 2905 } | 2904 } |
| 2906 | 2905 |
| 2907 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset); | 2906 // There are some cases where not all clipped visual overflow is accounted f
or. |
| 2907 // FIXME: reduce the number of such cases. |
| 2908 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; |
| 2909 if (hasOverflowClip() && !hasControlClip() && !(shouldPaintSelectionGaps() &
& phase == PaintPhaseForeground) && !hasCaret()) |
| 2910 contentsClipBehavior = SkipContentsClipIfPossible; |
| 2911 |
| 2912 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC
lipBehavior); |
| 2908 paintObject(paintInfo, adjustedPaintOffset); | 2913 paintObject(paintInfo, adjustedPaintOffset); |
| 2909 if (pushedClip) | 2914 if (pushedClip) |
| 2910 popContentsClip(paintInfo, phase, adjustedPaintOffset); | 2915 popContentsClip(paintInfo, phase, adjustedPaintOffset); |
| 2911 | 2916 |
| 2912 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with | 2917 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with |
| 2913 // z-index. We paint after we painted the background/border, so that the sc
rollbars will | 2918 // z-index. We paint after we painted the background/border, so that the sc
rollbars will |
| 2914 // sit above the background/border. | 2919 // sit above the background/border. |
| 2915 if (hasOverflowClip() && style()->visibility() == VISIBLE && (phase == Paint
PhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.sh
ouldPaintWithinRoot(this) && !paintInfo.paintRootBackgroundOnly()) | 2920 if (hasOverflowClip() && style()->visibility() == VISIBLE && (phase == Paint
PhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.sh
ouldPaintWithinRoot(this) && !paintInfo.paintRootBackgroundOnly()) |
| 2916 layer()->paintOverflowControls(paintInfo.context, roundedIntPoint(adjust
edPaintOffset), paintInfo.rect); | 2921 layer()->paintOverflowControls(paintInfo.context, roundedIntPoint(adjust
edPaintOffset), paintInfo.rect); |
| 2917 } | 2922 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3090 paintChild(child, paintInfo, paintOffset); | 3095 paintChild(child, paintInfo, paintOffset); |
| 3091 } | 3096 } |
| 3092 | 3097 |
| 3093 void RenderBlock::paintChild(RenderBox* child, PaintInfo& paintInfo, const Layou
tPoint& paintOffset) | 3098 void RenderBlock::paintChild(RenderBox* child, PaintInfo& paintInfo, const Layou
tPoint& paintOffset) |
| 3094 { | 3099 { |
| 3095 LayoutPoint childPoint = flipForWritingModeForChild(child, paintOffset); | 3100 LayoutPoint childPoint = flipForWritingModeForChild(child, paintOffset); |
| 3096 if (!child->hasSelfPaintingLayer() && !child->isFloating()) | 3101 if (!child->hasSelfPaintingLayer() && !child->isFloating()) |
| 3097 child->paint(paintInfo, childPoint); | 3102 child->paint(paintInfo, childPoint); |
| 3098 } | 3103 } |
| 3099 | 3104 |
| 3100 | 3105 bool RenderBlock::hasCaret(CaretType type) const |
| 3101 void RenderBlock::paintCaret(PaintInfo& paintInfo, const LayoutPoint& paintOffse
t, CaretType type) | |
| 3102 { | 3106 { |
| 3103 // Paint the caret if the FrameSelection says so or if caret browsing is ena
bled | 3107 // Paint the caret if the FrameSelection says so or if caret browsing is ena
bled |
| 3104 bool caretBrowsing = frame()->settings() && frame()->settings()->caretBrowsi
ngEnabled(); | 3108 bool caretBrowsing = frame()->settings() && frame()->settings()->caretBrowsi
ngEnabled(); |
| 3105 RenderObject* caretPainter; | 3109 RenderObject* caretPainter; |
| 3106 bool isContentEditable; | 3110 bool isContentEditable; |
| 3107 if (type == CursorCaret) { | 3111 if (type == CursorCaret) { |
| 3108 caretPainter = frame()->selection()->caretRenderer(); | 3112 caretPainter = frame()->selection()->caretRenderer(); |
| 3109 isContentEditable = frame()->selection()->rendererIsEditable(); | 3113 isContentEditable = frame()->selection()->rendererIsEditable(); |
| 3110 } else { | 3114 } else { |
| 3111 caretPainter = frame()->page()->dragCaretController()->caretRenderer(); | 3115 caretPainter = frame()->page()->dragCaretController()->caretRenderer(); |
| 3112 isContentEditable = frame()->page()->dragCaretController()->isContentEdi
table(); | 3116 isContentEditable = frame()->page()->dragCaretController()->isContentEdi
table(); |
| 3113 } | 3117 } |
| 3118 return caretPainter == this && (isContentEditable || caretBrowsing); |
| 3119 } |
| 3114 | 3120 |
| 3115 if (caretPainter == this && (isContentEditable || caretBrowsing)) { | 3121 void RenderBlock::paintCaret(PaintInfo& paintInfo, const LayoutPoint& paintOffse
t, CaretType type) |
| 3116 if (type == CursorCaret) | 3122 { |
| 3117 frame()->selection()->paintCaret(paintInfo.context, paintOffset, pai
ntInfo.rect); | 3123 if (!hasCaret(type)) |
| 3118 else | 3124 return; |
| 3119 frame()->page()->dragCaretController()->paintDragCaret(frame(), pain
tInfo.context, paintOffset, paintInfo.rect); | 3125 |
| 3120 } | 3126 if (type == CursorCaret) |
| 3127 frame()->selection()->paintCaret(paintInfo.context, paintOffset, paintIn
fo.rect); |
| 3128 else |
| 3129 frame()->page()->dragCaretController()->paintDragCaret(frame(), paintInf
o.context, paintOffset, paintInfo.rect); |
| 3121 } | 3130 } |
| 3122 | 3131 |
| 3123 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) | 3132 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) |
| 3124 { | 3133 { |
| 3125 PaintPhase paintPhase = paintInfo.phase; | 3134 PaintPhase paintPhase = paintInfo.phase; |
| 3126 | 3135 |
| 3127 // 1. paint background, borders etc | 3136 // 1. paint background, borders etc |
| 3128 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && style()->visibility() == VISIBLE) { | 3137 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && style()->visibility() == VISIBLE) { |
| 3129 if (hasBoxDecorations()) | 3138 if (hasBoxDecorations()) |
| 3130 paintBoxDecorations(paintInfo, paintOffset); | 3139 paintBoxDecorations(paintInfo, paintOffset); |
| (...skipping 5011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8142 | 8151 |
| 8143 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 8152 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
| 8144 { | 8153 { |
| 8145 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); | 8154 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); |
| 8146 } | 8155 } |
| 8147 | 8156 |
| 8148 | 8157 |
| 8149 #endif | 8158 #endif |
| 8150 | 8159 |
| 8151 } // namespace WebCore | 8160 } // namespace WebCore |
| OLD | NEW |