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/InlineFlowBoxPainter.h" | 5 #include "core/paint/InlineFlowBoxPainter.h" |
6 | 6 |
7 #include "core/layout/api/LineLayoutAPIShim.h" | 7 #include "core/layout/api/LineLayoutAPIShim.h" |
8 #include "core/layout/line/RootInlineBox.h" | 8 #include "core/layout/line/RootInlineBox.h" |
9 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" |
10 #include "core/paint/PaintInfo.h" | 10 #include "core/paint/PaintInfo.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // We have a border image that spans multiple lines. | 165 // We have a border image that spans multiple lines. |
166 adjustedClipRect = pixelSnappedIntRect(clipRectForNinePieceImageStrip(m_
inlineFlowBox, borderImage, adjustedFrameRect)); | 166 adjustedClipRect = pixelSnappedIntRect(clipRectForNinePieceImageStrip(m_
inlineFlowBox, borderImage, adjustedFrameRect)); |
167 return PaintBordersWithClip; | 167 return PaintBordersWithClip; |
168 } | 168 } |
169 return DontPaintBorders; | 169 return DontPaintBorders; |
170 } | 170 } |
171 | 171 |
172 void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintIn
fo, const LayoutPoint& paintOffset, const LayoutRect& cullRect) | 172 void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintIn
fo, const LayoutPoint& paintOffset, const LayoutRect& cullRect) |
173 { | 173 { |
174 ASSERT(paintInfo.phase == PaintPhaseForeground); | 174 ASSERT(paintInfo.phase == PaintPhaseForeground); |
175 if (m_inlineFlowBox.getLineLayoutItem().style()->visibility() != VISIBLE) | 175 if (m_inlineFlowBox.getLineLayoutItem().style()->visibility() != EVisibility
::Visible) |
176 return; | 176 return; |
177 | 177 |
178 // You can use p::first-line to specify a background. If so, the root line b
oxes for | 178 // You can use p::first-line to specify a background. If so, the root line b
oxes for |
179 // a line may actually have to paint a background. | 179 // a line may actually have to paint a background. |
180 LayoutObject* inlineFlowBoxLayoutObject = LineLayoutAPIShim::layoutObjectFro
m(m_inlineFlowBox.getLineLayoutItem()); | 180 LayoutObject* inlineFlowBoxLayoutObject = LineLayoutAPIShim::layoutObjectFro
m(m_inlineFlowBox.getLineLayoutItem()); |
181 const ComputedStyle* styleToUse = m_inlineFlowBox.getLineLayoutItem().style(
m_inlineFlowBox.isFirstLineStyle()); | 181 const ComputedStyle* styleToUse = m_inlineFlowBox.getLineLayoutItem().style(
m_inlineFlowBox.isFirstLineStyle()); |
182 bool shouldPaintBoxDecorationBackground; | 182 bool shouldPaintBoxDecorationBackground; |
183 if (m_inlineFlowBox.parent()) | 183 if (m_inlineFlowBox.parent()) |
184 shouldPaintBoxDecorationBackground = inlineFlowBoxLayoutObject->hasBoxDe
corationBackground(); | 184 shouldPaintBoxDecorationBackground = inlineFlowBoxLayoutObject->hasBoxDe
corationBackground(); |
185 else | 185 else |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff
set, frameRect.size(), LTR); | 225 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff
set, frameRect.size(), LTR); |
226 GraphicsContextStateSaver stateSaver(paintInfo.context); | 226 GraphicsContextStateSaver stateSaver(paintInfo.context); |
227 paintInfo.context.clip(adjustedClipRect); | 227 paintInfo.context.clip(adjustedClipRect); |
228 BoxPainter::paintBorder(*toLayoutBoxModelObject(LineLayoutAPIShim::layou
tObjectFrom(m_inlineFlowBox.boxModelObject())), paintInfo, imageStripPaintRect,
m_inlineFlowBox.getLineLayoutItem().styleRef(m_inlineFlowBox.isFirstLineStyle())
); | 228 BoxPainter::paintBorder(*toLayoutBoxModelObject(LineLayoutAPIShim::layou
tObjectFrom(m_inlineFlowBox.boxModelObject())), paintInfo, imageStripPaintRect,
m_inlineFlowBox.getLineLayoutItem().styleRef(m_inlineFlowBox.isFirstLineStyle())
); |
229 break; | 229 break; |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
233 void InlineFlowBoxPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoi
nt& paintOffset) | 233 void InlineFlowBoxPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoi
nt& paintOffset) |
234 { | 234 { |
235 if (m_inlineFlowBox.getLineLayoutItem().style()->visibility() != VISIBLE ||
paintInfo.phase != PaintPhaseMask) | 235 if (m_inlineFlowBox.getLineLayoutItem().style()->visibility() != EVisibility
::Visible || paintInfo.phase != PaintPhaseMask) |
236 return; | 236 return; |
237 | 237 |
238 LayoutRect frameRect = frameRectClampedToLineTopAndBottomIfNeeded(); | 238 LayoutRect frameRect = frameRectClampedToLineTopAndBottomIfNeeded(); |
239 | 239 |
240 // Move x/y to our coordinates. | 240 // Move x/y to our coordinates. |
241 LayoutRect localRect(frameRect); | 241 LayoutRect localRect(frameRect); |
242 m_inlineFlowBox.flipForWritingMode(localRect); | 242 m_inlineFlowBox.flipForWritingMode(localRect); |
243 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); | 243 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); |
244 | 244 |
245 const NinePieceImage& maskNinePieceImage = m_inlineFlowBox.getLineLayoutItem
().style()->maskBoxImage(); | 245 const NinePieceImage& maskNinePieceImage = m_inlineFlowBox.getLineLayoutItem
().style()->maskBoxImage(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 rect.setHeight(logicalHeight); | 313 rect.setHeight(logicalHeight); |
314 } else { | 314 } else { |
315 rect.setX(logicalTop); | 315 rect.setX(logicalTop); |
316 rect.setWidth(logicalHeight); | 316 rect.setWidth(logicalHeight); |
317 } | 317 } |
318 } | 318 } |
319 return rect; | 319 return rect; |
320 } | 320 } |
321 | 321 |
322 } // namespace blink | 322 } // namespace blink |
OLD | NEW |