OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/paint/BlockPainter.h" | 6 #include "core/paint/BlockPainter.h" |
7 | 7 |
8 #include "core/editing/Caret.h" | 8 #include "core/editing/Caret.h" |
9 #include "core/editing/FrameSelection.h" | 9 #include "core/editing/FrameSelection.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 void BlockPainter::paintOverflowControlsIfNeeded(const PaintInfo& paintInfo, con
st LayoutPoint& paintOffset) | 92 void BlockPainter::paintOverflowControlsIfNeeded(const PaintInfo& paintInfo, con
st LayoutPoint& paintOffset) |
93 { | 93 { |
94 PaintPhase phase = paintInfo.phase; | 94 PaintPhase phase = paintInfo.phase; |
95 if (m_renderBlock.hasOverflowClip() && m_renderBlock.style()->visibility() =
= VISIBLE && (phase == PaintPhaseBlockBackground || phase == PaintPhaseChildBloc
kBackground) && paintInfo.shouldPaintWithinRoot(&m_renderBlock) && !paintInfo.pa
intRootBackgroundOnly()) { | 95 if (m_renderBlock.hasOverflowClip() && m_renderBlock.style()->visibility() =
= VISIBLE && (phase == PaintPhaseBlockBackground || phase == PaintPhaseChildBloc
kBackground) && paintInfo.shouldPaintWithinRoot(&m_renderBlock) && !paintInfo.pa
intRootBackgroundOnly()) { |
96 ScrollableAreaPainter(*m_renderBlock.layer()->scrollableArea()).paintOve
rflowControls(paintInfo.context, roundedIntPoint(paintOffset), paintInfo.rect, f
alse /* paintingOverlayControls */); | 96 ScrollableAreaPainter(*m_renderBlock.layer()->scrollableArea()).paintOve
rflowControls(paintInfo.context, roundedIntPoint(paintOffset), paintInfo.rect, f
alse /* paintingOverlayControls */); |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 void BlockPainter::paintChildren(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) | 100 void BlockPainter::paintChildren(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) |
101 { | 101 { |
102 for (RenderBox* child = m_renderBlock.firstChildBox(); child; child = child-
>nextSiblingBox()) | 102 for (LayoutBox* child = m_renderBlock.firstChildBox(); child; child = child-
>nextSiblingBox()) |
103 paintChild(*child, paintInfo, paintOffset); | 103 paintChild(*child, paintInfo, paintOffset); |
104 } | 104 } |
105 | 105 |
106 void BlockPainter::paintChild(RenderBox& child, const PaintInfo& paintInfo, cons
t LayoutPoint& paintOffset) | 106 void BlockPainter::paintChild(LayoutBox& child, const PaintInfo& paintInfo, cons
t LayoutPoint& paintOffset) |
107 { | 107 { |
108 LayoutPoint childPoint = m_renderBlock.flipForWritingModeForChild(&child, pa
intOffset); | 108 LayoutPoint childPoint = m_renderBlock.flipForWritingModeForChild(&child, pa
intOffset); |
109 if (!child.hasSelfPaintingLayer() && !child.isFloating() && !child.isColumnS
panAll()) | 109 if (!child.hasSelfPaintingLayer() && !child.isFloating() && !child.isColumnS
panAll()) |
110 child.paint(paintInfo, childPoint); | 110 child.paint(paintInfo, childPoint); |
111 } | 111 } |
112 | 112 |
113 void BlockPainter::paintChildrenOfFlexibleBox(RenderFlexibleBox& renderFlexibleB
ox, const PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 113 void BlockPainter::paintChildrenOfFlexibleBox(RenderFlexibleBox& renderFlexibleB
ox, const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
114 { | 114 { |
115 for (RenderBox* child = renderFlexibleBox.orderIterator().first(); child; ch
ild = renderFlexibleBox.orderIterator().next()) | 115 for (LayoutBox* child = renderFlexibleBox.orderIterator().first(); child; ch
ild = renderFlexibleBox.orderIterator().next()) |
116 BlockPainter(renderFlexibleBox).paintChildAsInlineBlock(*child, paintInf
o, paintOffset); | 116 BlockPainter(renderFlexibleBox).paintChildAsInlineBlock(*child, paintInf
o, paintOffset); |
117 } | 117 } |
118 | 118 |
119 void BlockPainter::paintChildAsInlineBlock(RenderBox& child, const PaintInfo& pa
intInfo, const LayoutPoint& paintOffset) | 119 void BlockPainter::paintChildAsInlineBlock(LayoutBox& child, const PaintInfo& pa
intInfo, const LayoutPoint& paintOffset) |
120 { | 120 { |
121 LayoutPoint childPoint = m_renderBlock.flipForWritingModeForChild(&child, pa
intOffset); | 121 LayoutPoint childPoint = m_renderBlock.flipForWritingModeForChild(&child, pa
intOffset); |
122 if (!child.hasSelfPaintingLayer() && !child.isFloating()) | 122 if (!child.hasSelfPaintingLayer() && !child.isFloating()) |
123 paintAsInlineBlock(child, paintInfo, childPoint); | 123 paintAsInlineBlock(child, paintInfo, childPoint); |
124 } | 124 } |
125 | 125 |
126 void BlockPainter::paintInlineBox(InlineBox& inlineBox, const PaintInfo& paintIn
fo, const LayoutPoint& paintOffset) | 126 void BlockPainter::paintInlineBox(InlineBox& inlineBox, const PaintInfo& paintIn
fo, const LayoutPoint& paintOffset) |
127 { | 127 { |
128 if (!paintInfo.shouldPaintWithinRoot(&inlineBox.renderer()) || (paintInfo.ph
ase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)) | 128 if (!paintInfo.shouldPaintWithinRoot(&inlineBox.renderer()) || (paintInfo.ph
ase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)) |
129 return; | 129 return; |
130 | 130 |
131 LayoutPoint childPoint = paintOffset; | 131 LayoutPoint childPoint = paintOffset; |
132 if (inlineBox.parent()->renderer().style()->isFlippedBlocksWritingMode()) //
Faster than calling containingBlock(). | 132 if (inlineBox.parent()->renderer().style()->isFlippedBlocksWritingMode()) //
Faster than calling containingBlock(). |
133 childPoint = inlineBox.renderer().containingBlock()->flipForWritingModeF
orChild(&toRenderBox(inlineBox.renderer()), childPoint); | 133 childPoint = inlineBox.renderer().containingBlock()->flipForWritingModeF
orChild(&toLayoutBox(inlineBox.renderer()), childPoint); |
134 | 134 |
135 paintAsInlineBlock(inlineBox.renderer(), paintInfo, childPoint); | 135 paintAsInlineBlock(inlineBox.renderer(), paintInfo, childPoint); |
136 } | 136 } |
137 | 137 |
138 void BlockPainter::paintAsInlineBlock(LayoutObject& renderer, const PaintInfo& p
aintInfo, const LayoutPoint& childPoint) | 138 void BlockPainter::paintAsInlineBlock(LayoutObject& renderer, const PaintInfo& p
aintInfo, const LayoutPoint& childPoint) |
139 { | 139 { |
140 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) | 140 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) |
141 return; | 141 return; |
142 | 142 |
143 // Paint all phases atomically, as though the element established its own | 143 // Paint all phases atomically, as though the element established its own |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 RenderBlock* block = flow->containingBlock(); | 518 RenderBlock* block = flow->containingBlock(); |
519 for ( ; block && block != &m_renderBlock; block = block->containingBlock
()) | 519 for ( ; block && block != &m_renderBlock; block = block->containingBlock
()) |
520 accumulatedPaintOffset.moveBy(block->location()); | 520 accumulatedPaintOffset.moveBy(block->location()); |
521 ASSERT(block); | 521 ASSERT(block); |
522 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); | 522 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); |
523 } | 523 } |
524 } | 524 } |
525 | 525 |
526 | 526 |
527 } // namespace blink | 527 } // namespace blink |
OLD | NEW |