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