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 14 matching lines...) Expand all Loading... |
25 ASSERT(paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhase
SelfOutline && paintInfo.phase != PaintPhaseChildOutlines); | 25 ASSERT(paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhase
SelfOutline && paintInfo.phase != PaintPhaseChildOutlines); |
26 | 26 |
27 LayoutRect overflowRect(m_inlineFlowBox.visualOverflowRect(lineTop, lineBott
om)); | 27 LayoutRect overflowRect(m_inlineFlowBox.visualOverflowRect(lineTop, lineBott
om)); |
28 m_inlineFlowBox.flipForWritingMode(overflowRect); | 28 m_inlineFlowBox.flipForWritingMode(overflowRect); |
29 overflowRect.moveBy(paintOffset); | 29 overflowRect.moveBy(paintOffset); |
30 | 30 |
31 if (!paintInfo.cullRect().intersectsCullRect(overflowRect)) | 31 if (!paintInfo.cullRect().intersectsCullRect(overflowRect)) |
32 return; | 32 return; |
33 | 33 |
34 if (paintInfo.phase == PaintPhaseMask) { | 34 if (paintInfo.phase == PaintPhaseMask) { |
35 if (DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_in
lineFlowBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase))) | 35 if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_inl
ineFlowBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase))) |
36 return; | 36 return; |
37 DrawingRecorder recorder(*paintInfo.context, m_inlineFlowBox, DisplayIte
m::paintPhaseToDrawingType(paintInfo.phase), pixelSnappedIntRect(overflowRect)); | 37 DrawingRecorder recorder(paintInfo.context, m_inlineFlowBox, DisplayItem
::paintPhaseToDrawingType(paintInfo.phase), pixelSnappedIntRect(overflowRect)); |
38 paintMask(paintInfo, paintOffset); | 38 paintMask(paintInfo, paintOffset); |
39 return; | 39 return; |
40 } | 40 } |
41 | 41 |
42 if (paintInfo.phase == PaintPhaseForeground) { | 42 if (paintInfo.phase == PaintPhaseForeground) { |
43 // Paint our background, border and box-shadow. | 43 // Paint our background, border and box-shadow. |
44 paintBoxDecorationBackground(paintInfo, paintOffset, overflowRect); | 44 paintBoxDecorationBackground(paintInfo, paintOffset, overflowRect); |
45 } | 45 } |
46 | 46 |
47 // Paint our children. | 47 // Paint our children. |
(...skipping 19 matching lines...) Expand all Loading... |
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::paintFillLayerExtended(*boxModel, paintInfo, c, fillLayer, r
ect, BackgroundBleedNone, &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::paintFillLayerExtended(*boxModel, paintInfo, c, fillLayer, r
ect, BackgroundBleedNone, &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::paintFillLayerExtended(*boxModel, paintInfo, c, fillLayer, i
mageStripPaintRect, 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 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 const ComputedStyle* styleToUse = m_inlineFlowBox.lineLayoutItem().style(m_i
nlineFlowBox.isFirstLineStyle()); | 191 const ComputedStyle* styleToUse = m_inlineFlowBox.lineLayoutItem().style(m_i
nlineFlowBox.isFirstLineStyle()); |
192 bool shouldPaintBoxDecorationBackground; | 192 bool shouldPaintBoxDecorationBackground; |
193 if (m_inlineFlowBox.parent()) | 193 if (m_inlineFlowBox.parent()) |
194 shouldPaintBoxDecorationBackground = m_inlineFlowBox.layoutObject().hasB
oxDecorationBackground(); | 194 shouldPaintBoxDecorationBackground = m_inlineFlowBox.layoutObject().hasB
oxDecorationBackground(); |
195 else | 195 else |
196 shouldPaintBoxDecorationBackground = m_inlineFlowBox.isFirstLineStyle()
&& styleToUse != m_inlineFlowBox.lineLayoutItem().style(); | 196 shouldPaintBoxDecorationBackground = m_inlineFlowBox.isFirstLineStyle()
&& styleToUse != m_inlineFlowBox.lineLayoutItem().style(); |
197 | 197 |
198 if (!shouldPaintBoxDecorationBackground) | 198 if (!shouldPaintBoxDecorationBackground) |
199 return; | 199 return; |
200 | 200 |
201 if (DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_inline
FlowBox, DisplayItem::BoxDecorationBackground)) | 201 if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_inlineF
lowBox, DisplayItem::BoxDecorationBackground)) |
202 return; | 202 return; |
203 | 203 |
204 DrawingRecorder recorder(*paintInfo.context, m_inlineFlowBox, DisplayItem::B
oxDecorationBackground, pixelSnappedIntRect(cullRect)); | 204 DrawingRecorder recorder(paintInfo.context, m_inlineFlowBox, DisplayItem::Bo
xDecorationBackground, pixelSnappedIntRect(cullRect)); |
205 | 205 |
206 LayoutRect frameRect = frameRectClampedToLineTopAndBottomIfNeeded(); | 206 LayoutRect frameRect = frameRectClampedToLineTopAndBottomIfNeeded(); |
207 | 207 |
208 // Move x/y to our coordinates. | 208 // Move x/y to our coordinates. |
209 LayoutRect localRect(frameRect); | 209 LayoutRect localRect(frameRect); |
210 m_inlineFlowBox.flipForWritingMode(localRect); | 210 m_inlineFlowBox.flipForWritingMode(localRect); |
211 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); | 211 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); |
212 | 212 |
213 LayoutRect adjustedFrameRect = LayoutRect(adjustedPaintOffset, frameRect.siz
e()); | 213 LayoutRect adjustedFrameRect = LayoutRect(adjustedPaintOffset, frameRect.siz
e()); |
214 | 214 |
(...skipping 11 matching lines...) Expand all Loading... |
226 switch (borderPaintingType) { | 226 switch (borderPaintingType) { |
227 case DontPaintBorders: | 227 case DontPaintBorders: |
228 break; | 228 break; |
229 case PaintBordersWithoutClip: | 229 case PaintBordersWithoutClip: |
230 BoxPainter::paintBorder(*toLayoutBoxModelObject(LineLayoutPaintShim::lay
outObjectFrom(m_inlineFlowBox.boxModelObject())), paintInfo, adjustedFrameRect,
m_inlineFlowBox.lineLayoutItem().styleRef(m_inlineFlowBox.isFirstLineStyle()), B
ackgroundBleedNone, m_inlineFlowBox.includeLogicalLeftEdge(), m_inlineFlowBox.in
cludeLogicalRightEdge()); | 230 BoxPainter::paintBorder(*toLayoutBoxModelObject(LineLayoutPaintShim::lay
outObjectFrom(m_inlineFlowBox.boxModelObject())), paintInfo, adjustedFrameRect,
m_inlineFlowBox.lineLayoutItem().styleRef(m_inlineFlowBox.isFirstLineStyle()), B
ackgroundBleedNone, m_inlineFlowBox.includeLogicalLeftEdge(), m_inlineFlowBox.in
cludeLogicalRightEdge()); |
231 break; | 231 break; |
232 case PaintBordersWithClip: | 232 case PaintBordersWithClip: |
233 // FIXME: What the heck do we do with RTL here? The math we're using is
obviously not right, | 233 // FIXME: What the heck do we do with RTL here? The math we're using is
obviously not right, |
234 // but it isn't even clear how this should work at all. | 234 // but it isn't even clear how this should work at all. |
235 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff
set, frameRect.size(), LTR); | 235 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff
set, frameRect.size(), LTR); |
236 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 236 GraphicsContextStateSaver stateSaver(paintInfo.context); |
237 paintInfo.context->clip(adjustedClipRect); | 237 paintInfo.context.clip(adjustedClipRect); |
238 BoxPainter::paintBorder(*toLayoutBoxModelObject(LineLayoutPaintShim::lay
outObjectFrom(m_inlineFlowBox.boxModelObject())), paintInfo, imageStripPaintRect
, m_inlineFlowBox.lineLayoutItem().styleRef(m_inlineFlowBox.isFirstLineStyle()))
; | 238 BoxPainter::paintBorder(*toLayoutBoxModelObject(LineLayoutPaintShim::lay
outObjectFrom(m_inlineFlowBox.boxModelObject())), paintInfo, imageStripPaintRect
, m_inlineFlowBox.lineLayoutItem().styleRef(m_inlineFlowBox.isFirstLineStyle()))
; |
239 break; | 239 break; |
240 } | 240 } |
241 } | 241 } |
242 | 242 |
243 void InlineFlowBoxPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoi
nt& paintOffset) | 243 void InlineFlowBoxPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoi
nt& paintOffset) |
244 { | 244 { |
245 if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.layoutObject()) || m_i
nlineFlowBox.lineLayoutItem().style()->visibility() != VISIBLE || paintInfo.phas
e != PaintPhaseMask) | 245 if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.layoutObject()) || m_i
nlineFlowBox.lineLayoutItem().style()->visibility() != VISIBLE || paintInfo.phas
e != PaintPhaseMask) |
246 return; | 246 return; |
247 | 247 |
248 LayoutRect frameRect = frameRectClampedToLineTopAndBottomIfNeeded(); | 248 LayoutRect frameRect = frameRectClampedToLineTopAndBottomIfNeeded(); |
249 | 249 |
250 // Move x/y to our coordinates. | 250 // Move x/y to our coordinates. |
251 LayoutRect localRect(frameRect); | 251 LayoutRect localRect(frameRect); |
252 m_inlineFlowBox.flipForWritingMode(localRect); | 252 m_inlineFlowBox.flipForWritingMode(localRect); |
253 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); | 253 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); |
254 | 254 |
255 const NinePieceImage& maskNinePieceImage = m_inlineFlowBox.lineLayoutItem().
style()->maskBoxImage(); | 255 const NinePieceImage& maskNinePieceImage = m_inlineFlowBox.lineLayoutItem().
style()->maskBoxImage(); |
256 StyleImage* maskBoxImage = m_inlineFlowBox.lineLayoutItem().style()->maskBox
Image().image(); | 256 StyleImage* maskBoxImage = m_inlineFlowBox.lineLayoutItem().style()->maskBox
Image().image(); |
257 | 257 |
258 // Figure out if we need to push a transparency layer to render our mask. | 258 // Figure out if we need to push a transparency layer to render our mask. |
259 bool pushTransparencyLayer = false; | 259 bool pushTransparencyLayer = false; |
260 bool compositedMask = m_inlineFlowBox.lineLayoutItem().hasLayer() && m_inlin
eFlowBox.boxModelObject().layer()->hasCompositedMask(); | 260 bool compositedMask = m_inlineFlowBox.lineLayoutItem().hasLayer() && m_inlin
eFlowBox.boxModelObject().layer()->hasCompositedMask(); |
261 bool flattenCompositingLayers = paintInfo.globalPaintFlags() & GlobalPaintFl
attenCompositingLayers; | 261 bool flattenCompositingLayers = paintInfo.globalPaintFlags() & GlobalPaintFl
attenCompositingLayers; |
262 SkXfermode::Mode compositeOp = SkXfermode::kSrcOver_Mode; | 262 SkXfermode::Mode compositeOp = SkXfermode::kSrcOver_Mode; |
263 if (!compositedMask || flattenCompositingLayers) { | 263 if (!compositedMask || flattenCompositingLayers) { |
264 if ((maskBoxImage && m_inlineFlowBox.lineLayoutItem().style()->maskLayer
s().hasImage()) || m_inlineFlowBox.lineLayoutItem().style()->maskLayers().next()
) { | 264 if ((maskBoxImage && m_inlineFlowBox.lineLayoutItem().style()->maskLayer
s().hasImage()) || m_inlineFlowBox.lineLayoutItem().style()->maskLayers().next()
) { |
265 pushTransparencyLayer = true; | 265 pushTransparencyLayer = true; |
266 paintInfo.context->beginLayer(1.0f, SkXfermode::kDstIn_Mode); | 266 paintInfo.context.beginLayer(1.0f, SkXfermode::kDstIn_Mode); |
267 } else { | 267 } else { |
268 // TODO(fmalita): passing a dst-in xfer mode down to paintFillLayers
/paintNinePieceImage | 268 // TODO(fmalita): passing a dst-in xfer mode down to paintFillLayers
/paintNinePieceImage |
269 // seems dangerous: it is only correct if applied atomically (sing
le draw call). While | 269 // seems dangerous: it is only correct if applied atomically (sing
le draw call). While |
270 // the heuristic above presumably ensures that is the case, this a
pproach seems super | 270 // the heuristic above presumably ensures that is the case, this a
pproach seems super |
271 // fragile. We should investigate dropping this optimization in fa
vour of the more | 271 // fragile. We should investigate dropping this optimization in fa
vour of the more |
272 // robust layer branch above. | 272 // robust layer branch above. |
273 compositeOp = SkXfermode::kDstIn_Mode; | 273 compositeOp = SkXfermode::kDstIn_Mode; |
274 } | 274 } |
275 } | 275 } |
276 | 276 |
277 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, frameRect.size()); | 277 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, frameRect.size()); |
278 paintFillLayers(paintInfo, Color::transparent, m_inlineFlowBox.lineLayoutIte
m().style()->maskLayers(), paintRect, compositeOp); | 278 paintFillLayers(paintInfo, Color::transparent, m_inlineFlowBox.lineLayoutIte
m().style()->maskLayers(), paintRect, compositeOp); |
279 | 279 |
280 bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(); | 280 bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(); |
281 if (!hasBoxImage || !maskBoxImage->isLoaded()) { | 281 if (!hasBoxImage || !maskBoxImage->isLoaded()) { |
282 if (pushTransparencyLayer) | 282 if (pushTransparencyLayer) |
283 paintInfo.context->endLayer(); | 283 paintInfo.context.endLayer(); |
284 return; // Don't paint anything while we wait for the image to load. | 284 return; // Don't paint anything while we wait for the image to load. |
285 } | 285 } |
286 | 286 |
287 LayoutBoxModelObject* boxModel = toLayoutBoxModelObject(LineLayoutPaintShim:
:layoutObjectFrom(m_inlineFlowBox.boxModelObject())); | 287 LayoutBoxModelObject* boxModel = toLayoutBoxModelObject(LineLayoutPaintShim:
:layoutObjectFrom(m_inlineFlowBox.boxModelObject())); |
288 // The simple case is where we are the only box for this object. In those | 288 // The simple case is where we are the only box for this object. In those |
289 // cases only a single call to draw is required. | 289 // cases only a single call to draw is required. |
290 if (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) { | 290 if (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) { |
291 BoxPainter::paintNinePieceImage(*boxModel, paintInfo.context, paintRect,
m_inlineFlowBox.lineLayoutItem().styleRef(), maskNinePieceImage, compositeOp); | 291 BoxPainter::paintNinePieceImage(*boxModel, paintInfo.context, paintRect,
m_inlineFlowBox.lineLayoutItem().styleRef(), maskNinePieceImage, compositeOp); |
292 } else { | 292 } else { |
293 // We have a mask image that spans multiple lines. | 293 // We have a mask image that spans multiple lines. |
294 // FIXME: What the heck do we do with RTL here? The math we're using is
obviously not right, | 294 // FIXME: What the heck do we do with RTL here? The math we're using is
obviously not right, |
295 // but it isn't even clear how this should work at all. | 295 // but it isn't even clear how this should work at all. |
296 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff
set, frameRect.size(), LTR); | 296 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff
set, frameRect.size(), LTR); |
297 FloatRect clipRect(clipRectForNinePieceImageStrip(m_inlineFlowBox, maskN
inePieceImage, paintRect)); | 297 FloatRect clipRect(clipRectForNinePieceImageStrip(m_inlineFlowBox, maskN
inePieceImage, paintRect)); |
298 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 298 GraphicsContextStateSaver stateSaver(paintInfo.context); |
299 // TODO(chrishtr): this should be pixel-snapped. | 299 // TODO(chrishtr): this should be pixel-snapped. |
300 paintInfo.context->clip(clipRect); | 300 paintInfo.context.clip(clipRect); |
301 BoxPainter::paintNinePieceImage(*boxModel, paintInfo.context, imageStrip
PaintRect, m_inlineFlowBox.lineLayoutItem().styleRef(), maskNinePieceImage, comp
ositeOp); | 301 BoxPainter::paintNinePieceImage(*boxModel, paintInfo.context, imageStrip
PaintRect, m_inlineFlowBox.lineLayoutItem().styleRef(), maskNinePieceImage, comp
ositeOp); |
302 } | 302 } |
303 | 303 |
304 if (pushTransparencyLayer) | 304 if (pushTransparencyLayer) |
305 paintInfo.context->endLayer(); | 305 paintInfo.context.endLayer(); |
306 } | 306 } |
307 | 307 |
308 // This method should not be needed. See crbug.com/530659. | 308 // This method should not be needed. See crbug.com/530659. |
309 LayoutRect InlineFlowBoxPainter::frameRectClampedToLineTopAndBottomIfNeeded() co
nst | 309 LayoutRect InlineFlowBoxPainter::frameRectClampedToLineTopAndBottomIfNeeded() co
nst |
310 { | 310 { |
311 LayoutRect rect(m_inlineFlowBox.frameRect()); | 311 LayoutRect rect(m_inlineFlowBox.frameRect()); |
312 | 312 |
313 bool noQuirksMode = m_inlineFlowBox.lineLayoutItem().document().inNoQuirksMo
de(); | 313 bool noQuirksMode = m_inlineFlowBox.lineLayoutItem().document().inNoQuirksMo
de(); |
314 if (!noQuirksMode && !m_inlineFlowBox.hasTextChildren() && !(m_inlineFlowBox
.descendantsHaveSameLineHeightAndBaseline() && m_inlineFlowBox.hasTextDescendant
s())) { | 314 if (!noQuirksMode && !m_inlineFlowBox.hasTextChildren() && !(m_inlineFlowBox
.descendantsHaveSameLineHeightAndBaseline() && m_inlineFlowBox.hasTextDescendant
s())) { |
315 const RootInlineBox& rootBox = m_inlineFlowBox.root(); | 315 const RootInlineBox& rootBox = m_inlineFlowBox.root(); |
316 LayoutUnit logicalTop = m_inlineFlowBox.isHorizontal() ? rect.y() : rect
.x(); | 316 LayoutUnit logicalTop = m_inlineFlowBox.isHorizontal() ? rect.y() : rect
.x(); |
317 LayoutUnit logicalHeight = m_inlineFlowBox.isHorizontal() ? rect.height(
) : rect.width(); | 317 LayoutUnit logicalHeight = m_inlineFlowBox.isHorizontal() ? rect.height(
) : rect.width(); |
318 LayoutUnit bottom = std::min(rootBox.lineBottom(), logicalTop + logicalH
eight); | 318 LayoutUnit bottom = std::min(rootBox.lineBottom(), logicalTop + logicalH
eight); |
319 logicalTop = std::max(rootBox.lineTop(), logicalTop); | 319 logicalTop = std::max(rootBox.lineTop(), logicalTop); |
320 logicalHeight = bottom - logicalTop; | 320 logicalHeight = bottom - logicalTop; |
321 if (m_inlineFlowBox.isHorizontal()) { | 321 if (m_inlineFlowBox.isHorizontal()) { |
322 rect.setY(logicalTop); | 322 rect.setY(logicalTop); |
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 |