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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 paintFillLayers(paintInfo, c, *fillLayer.next(), rect, op); | 65 paintFillLayers(paintInfo, c, *fillLayer.next(), rect, op); |
66 paintFillLayer(paintInfo, c, fillLayer, rect, op); | 66 paintFillLayer(paintInfo, c, fillLayer, rect, op); |
67 } | 67 } |
68 | 68 |
69 void InlineFlowBoxPainter::paintFillLayer(const PaintInfo& paintInfo, const Colo
r& c, const FillLayer& fillLayer, const LayoutRect& rect, SkXfermode::Mode op) | 69 void InlineFlowBoxPainter::paintFillLayer(const PaintInfo& paintInfo, const Colo
r& c, const FillLayer& fillLayer, const LayoutRect& rect, SkXfermode::Mode op) |
70 { | 70 { |
71 LayoutBoxModelObject* boxModel = toLayoutBoxModelObject(LineLayoutPaintShim:
:layoutObjectFrom(m_inlineFlowBox.boxModelObject())); | 71 LayoutBoxModelObject* boxModel = toLayoutBoxModelObject(LineLayoutPaintShim:
:layoutObjectFrom(m_inlineFlowBox.boxModelObject())); |
72 StyleImage* img = fillLayer.image(); | 72 StyleImage* img = fillLayer.image(); |
73 bool hasFillImage = img && img->canRender(); | 73 bool hasFillImage = img && img->canRender(); |
74 if ((!hasFillImage && !m_inlineFlowBox.lineLayoutItem().style()->hasBorderRa
dius()) || (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) ||
!m_inlineFlowBox.parent()) { | 74 if ((!hasFillImage && !m_inlineFlowBox.lineLayoutItem().style()->hasBorderRa
dius()) || (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) ||
!m_inlineFlowBox.parent()) { |
75 BoxPainter::paintFillLayerExtended(*boxModel, paintInfo, c, fillLayer, r
ect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op); | 75 BoxPainter::paintFillLayer(*boxModel, paintInfo, c, fillLayer, rect, Bac
kgroundBleedNone, &m_inlineFlowBox, rect.size(), op); |
76 } else if (m_inlineFlowBox.lineLayoutItem().style()->boxDecorationBreak() ==
DCLONE) { | 76 } else if (m_inlineFlowBox.lineLayoutItem().style()->boxDecorationBreak() ==
DCLONE) { |
77 GraphicsContextStateSaver stateSaver(paintInfo.context); | 77 GraphicsContextStateSaver stateSaver(paintInfo.context); |
78 paintInfo.context.clip(pixelSnappedIntRect(rect)); | 78 paintInfo.context.clip(pixelSnappedIntRect(rect)); |
79 BoxPainter::paintFillLayerExtended(*boxModel, paintInfo, c, fillLayer, r
ect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op); | 79 BoxPainter::paintFillLayer(*boxModel, paintInfo, c, fillLayer, rect, Bac
kgroundBleedNone, &m_inlineFlowBox, rect.size(), op); |
80 } else { | 80 } else { |
81 // We have a fill image that spans multiple lines. | 81 // We have a fill image that spans multiple lines. |
82 // FIXME: frameSize ought to be the same as rect.size(). | 82 // FIXME: frameSize ought to be the same as rect.size(). |
83 LayoutSize frameSize(m_inlineFlowBox.width(), m_inlineFlowBox.height()); | 83 LayoutSize frameSize(m_inlineFlowBox.width(), m_inlineFlowBox.height()); |
84 LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(),
frameSize, m_inlineFlowBox.lineLayoutItem().style()->direction()); | 84 LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(),
frameSize, m_inlineFlowBox.lineLayoutItem().style()->direction()); |
85 GraphicsContextStateSaver stateSaver(paintInfo.context); | 85 GraphicsContextStateSaver stateSaver(paintInfo.context); |
86 // TODO(chrishtr): this should likely be pixel-snapped. | 86 // TODO(chrishtr): this should likely be pixel-snapped. |
87 paintInfo.context.clip(pixelSnappedIntRect(rect)); | 87 paintInfo.context.clip(pixelSnappedIntRect(rect)); |
88 BoxPainter::paintFillLayerExtended(*boxModel, paintInfo, c, fillLayer, i
mageStripPaintRect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op); | 88 BoxPainter::paintFillLayer(*boxModel, paintInfo, c, fillLayer, imageStri
pPaintRect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op); |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 void InlineFlowBoxPainter::paintBoxShadow(const PaintInfo& info, const ComputedS
tyle& s, ShadowStyle shadowStyle, const LayoutRect& paintRect) | 92 void InlineFlowBoxPainter::paintBoxShadow(const PaintInfo& info, const ComputedS
tyle& s, ShadowStyle shadowStyle, const LayoutRect& paintRect) |
93 { | 93 { |
94 if ((!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || !m
_inlineFlowBox.parent()) { | 94 if ((!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || !m
_inlineFlowBox.parent()) { |
95 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle); | 95 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle); |
96 } else { | 96 } else { |
97 // FIXME: We can do better here in the multi-line case. We want to push
a clip so that the shadow doesn't | 97 // FIXME: We can do better here in the multi-line case. We want to push
a clip so that the shadow doesn't |
98 // protrude incorrectly at the edges, and we want to possibly include sh
adows cast from the previous/following lines | 98 // protrude incorrectly at the edges, and we want to possibly include sh
adows cast from the previous/following lines |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 rect.setHeight(logicalHeight); | 323 rect.setHeight(logicalHeight); |
324 } else { | 324 } else { |
325 rect.setX(logicalTop); | 325 rect.setX(logicalTop); |
326 rect.setWidth(logicalHeight); | 326 rect.setWidth(logicalHeight); |
327 } | 327 } |
328 } | 328 } |
329 return rect; | 329 return rect; |
330 } | 330 } |
331 | 331 |
332 } // namespace blink | 332 } // namespace blink |
OLD | NEW |