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/InlinePainter.h" | 6 #include "core/paint/InlinePainter.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/LayoutTheme.h" | 10 #include "core/layout/LayoutTheme.h" |
11 #include "core/layout/line/RootInlineBox.h" | 11 #include "core/layout/line/RootInlineBox.h" |
12 #include "core/paint/BoxPainter.h" | 12 #include "core/paint/BoxPainter.h" |
13 #include "core/paint/LayoutObjectDrawingRecorder.h" | 13 #include "core/paint/LayoutObjectDrawingRecorder.h" |
14 #include "core/paint/LineBoxListPainter.h" | 14 #include "core/paint/LineBoxListPainter.h" |
15 #include "core/paint/ObjectPainter.h" | 15 #include "core/paint/ObjectPainter.h" |
16 #include "core/paint/PaintInfo.h" | 16 #include "core/paint/PaintInfo.h" |
17 #include "platform/geometry/LayoutPoint.h" | 17 #include "platform/geometry/LayoutPoint.h" |
18 #include <limits> | 18 #include <limits> |
19 | 19 |
20 namespace blink { | 20 namespace blink { |
21 | 21 |
22 void InlinePainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 22 void InlinePainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
23 { | 23 { |
24 if (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && !paintInf
o.context->paintController().skippingCache()) { | 24 if (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && !paintInf
o.context.paintController().skippingCache()) { |
25 if (m_layoutInline.paintOffsetChanged(paintOffset)) { | 25 if (m_layoutInline.paintOffsetChanged(paintOffset)) { |
26 paintInfo.context->paintController().invalidatePaintOffset(m_layoutI
nline); | 26 paintInfo.context.paintController().invalidatePaintOffset(m_layoutIn
line); |
27 LineBoxListPainter(*m_layoutInline.lineBoxes()).invalidateLineBoxPai
ntOffsets(paintInfo); | 27 LineBoxListPainter(*m_layoutInline.lineBoxes()).invalidateLineBoxPai
ntOffsets(paintInfo); |
28 } | 28 } |
29 // Set previousPaintOffset here in case that m_layoutInline paints nothi
ng and no | 29 // Set previousPaintOffset here in case that m_layoutInline paints nothi
ng and no |
30 // LayoutObjectDrawingRecorder updates its previousPaintOffset. | 30 // LayoutObjectDrawingRecorder updates its previousPaintOffset. |
31 // TODO(wangxianzhu): Integrate paint offset checking into new paint inv
alidation. | 31 // TODO(wangxianzhu): Integrate paint offset checking into new paint inv
alidation. |
32 m_layoutInline.mutableForPainting().setPreviousPaintOffset(paintOffset); | 32 m_layoutInline.mutableForPainting().setPreviousPaintOffset(paintOffset); |
33 } | 33 } |
34 | 34 |
35 // FIXME: When Skia supports annotation rect covering (https://code.google.c
om/p/skia/issues/detail?id=3872), | 35 // FIXME: When Skia supports annotation rect covering (https://code.google.c
om/p/skia/issues/detail?id=3872), |
36 // this rect may be covered by foreground and descendant drawings. Then we m
ay need a dedicated paint phase. | 36 // this rect may be covered by foreground and descendant drawings. Then we m
ay need a dedicated paint phase. |
37 if (paintInfo.phase == PaintPhaseForeground && paintInfo.isPrinting()) | 37 if (paintInfo.phase == PaintPhaseForeground && paintInfo.isPrinting()) |
38 ObjectPainter(m_layoutInline).addPDFURLRectIfNeeded(paintInfo, paintOffs
et); | 38 ObjectPainter(m_layoutInline).addPDFURLRectIfNeeded(paintInfo, paintOffs
et); |
39 | 39 |
40 if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSel
fOutline || paintInfo.phase == PaintPhaseChildOutlines) { | 40 if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSel
fOutline || paintInfo.phase == PaintPhaseChildOutlines) { |
41 ObjectPainter painter(m_layoutInline); | 41 ObjectPainter painter(m_layoutInline); |
42 if (paintInfo.phase != PaintPhaseSelfOutline) | 42 if (paintInfo.phase != PaintPhaseSelfOutline) |
43 painter.paintInlineChildrenOutlines(paintInfo, paintOffset); | 43 painter.paintInlineChildrenOutlines(paintInfo, paintOffset); |
44 if (paintInfo.phase != PaintPhaseChildOutlines && !m_layoutInline.isElem
entContinuation()) | 44 if (paintInfo.phase != PaintPhaseChildOutlines && !m_layoutInline.isElem
entContinuation()) |
45 painter.paintOutline(paintInfo, paintOffset); | 45 painter.paintOutline(paintInfo, paintOffset); |
46 return; | 46 return; |
47 } | 47 } |
48 | 48 |
49 LineBoxListPainter(*m_layoutInline.lineBoxes()).paint(m_layoutInline, paintI
nfo, paintOffset); | 49 LineBoxListPainter(*m_layoutInline.lineBoxes()).paint(m_layoutInline, paintI
nfo, paintOffset); |
50 } | 50 } |
51 | 51 |
52 } // namespace blink | 52 } // namespace blink |
OLD | NEW |