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/InlineFlowBoxPainter.h" | 6 #include "core/paint/InlineFlowBoxPainter.h" |
7 | 7 |
8 #include "core/layout/LayoutBlock.h" | 8 #include "core/layout/LayoutBlock.h" |
9 #include "core/layout/LayoutInline.h" | 9 #include "core/layout/LayoutInline.h" |
10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 if (containingBlockPaintsContinuationOutline) { | 55 if (containingBlockPaintsContinuationOutline) { |
56 // Add ourselves to the containing block of the entire continuat
ion so that it can | 56 // Add ourselves to the containing block of the entire continuat
ion so that it can |
57 // paint us atomically. | 57 // paint us atomically. |
58 cb->addContinuationWithOutline(toLayoutInline(m_inlineFlowBox.la
youtObject().node()->layoutObject())); | 58 cb->addContinuationWithOutline(toLayoutInline(m_inlineFlowBox.la
youtObject().node()->layoutObject())); |
59 } else if (!inlineFlow.isInlineElementContinuation()) { | 59 } else if (!inlineFlow.isInlineElementContinuation()) { |
60 paintInfo.outlineObjects()->add(&inlineFlow); | 60 paintInfo.outlineObjects()->add(&inlineFlow); |
61 } | 61 } |
62 } | 62 } |
63 } else if (paintInfo.phase == PaintPhaseMask) { | 63 } else if (paintInfo.phase == PaintPhaseMask) { |
64 DrawingRecorder recorder(*paintInfo.context, m_inlineFlowBox, DisplayIte
m::paintPhaseToDrawingType(paintInfo.phase), pixelSnappedIntRect(overflowRect)); | 64 DisplayItem::Type displayItemType = DisplayItem::paintPhaseToDrawingType
(paintInfo.phase); |
65 if (!recorder.canUseCachedDrawing()) | 65 if (DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_in
lineFlowBox, displayItemType)) |
66 paintMask(paintInfo, paintOffset); | 66 return; |
| 67 DrawingRecorder recorder(*paintInfo.context, m_inlineFlowBox, displayIte
mType, pixelSnappedIntRect(overflowRect)); |
| 68 paintMask(paintInfo, paintOffset); |
67 return; | 69 return; |
68 } else if (paintInfo.phase == PaintPhaseForeground) { | 70 } else if (paintInfo.phase == PaintPhaseForeground) { |
69 // Paint our background, border and box-shadow. | 71 // Paint our background, border and box-shadow. |
70 paintBoxDecorationBackground(paintInfo, paintOffset, overflowRect); | 72 paintBoxDecorationBackground(paintInfo, paintOffset, overflowRect); |
71 } | 73 } |
72 | 74 |
73 // Paint our children. | 75 // Paint our children. |
74 if (paintInfo.phase != PaintPhaseSelfOutline) { | 76 if (paintInfo.phase != PaintPhaseSelfOutline) { |
75 PaintInfo childInfo(paintInfo); | 77 PaintInfo childInfo(paintInfo); |
76 childInfo.phase = paintInfo.phase == PaintPhaseChildOutlines ? PaintPhas
eOutline : paintInfo.phase; | 78 childInfo.phase = paintInfo.phase == PaintPhaseChildOutlines ? PaintPhas
eOutline : paintInfo.phase; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 const ComputedStyle* styleToUse = m_inlineFlowBox.layoutObject().style(m_inl
ineFlowBox.isFirstLineStyle()); | 223 const ComputedStyle* styleToUse = m_inlineFlowBox.layoutObject().style(m_inl
ineFlowBox.isFirstLineStyle()); |
222 bool shouldPaintBoxDecorationBackground; | 224 bool shouldPaintBoxDecorationBackground; |
223 if (m_inlineFlowBox.parent()) | 225 if (m_inlineFlowBox.parent()) |
224 shouldPaintBoxDecorationBackground = m_inlineFlowBox.layoutObject().hasB
oxDecorationBackground(); | 226 shouldPaintBoxDecorationBackground = m_inlineFlowBox.layoutObject().hasB
oxDecorationBackground(); |
225 else | 227 else |
226 shouldPaintBoxDecorationBackground = m_inlineFlowBox.isFirstLineStyle()
&& styleToUse != m_inlineFlowBox.layoutObject().style(); | 228 shouldPaintBoxDecorationBackground = m_inlineFlowBox.isFirstLineStyle()
&& styleToUse != m_inlineFlowBox.layoutObject().style(); |
227 | 229 |
228 if (!shouldPaintBoxDecorationBackground) | 230 if (!shouldPaintBoxDecorationBackground) |
229 return; | 231 return; |
230 | 232 |
| 233 if (DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_inline
FlowBox, DisplayItem::BoxDecorationBackground)) |
| 234 return; |
| 235 |
| 236 DrawingRecorder recorder(*paintInfo.context, m_inlineFlowBox, DisplayItem::B
oxDecorationBackground, pixelSnappedIntRect(cullRect)); |
| 237 |
231 LayoutRect frameRect = roundedFrameRectClampedToLineTopAndBottomIfNeeded(); | 238 LayoutRect frameRect = roundedFrameRectClampedToLineTopAndBottomIfNeeded(); |
232 | 239 |
233 // Move x/y to our coordinates. | 240 // Move x/y to our coordinates. |
234 LayoutRect localRect(frameRect); | 241 LayoutRect localRect(frameRect); |
235 m_inlineFlowBox.flipForWritingMode(localRect); | 242 m_inlineFlowBox.flipForWritingMode(localRect); |
236 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); | 243 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); |
237 | 244 |
238 LayoutRect adjustedFrameRect = LayoutRect(adjustedPaintOffset, frameRect.siz
e()); | 245 LayoutRect adjustedFrameRect = LayoutRect(adjustedPaintOffset, frameRect.siz
e()); |
239 | 246 |
240 LayoutRect adjustedClipRect; | 247 LayoutRect adjustedClipRect; |
241 BorderPaintingType borderPaintingType = getBorderPaintType(adjustedFrameRect
, adjustedClipRect); | 248 BorderPaintingType borderPaintingType = getBorderPaintType(adjustedFrameRect
, adjustedClipRect); |
242 | 249 |
243 DrawingRecorder recorder(*paintInfo.context, m_inlineFlowBox, DisplayItem::B
oxDecorationBackground, pixelSnappedIntRect(cullRect)); | |
244 if (recorder.canUseCachedDrawing()) | |
245 return; | |
246 | |
247 // Shadow comes first and is behind the background and border. | 250 // Shadow comes first and is behind the background and border. |
248 if (!m_inlineFlowBox.boxModelObject()->boxShadowShouldBeAppliedToBackground(
BackgroundBleedNone, &m_inlineFlowBox)) | 251 if (!m_inlineFlowBox.boxModelObject()->boxShadowShouldBeAppliedToBackground(
BackgroundBleedNone, &m_inlineFlowBox)) |
249 paintBoxShadow(paintInfo, *styleToUse, Normal, adjustedFrameRect); | 252 paintBoxShadow(paintInfo, *styleToUse, Normal, adjustedFrameRect); |
250 | 253 |
251 Color backgroundColor = m_inlineFlowBox.layoutObject().resolveColor(*styleTo
Use, CSSPropertyBackgroundColor); | 254 Color backgroundColor = m_inlineFlowBox.layoutObject().resolveColor(*styleTo
Use, CSSPropertyBackgroundColor); |
252 paintFillLayers(paintInfo, backgroundColor, styleToUse->backgroundLayers(),
adjustedFrameRect); | 255 paintFillLayers(paintInfo, backgroundColor, styleToUse->backgroundLayers(),
adjustedFrameRect); |
253 paintBoxShadow(paintInfo, *styleToUse, Inset, adjustedFrameRect); | 256 paintBoxShadow(paintInfo, *styleToUse, Inset, adjustedFrameRect); |
254 | 257 |
255 switch (borderPaintingType) { | 258 switch (borderPaintingType) { |
256 case DontPaintBorders: | 259 case DontPaintBorders: |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 rect.setHeight(logicalHeight); | 354 rect.setHeight(logicalHeight); |
352 } else { | 355 } else { |
353 rect.setX(logicalTop); | 356 rect.setX(logicalTop); |
354 rect.setWidth(logicalHeight); | 357 rect.setWidth(logicalHeight); |
355 } | 358 } |
356 } | 359 } |
357 return rect; | 360 return rect; |
358 } | 361 } |
359 | 362 |
360 } // namespace blink | 363 } // namespace blink |
OLD | NEW |