| 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 "core/paint/InlinePainter.h" | 5 #include "core/paint/InlinePainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutBlock.h" | 7 #include "core/layout/LayoutBlock.h" |
| 8 #include "core/layout/LayoutInline.h" | 8 #include "core/layout/LayoutInline.h" |
| 9 #include "core/layout/LayoutTheme.h" | 9 #include "core/layout/LayoutTheme.h" |
| 10 #include "core/layout/line/RootInlineBox.h" | 10 #include "core/layout/line/RootInlineBox.h" |
| 11 #include "core/paint/BoxPainter.h" | 11 #include "core/paint/BoxPainter.h" |
| 12 #include "core/paint/LayoutObjectDrawingRecorder.h" | 12 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 13 #include "core/paint/LineBoxListPainter.h" | 13 #include "core/paint/LineBoxListPainter.h" |
| 14 #include "core/paint/ObjectPainter.h" | 14 #include "core/paint/ObjectPainter.h" |
| 15 #include "core/paint/PaintInfo.h" | 15 #include "core/paint/PaintInfo.h" |
| 16 #include "platform/geometry/LayoutPoint.h" | 16 #include "platform/geometry/LayoutPoint.h" |
| 17 #include <limits> | 17 #include <limits> |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 void InlinePainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 21 void InlinePainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
| 22 { | 22 { |
| 23 if (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && !paintInf
o.context.paintController().skippingCache()) { | |
| 24 if (m_layoutInline.paintOffsetChanged(paintOffset)) { | |
| 25 paintInfo.context.paintController().invalidatePaintOffset(m_layoutIn
line); | |
| 26 LineBoxListPainter(*m_layoutInline.lineBoxes()).invalidateLineBoxPai
ntOffsets(paintInfo); | |
| 27 } | |
| 28 // Set previousPaintOffset here in case that m_layoutInline paints nothi
ng and no | |
| 29 // LayoutObjectDrawingRecorder updates its previousPaintOffset. | |
| 30 // TODO(wangxianzhu): Integrate paint offset checking into new paint inv
alidation. | |
| 31 m_layoutInline.mutableForPainting().setPreviousPaintOffset(paintOffset); | |
| 32 } | |
| 33 | |
| 34 if (paintInfo.phase == PaintPhaseForeground && paintInfo.isPrinting()) | 23 if (paintInfo.phase == PaintPhaseForeground && paintInfo.isPrinting()) |
| 35 ObjectPainter(m_layoutInline).addPDFURLRectIfNeeded(paintInfo, paintOffs
et); | 24 ObjectPainter(m_layoutInline).addPDFURLRectIfNeeded(paintInfo, paintOffs
et); |
| 36 | 25 |
| 37 if (shouldPaintSelfOutline(paintInfo.phase) || shouldPaintDescendantOutlines
(paintInfo.phase)) { | 26 if (shouldPaintSelfOutline(paintInfo.phase) || shouldPaintDescendantOutlines
(paintInfo.phase)) { |
| 38 ObjectPainter painter(m_layoutInline); | 27 ObjectPainter painter(m_layoutInline); |
| 39 if (shouldPaintDescendantOutlines(paintInfo.phase)) | 28 if (shouldPaintDescendantOutlines(paintInfo.phase)) |
| 40 painter.paintInlineChildrenOutlines(paintInfo, paintOffset); | 29 painter.paintInlineChildrenOutlines(paintInfo, paintOffset); |
| 41 if (shouldPaintSelfOutline(paintInfo.phase) && !m_layoutInline.isElement
Continuation()) | 30 if (shouldPaintSelfOutline(paintInfo.phase) && !m_layoutInline.isElement
Continuation()) |
| 42 painter.paintOutline(paintInfo, paintOffset); | 31 painter.paintOutline(paintInfo, paintOffset); |
| 43 return; | 32 return; |
| 44 } | 33 } |
| 45 | 34 |
| 46 LineBoxListPainter(*m_layoutInline.lineBoxes()).paint(m_layoutInline, paintI
nfo, paintOffset); | 35 LineBoxListPainter(*m_layoutInline.lineBoxes()).paint(m_layoutInline, paintI
nfo, paintOffset); |
| 47 } | 36 } |
| 48 | 37 |
| 49 } // namespace blink | 38 } // namespace blink |
| OLD | NEW |