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 2889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2900 PaintPhase phase = paintInfo.phase; | 2900 PaintPhase phase = paintInfo.phase; |
2901 | 2901 |
2902 // Check if we need to do anything at all. | 2902 // Check if we need to do anything at all. |
2903 // FIXME: Could eliminate the isRoot() check if we fix background painting s
o that the RenderView | 2903 // FIXME: Could eliminate the isRoot() check if we fix background painting s
o that the RenderView |
2904 // paints the root's background. | 2904 // paints the root's background. |
2905 if (!isRoot()) { | 2905 if (!isRoot()) { |
2906 LayoutRect overflowBox = overflowRectForPaintRejection(); | 2906 LayoutRect overflowBox = overflowRectForPaintRejection(); |
2907 flipForWritingMode(overflowBox); | 2907 flipForWritingMode(overflowBox); |
2908 overflowBox.inflate(maximalOutlineSize(paintInfo.phase)); | 2908 overflowBox.inflate(maximalOutlineSize(paintInfo.phase)); |
2909 overflowBox.moveBy(adjustedPaintOffset); | 2909 overflowBox.moveBy(adjustedPaintOffset); |
2910 if (!overflowBox.intersects(paintInfo.rect)) | 2910 if (!overflowBox.intersects(paintInfo.rect())) |
2911 return; | 2911 return; |
2912 } | 2912 } |
2913 | 2913 |
2914 // There are some cases where not all clipped visual overflow is accounted f
or. | 2914 // There are some cases where not all clipped visual overflow is accounted f
or. |
2915 // FIXME: reduce the number of such cases. | 2915 // FIXME: reduce the number of such cases. |
2916 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; | 2916 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; |
2917 if (hasOverflowClip() && !hasControlClip() && !(shouldPaintSelectionGaps() &
& phase == PaintPhaseForeground) && !hasCaret()) | 2917 if (hasOverflowClip() && !hasControlClip() && !(shouldPaintSelectionGaps() &
& phase == PaintPhaseForeground) && !hasCaret()) |
2918 contentsClipBehavior = SkipContentsClipIfPossible; | 2918 contentsClipBehavior = SkipContentsClipIfPossible; |
2919 | 2919 |
2920 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC
lipBehavior); | 2920 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC
lipBehavior); |
2921 paintObject(paintInfo, adjustedPaintOffset); | 2921 paintObject(paintInfo, adjustedPaintOffset); |
2922 if (pushedClip) | 2922 if (pushedClip) |
2923 popContentsClip(paintInfo, phase, adjustedPaintOffset); | 2923 popContentsClip(paintInfo, phase, adjustedPaintOffset); |
2924 | 2924 |
2925 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with | 2925 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with |
2926 // z-index. We paint after we painted the background/border, so that the sc
rollbars will | 2926 // z-index. We paint after we painted the background/border, so that the sc
rollbars will |
2927 // sit above the background/border. | 2927 // sit above the background/border. |
2928 if (hasOverflowClip() && style()->visibility() == VISIBLE && (phase == Paint
PhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.sh
ouldPaintWithinRoot(this) && !paintInfo.paintRootBackgroundOnly()) | 2928 if (hasOverflowClip() && style()->visibility() == VISIBLE && (phase == Paint
PhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.sh
ouldPaintWithinRoot(this) && !paintInfo.paintRootBackgroundOnly()) |
2929 layer()->paintOverflowControls(paintInfo.context, roundedIntPoint(adjust
edPaintOffset), paintInfo.rect); | 2929 layer()->paintOverflowControls(paintInfo.context, roundedIntPoint(adjust
edPaintOffset), paintInfo.rect()); |
2930 } | 2930 } |
2931 | 2931 |
2932 void RenderBlock::paintColumnRules(PaintInfo& paintInfo, const LayoutPoint& pain
tOffset) | 2932 void RenderBlock::paintColumnRules(PaintInfo& paintInfo, const LayoutPoint& pain
tOffset) |
2933 { | 2933 { |
2934 if (paintInfo.context->paintingDisabled()) | 2934 if (paintInfo.context->paintingDisabled()) |
2935 return; | 2935 return; |
2936 | 2936 |
2937 const Color& ruleColor = resolveColor(CSSPropertyWebkitColumnRuleColor); | 2937 const Color& ruleColor = resolveColor(CSSPropertyWebkitColumnRuleColor); |
2938 bool ruleTransparent = style()->columnRuleIsTransparent(); | 2938 bool ruleTransparent = style()->columnRuleIsTransparent(); |
2939 EBorderStyle ruleStyle = style()->columnRuleStyle(); | 2939 EBorderStyle ruleStyle = style()->columnRuleStyle(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 LayoutUnit logicalLeftOffset = (isHorizontalWritingMode() ? colRect.x()
: colRect.y()) - logicalLeftOffsetForContent(); | 3034 LayoutUnit logicalLeftOffset = (isHorizontalWritingMode() ? colRect.x()
: colRect.y()) - logicalLeftOffsetForContent(); |
3035 LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(logicalLeftOf
fset, currLogicalTopOffset) : LayoutSize(currLogicalTopOffset, logicalLeftOffset
); | 3035 LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(logicalLeftOf
fset, currLogicalTopOffset) : LayoutSize(currLogicalTopOffset, logicalLeftOffset
); |
3036 if (colInfo->progressionAxis() == ColumnInfo::BlockAxis) { | 3036 if (colInfo->progressionAxis() == ColumnInfo::BlockAxis) { |
3037 if (isHorizontalWritingMode()) | 3037 if (isHorizontalWritingMode()) |
3038 offset.expand(0, colRect.y() - borderTop() - paddingTop()); | 3038 offset.expand(0, colRect.y() - borderTop() - paddingTop()); |
3039 else | 3039 else |
3040 offset.expand(colRect.x() - borderLeft() - paddingLeft(), 0); | 3040 offset.expand(colRect.x() - borderLeft() - paddingLeft(), 0); |
3041 } | 3041 } |
3042 colRect.moveBy(paintOffset); | 3042 colRect.moveBy(paintOffset); |
3043 PaintInfo info(paintInfo); | 3043 PaintInfo info(paintInfo); |
3044 info.rect.intersect(pixelSnappedIntRect(colRect)); | 3044 info.rect().intersect(pixelSnappedIntRect(colRect)); |
3045 | 3045 |
3046 if (!info.rect.isEmpty()) { | 3046 if (!info.rect().isEmpty()) { |
3047 GraphicsContextStateSaver stateSaver(*context); | 3047 GraphicsContextStateSaver stateSaver(*context); |
3048 LayoutRect clipRect(colRect); | 3048 LayoutRect clipRect(colRect); |
3049 | 3049 |
3050 if (i < colCount - 1) { | 3050 if (i < colCount - 1) { |
3051 if (isHorizontalWritingMode()) | 3051 if (isHorizontalWritingMode()) |
3052 clipRect.expand(colGap / 2, 0); | 3052 clipRect.expand(colGap / 2, 0); |
3053 else | 3053 else |
3054 clipRect.expand(0, colGap / 2); | 3054 clipRect.expand(0, colGap / 2); |
3055 } | 3055 } |
3056 // Each strip pushes a clip, since column boxes are specified as bei
ng | 3056 // Each strip pushes a clip, since column boxes are specified as bei
ng |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3125 } | 3125 } |
3126 return caretPainter == this && (isContentEditable || caretBrowsing); | 3126 return caretPainter == this && (isContentEditable || caretBrowsing); |
3127 } | 3127 } |
3128 | 3128 |
3129 void RenderBlock::paintCaret(PaintInfo& paintInfo, const LayoutPoint& paintOffse
t, CaretType type) | 3129 void RenderBlock::paintCaret(PaintInfo& paintInfo, const LayoutPoint& paintOffse
t, CaretType type) |
3130 { | 3130 { |
3131 if (!hasCaret(type)) | 3131 if (!hasCaret(type)) |
3132 return; | 3132 return; |
3133 | 3133 |
3134 if (type == CursorCaret) | 3134 if (type == CursorCaret) |
3135 frame()->selection()->paintCaret(paintInfo.context, paintOffset, paintIn
fo.rect); | 3135 frame()->selection()->paintCaret(paintInfo.context, paintOffset, paintIn
fo.rect()); |
3136 else | 3136 else |
3137 frame()->page()->dragCaretController().paintDragCaret(frame(), paintInfo
.context, paintOffset, paintInfo.rect); | 3137 frame()->page()->dragCaretController().paintDragCaret(frame(), paintInfo
.context, paintOffset, paintInfo.rect()); |
3138 } | 3138 } |
3139 | 3139 |
3140 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) | 3140 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) |
3141 { | 3141 { |
3142 PaintPhase paintPhase = paintInfo.phase; | 3142 PaintPhase paintPhase = paintInfo.phase; |
3143 | 3143 |
3144 // 1. paint background, borders etc | 3144 // 1. paint background, borders etc |
3145 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && style()->visibility() == VISIBLE) { | 3145 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && style()->visibility() == VISIBLE) { |
3146 if (hasBoxDecorations()) | 3146 if (hasBoxDecorations()) |
3147 paintBoxDecorations(paintInfo, paintOffset); | 3147 paintBoxDecorations(paintInfo, paintOffset); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3537 LayoutUnit selHeight = curr->selectionHeightAdjustedForPrecedingBlock(); | 3537 LayoutUnit selHeight = curr->selectionHeightAdjustedForPrecedingBlock(); |
3538 | 3538 |
3539 if (!containsStart && !lastSelectedLine && | 3539 if (!containsStart && !lastSelectedLine && |
3540 selectionState() != SelectionStart && selectionState() != SelectionB
oth) | 3540 selectionState() != SelectionStart && selectionState() != SelectionB
oth) |
3541 result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPos
ition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRight, | 3541 result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysicalPos
ition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRight, |
3542 selTop, paintInfo)); | 3542 selTop, paintInfo)); |
3543 | 3543 |
3544 LayoutRect logicalRect(curr->logicalLeft(), selTop, curr->logicalWidth()
, selTop + selHeight); | 3544 LayoutRect logicalRect(curr->logicalLeft(), selTop, curr->logicalWidth()
, selTop + selHeight); |
3545 logicalRect.move(isHorizontalWritingMode() ? offsetFromRootBlock : offse
tFromRootBlock.transposedSize()); | 3545 logicalRect.move(isHorizontalWritingMode() ? offsetFromRootBlock : offse
tFromRootBlock.transposedSize()); |
3546 LayoutRect physicalRect = rootBlock->logicalRectToPhysicalRect(rootBlock
PhysicalPosition, logicalRect); | 3546 LayoutRect physicalRect = rootBlock->logicalRectToPhysicalRect(rootBlock
PhysicalPosition, logicalRect); |
3547 if (!paintInfo || (isHorizontalWritingMode() && physicalRect.y() < paint
Info->rect.maxY() && physicalRect.maxY() > paintInfo->rect.y()) | 3547 if (!paintInfo || (isHorizontalWritingMode() && physicalRect.y() < paint
Info->rect().maxY() && physicalRect.maxY() > paintInfo->rect().y()) |
3548 || (!isHorizontalWritingMode() && physicalRect.x() < paintInfo->rect
.maxX() && physicalRect.maxX() > paintInfo->rect.x())) | 3548 || (!isHorizontalWritingMode() && physicalRect.x() < paintInfo->rect
().maxX() && physicalRect.maxX() > paintInfo->rect().x())) |
3549 result.unite(curr->lineSelectionGap(rootBlock, rootBlockPhysicalPosi
tion, offsetFromRootBlock, selTop, selHeight, paintInfo)); | 3549 result.unite(curr->lineSelectionGap(rootBlock, rootBlockPhysicalPosi
tion, offsetFromRootBlock, selTop, selHeight, paintInfo)); |
3550 | 3550 |
3551 lastSelectedLine = curr; | 3551 lastSelectedLine = curr; |
3552 } | 3552 } |
3553 | 3553 |
3554 if (containsStart && !lastSelectedLine) | 3554 if (containsStart && !lastSelectedLine) |
3555 // VisibleSelection must start just after our last line. | 3555 // VisibleSelection must start just after our last line. |
3556 lastSelectedLine = lastRootBox(); | 3556 lastSelectedLine = lastRootBox(); |
3557 | 3557 |
3558 if (lastSelectedLine && selectionState() != SelectionEnd && selectionState()
!= SelectionBoth) { | 3558 if (lastSelectedLine && selectionState() != SelectionEnd && selectionState()
!= SelectionBoth) { |
(...skipping 4419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7978 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 7978 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
7979 { | 7979 { |
7980 showRenderObject(); | 7980 showRenderObject(); |
7981 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 7981 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
7982 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 7982 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
7983 } | 7983 } |
7984 | 7984 |
7985 #endif | 7985 #endif |
7986 | 7986 |
7987 } // namespace WebCore | 7987 } // namespace WebCore |
OLD | NEW |