| 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 26 matching lines...) Expand all Loading... |
| 37 bool containingBlockPaintsContinuationOutline = inlineFlow.continuat
ion() || inlineFlow.isInlineElementContinuation(); | 37 bool containingBlockPaintsContinuationOutline = inlineFlow.continuat
ion() || inlineFlow.isInlineElementContinuation(); |
| 38 if (containingBlockPaintsContinuationOutline) { | 38 if (containingBlockPaintsContinuationOutline) { |
| 39 // FIXME: See https://bugs.webkit.org/show_bug.cgi?id=54690. We
currently don't reconnect inline continuations | 39 // FIXME: See https://bugs.webkit.org/show_bug.cgi?id=54690. We
currently don't reconnect inline continuations |
| 40 // after a child removal. As a result, those merged inlines do n
ot get seperated and hence not get enclosed by | 40 // after a child removal. As a result, those merged inlines do n
ot get seperated and hence not get enclosed by |
| 41 // anonymous blocks. In this case, it is better to bail out and
paint it ourself. | 41 // anonymous blocks. In this case, it is better to bail out and
paint it ourself. |
| 42 LayoutBlock* enclosingAnonymousBlock = m_inlineFlowBox.layoutObj
ect().containingBlock(); | 42 LayoutBlock* enclosingAnonymousBlock = m_inlineFlowBox.layoutObj
ect().containingBlock(); |
| 43 if (!enclosingAnonymousBlock->isAnonymousBlock()) { | 43 if (!enclosingAnonymousBlock->isAnonymousBlock()) { |
| 44 containingBlockPaintsContinuationOutline = false; | 44 containingBlockPaintsContinuationOutline = false; |
| 45 } else { | 45 } else { |
| 46 cb = enclosingAnonymousBlock->containingBlock(); | 46 cb = enclosingAnonymousBlock->containingBlock(); |
| 47 for (LayoutBoxModelObject* box = m_inlineFlowBox.boxModelObj
ect(); box != cb; box = box->parent()->enclosingBoxModelObject()) { | 47 for (LayoutBoxModelObject* box = m_inlineFlowBox.deprecatedB
oxModelObject(); box != cb; box = box->parent()->enclosingBoxModelObject()) { |
| 48 if (box->hasSelfPaintingLayer()) { | 48 if (box->hasSelfPaintingLayer()) { |
| 49 containingBlockPaintsContinuationOutline = false; | 49 containingBlockPaintsContinuationOutline = false; |
| 50 break; | 50 break; |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 if (containingBlockPaintsContinuationOutline) { | 56 if (containingBlockPaintsContinuationOutline) { |
| 57 // Add ourselves to the containing block of the entire continuat
ion so that it can | 57 // Add ourselves to the containing block of the entire continuat
ion so that it can |
| (...skipping 19 matching lines...) Expand all Loading... |
| 77 if (paintInfo.phase != PaintPhaseSelfOutline) { | 77 if (paintInfo.phase != PaintPhaseSelfOutline) { |
| 78 PaintInfo childInfo(paintInfo); | 78 PaintInfo childInfo(paintInfo); |
| 79 childInfo.phase = paintInfo.phase == PaintPhaseChildOutlines ? PaintPhas
eOutline : paintInfo.phase; | 79 childInfo.phase = paintInfo.phase == PaintPhaseChildOutlines ? PaintPhas
eOutline : paintInfo.phase; |
| 80 | 80 |
| 81 if (childInfo.paintingRoot && childInfo.paintingRoot->isDescendantOf(&m_
inlineFlowBox.layoutObject())) | 81 if (childInfo.paintingRoot && childInfo.paintingRoot->isDescendantOf(&m_
inlineFlowBox.layoutObject())) |
| 82 childInfo.paintingRoot = 0; | 82 childInfo.paintingRoot = 0; |
| 83 else | 83 else |
| 84 childInfo.updatePaintingRootForChildren(&m_inlineFlowBox.layoutObjec
t()); | 84 childInfo.updatePaintingRootForChildren(&m_inlineFlowBox.layoutObjec
t()); |
| 85 | 85 |
| 86 for (InlineBox* curr = m_inlineFlowBox.firstChild(); curr; curr = curr->
nextOnLine()) { | 86 for (InlineBox* curr = m_inlineFlowBox.firstChild(); curr; curr = curr->
nextOnLine()) { |
| 87 if (curr->layoutObject().isText() || !curr->boxModelObject()->hasSel
fPaintingLayer()) | 87 if (curr->layoutObject().isText() || !curr->deprecatedBoxModelObject
()->hasSelfPaintingLayer()) |
| 88 curr->paint(childInfo, paintOffset, lineTop, lineBottom); | 88 curr->paint(childInfo, paintOffset, lineTop, lineBottom); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 void InlineFlowBoxPainter::paintFillLayers(const PaintInfo& paintInfo, const Col
or& c, const FillLayer& fillLayer, const LayoutRect& rect, SkXfermode::Mode op) | 93 void InlineFlowBoxPainter::paintFillLayers(const PaintInfo& paintInfo, const Col
or& c, const FillLayer& fillLayer, const LayoutRect& rect, SkXfermode::Mode op) |
| 94 { | 94 { |
| 95 // FIXME: This should be a for loop or similar. It's a little non-trivial to
do so, however, since the layers need to be | 95 // FIXME: This should be a for loop or similar. It's a little non-trivial to
do so, however, since the layers need to be |
| 96 // painted in reverse order. | 96 // painted in reverse order. |
| 97 if (fillLayer.next()) | 97 if (fillLayer.next()) |
| 98 paintFillLayers(paintInfo, c, *fillLayer.next(), rect, op); | 98 paintFillLayers(paintInfo, c, *fillLayer.next(), rect, op); |
| 99 paintFillLayer(paintInfo, c, fillLayer, rect, op); | 99 paintFillLayer(paintInfo, c, fillLayer, rect, op); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void InlineFlowBoxPainter::paintFillLayer(const PaintInfo& paintInfo, const Colo
r& c, const FillLayer& fillLayer, const LayoutRect& rect, SkXfermode::Mode op) | 102 void InlineFlowBoxPainter::paintFillLayer(const PaintInfo& paintInfo, const Colo
r& c, const FillLayer& fillLayer, const LayoutRect& rect, SkXfermode::Mode op) |
| 103 { | 103 { |
| 104 StyleImage* img = fillLayer.image(); | 104 StyleImage* img = fillLayer.image(); |
| 105 bool hasFillImage = img && img->canRender(m_inlineFlowBox.layoutObject(), m_
inlineFlowBox.layoutObject().style()->effectiveZoom()); | 105 bool hasFillImage = img && img->canRender(m_inlineFlowBox.layoutObject(), m_
inlineFlowBox.layoutObject().style()->effectiveZoom()); |
| 106 if ((!hasFillImage && !m_inlineFlowBox.layoutObject().style()->hasBorderRadi
us()) || (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || !
m_inlineFlowBox.parent()) { | 106 if ((!hasFillImage && !m_inlineFlowBox.layoutObject().style()->hasBorderRadi
us()) || (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || !
m_inlineFlowBox.parent()) { |
| 107 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.boxModelObject(), pa
intInfo, c, fillLayer, rect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(),
op); | 107 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.deprecatedBoxModelOb
ject(), paintInfo, c, fillLayer, rect, BackgroundBleedNone, &m_inlineFlowBox, re
ct.size(), op); |
| 108 } else if (m_inlineFlowBox.layoutObject().style()->boxDecorationBreak() == D
CLONE) { | 108 } else if (m_inlineFlowBox.layoutObject().style()->boxDecorationBreak() == D
CLONE) { |
| 109 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 109 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 110 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), m_inlineFlowBox.w
idth(), m_inlineFlowBox.height())); | 110 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), m_inlineFlowBox.w
idth(), m_inlineFlowBox.height())); |
| 111 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.boxModelObject(), pa
intInfo, c, fillLayer, rect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(),
op); | 111 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.deprecatedBoxModelOb
ject(), paintInfo, c, fillLayer, rect, BackgroundBleedNone, &m_inlineFlowBox, re
ct.size(), op); |
| 112 } else { | 112 } else { |
| 113 // We have a fill image that spans multiple lines. | 113 // We have a fill image that spans multiple lines. |
| 114 // FIXME: frameSize ought to be the same as rect.size(). | 114 // FIXME: frameSize ought to be the same as rect.size(). |
| 115 LayoutSize frameSize(m_inlineFlowBox.width(), m_inlineFlowBox.height()); | 115 LayoutSize frameSize(m_inlineFlowBox.width(), m_inlineFlowBox.height()); |
| 116 LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(),
frameSize, m_inlineFlowBox.layoutObject().style()->direction()); | 116 LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(),
frameSize, m_inlineFlowBox.layoutObject().style()->direction()); |
| 117 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 117 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 118 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), m_inlineFlowBox.w
idth(), m_inlineFlowBox.height())); | 118 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), m_inlineFlowBox.w
idth(), m_inlineFlowBox.height())); |
| 119 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.boxModelObject(), pa
intInfo, c, fillLayer, imageStripPaintRect, BackgroundBleedNone, &m_inlineFlowBo
x, rect.size(), op); | 119 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.deprecatedBoxModelOb
ject(), paintInfo, c, fillLayer, imageStripPaintRect, BackgroundBleedNone, &m_in
lineFlowBox, rect.size(), op); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 void InlineFlowBoxPainter::paintBoxShadow(const PaintInfo& info, const ComputedS
tyle& s, ShadowStyle shadowStyle, const LayoutRect& paintRect) | 123 void InlineFlowBoxPainter::paintBoxShadow(const PaintInfo& info, const ComputedS
tyle& s, ShadowStyle shadowStyle, const LayoutRect& paintRect) |
| 124 { | 124 { |
| 125 if ((!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || !m
_inlineFlowBox.parent()) { | 125 if ((!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || !m
_inlineFlowBox.parent()) { |
| 126 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle); | 126 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle); |
| 127 } else { | 127 } else { |
| 128 // FIXME: We can do better here in the multi-line case. We want to push
a clip so that the shadow doesn't | 128 // FIXME: We can do better here in the multi-line case. We want to push
a clip so that the shadow doesn't |
| 129 // protrude incorrectly at the edges, and we want to possibly include sh
adows cast from the previous/following lines | 129 // protrude incorrectly at the edges, and we want to possibly include sh
adows cast from the previous/following lines |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 LayoutRect localRect(frameRect); | 242 LayoutRect localRect(frameRect); |
| 243 m_inlineFlowBox.flipForWritingMode(localRect); | 243 m_inlineFlowBox.flipForWritingMode(localRect); |
| 244 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); | 244 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); |
| 245 | 245 |
| 246 LayoutRect adjustedFrameRect = LayoutRect(adjustedPaintOffset, frameRect.siz
e()); | 246 LayoutRect adjustedFrameRect = LayoutRect(adjustedPaintOffset, frameRect.siz
e()); |
| 247 | 247 |
| 248 LayoutRect adjustedClipRect; | 248 LayoutRect adjustedClipRect; |
| 249 BorderPaintingType borderPaintingType = getBorderPaintType(adjustedFrameRect
, adjustedClipRect); | 249 BorderPaintingType borderPaintingType = getBorderPaintType(adjustedFrameRect
, adjustedClipRect); |
| 250 | 250 |
| 251 // Shadow comes first and is behind the background and border. | 251 // Shadow comes first and is behind the background and border. |
| 252 if (!m_inlineFlowBox.boxModelObject()->boxShadowShouldBeAppliedToBackground(
BackgroundBleedNone, &m_inlineFlowBox)) | 252 if (!m_inlineFlowBox.deprecatedBoxModelObject()->boxShadowShouldBeAppliedToB
ackground(BackgroundBleedNone, &m_inlineFlowBox)) |
| 253 paintBoxShadow(paintInfo, *styleToUse, Normal, adjustedFrameRect); | 253 paintBoxShadow(paintInfo, *styleToUse, Normal, adjustedFrameRect); |
| 254 | 254 |
| 255 Color backgroundColor = m_inlineFlowBox.layoutObject().resolveColor(*styleTo
Use, CSSPropertyBackgroundColor); | 255 Color backgroundColor = m_inlineFlowBox.layoutObject().resolveColor(*styleTo
Use, CSSPropertyBackgroundColor); |
| 256 paintFillLayers(paintInfo, backgroundColor, styleToUse->backgroundLayers(),
adjustedFrameRect); | 256 paintFillLayers(paintInfo, backgroundColor, styleToUse->backgroundLayers(),
adjustedFrameRect); |
| 257 paintBoxShadow(paintInfo, *styleToUse, Inset, adjustedFrameRect); | 257 paintBoxShadow(paintInfo, *styleToUse, Inset, adjustedFrameRect); |
| 258 | 258 |
| 259 switch (borderPaintingType) { | 259 switch (borderPaintingType) { |
| 260 case DontPaintBorders: | 260 case DontPaintBorders: |
| 261 break; | 261 break; |
| 262 case PaintBordersWithoutClip: | 262 case PaintBordersWithoutClip: |
| 263 BoxPainter::paintBorder(*m_inlineFlowBox.boxModelObject(), paintInfo, ad
justedFrameRect, m_inlineFlowBox.layoutObject().styleRef(m_inlineFlowBox.isFirst
LineStyle()), | 263 BoxPainter::paintBorder(*m_inlineFlowBox.deprecatedBoxModelObject(), pai
ntInfo, adjustedFrameRect, m_inlineFlowBox.layoutObject().styleRef(m_inlineFlowB
ox.isFirstLineStyle()), |
| 264 BackgroundBleedNone, m_inlineFlowBox.includeLogicalLeftEdge(), m_inl
ineFlowBox.includeLogicalRightEdge()); | 264 BackgroundBleedNone, m_inlineFlowBox.includeLogicalLeftEdge(), m_inl
ineFlowBox.includeLogicalRightEdge()); |
| 265 break; | 265 break; |
| 266 case PaintBordersWithClip: | 266 case PaintBordersWithClip: |
| 267 // FIXME: What the heck do we do with RTL here? The math we're using is
obviously not right, | 267 // FIXME: What the heck do we do with RTL here? The math we're using is
obviously not right, |
| 268 // but it isn't even clear how this should work at all. | 268 // but it isn't even clear how this should work at all. |
| 269 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff
set, frameRect.size(), LTR); | 269 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff
set, frameRect.size(), LTR); |
| 270 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 270 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 271 paintInfo.context->clip(adjustedClipRect); | 271 paintInfo.context->clip(adjustedClipRect); |
| 272 BoxPainter::paintBorder(*m_inlineFlowBox.boxModelObject(), paintInfo, im
ageStripPaintRect, m_inlineFlowBox.layoutObject().styleRef(m_inlineFlowBox.isFir
stLineStyle())); | 272 BoxPainter::paintBorder(*m_inlineFlowBox.deprecatedBoxModelObject(), pai
ntInfo, imageStripPaintRect, m_inlineFlowBox.layoutObject().styleRef(m_inlineFlo
wBox.isFirstLineStyle())); |
| 273 break; | 273 break; |
| 274 } | 274 } |
| 275 } | 275 } |
| 276 | 276 |
| 277 void InlineFlowBoxPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoi
nt& paintOffset) | 277 void InlineFlowBoxPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoi
nt& paintOffset) |
| 278 { | 278 { |
| 279 if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.layoutObject()) || m_i
nlineFlowBox.layoutObject().style()->visibility() != VISIBLE || paintInfo.phase
!= PaintPhaseMask) | 279 if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.layoutObject()) || m_i
nlineFlowBox.layoutObject().style()->visibility() != VISIBLE || paintInfo.phase
!= PaintPhaseMask) |
| 280 return; | 280 return; |
| 281 | 281 |
| 282 LayoutRect frameRect = roundedFrameRectClampedToLineTopAndBottomIfNeeded(); | 282 LayoutRect frameRect = roundedFrameRectClampedToLineTopAndBottomIfNeeded(); |
| 283 | 283 |
| 284 // Move x/y to our coordinates. | 284 // Move x/y to our coordinates. |
| 285 LayoutRect localRect(frameRect); | 285 LayoutRect localRect(frameRect); |
| 286 m_inlineFlowBox.flipForWritingMode(localRect); | 286 m_inlineFlowBox.flipForWritingMode(localRect); |
| 287 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); | 287 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); |
| 288 | 288 |
| 289 const NinePieceImage& maskNinePieceImage = m_inlineFlowBox.layoutObject().st
yle()->maskBoxImage(); | 289 const NinePieceImage& maskNinePieceImage = m_inlineFlowBox.layoutObject().st
yle()->maskBoxImage(); |
| 290 StyleImage* maskBoxImage = m_inlineFlowBox.layoutObject().style()->maskBoxIm
age().image(); | 290 StyleImage* maskBoxImage = m_inlineFlowBox.layoutObject().style()->maskBoxIm
age().image(); |
| 291 | 291 |
| 292 // Figure out if we need to push a transparency layer to render our mask. | 292 // Figure out if we need to push a transparency layer to render our mask. |
| 293 bool pushTransparencyLayer = false; | 293 bool pushTransparencyLayer = false; |
| 294 bool compositedMask = m_inlineFlowBox.layoutObject().hasLayer() && m_inlineF
lowBox.boxModelObject()->layer()->hasCompositedMask(); | 294 bool compositedMask = m_inlineFlowBox.layoutObject().hasLayer() && m_inlineF
lowBox.deprecatedBoxModelObject()->layer()->hasCompositedMask(); |
| 295 bool flattenCompositingLayers = paintInfo.globalPaintFlags() & GlobalPaintFl
attenCompositingLayers; | 295 bool flattenCompositingLayers = paintInfo.globalPaintFlags() & GlobalPaintFl
attenCompositingLayers; |
| 296 SkXfermode::Mode compositeOp = SkXfermode::kSrcOver_Mode; | 296 SkXfermode::Mode compositeOp = SkXfermode::kSrcOver_Mode; |
| 297 if (!compositedMask || flattenCompositingLayers) { | 297 if (!compositedMask || flattenCompositingLayers) { |
| 298 if ((maskBoxImage && m_inlineFlowBox.layoutObject().style()->maskLayers(
).hasImage()) || m_inlineFlowBox.layoutObject().style()->maskLayers().next()) { | 298 if ((maskBoxImage && m_inlineFlowBox.layoutObject().style()->maskLayers(
).hasImage()) || m_inlineFlowBox.layoutObject().style()->maskLayers().next()) { |
| 299 pushTransparencyLayer = true; | 299 pushTransparencyLayer = true; |
| 300 paintInfo.context->beginLayer(1.0f, SkXfermode::kDstIn_Mode); | 300 paintInfo.context->beginLayer(1.0f, SkXfermode::kDstIn_Mode); |
| 301 } else { | 301 } else { |
| 302 // TODO(fmalita): passing a dst-in xfer mode down to paintFillLayers
/paintNinePieceImage | 302 // TODO(fmalita): passing a dst-in xfer mode down to paintFillLayers
/paintNinePieceImage |
| 303 // seems dangerous: it is only correct if applied atomically (sing
le draw call). While | 303 // seems dangerous: it is only correct if applied atomically (sing
le draw call). While |
| 304 // the heuristic above presumably ensures that is the case, this a
pproach seems super | 304 // the heuristic above presumably ensures that is the case, this a
pproach seems super |
| 305 // fragile. We should investigate dropping this optimization in fa
vour of the more | 305 // fragile. We should investigate dropping this optimization in fa
vour of the more |
| 306 // robust layer branch above. | 306 // robust layer branch above. |
| 307 compositeOp = SkXfermode::kDstIn_Mode; | 307 compositeOp = SkXfermode::kDstIn_Mode; |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 | 310 |
| 311 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, frameRect.size()); | 311 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, frameRect.size()); |
| 312 paintFillLayers(paintInfo, Color::transparent, m_inlineFlowBox.layoutObject(
).style()->maskLayers(), paintRect, compositeOp); | 312 paintFillLayers(paintInfo, Color::transparent, m_inlineFlowBox.layoutObject(
).style()->maskLayers(), paintRect, compositeOp); |
| 313 | 313 |
| 314 bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(m_inlineFlowBox.l
ayoutObject(), m_inlineFlowBox.layoutObject().style()->effectiveZoom()); | 314 bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(m_inlineFlowBox.l
ayoutObject(), m_inlineFlowBox.layoutObject().style()->effectiveZoom()); |
| 315 if (!hasBoxImage || !maskBoxImage->isLoaded()) { | 315 if (!hasBoxImage || !maskBoxImage->isLoaded()) { |
| 316 if (pushTransparencyLayer) | 316 if (pushTransparencyLayer) |
| 317 paintInfo.context->endLayer(); | 317 paintInfo.context->endLayer(); |
| 318 return; // Don't paint anything while we wait for the image to load. | 318 return; // Don't paint anything while we wait for the image to load. |
| 319 } | 319 } |
| 320 | 320 |
| 321 // The simple case is where we are the only box for this object. In those | 321 // The simple case is where we are the only box for this object. In those |
| 322 // cases only a single call to draw is required. | 322 // cases only a single call to draw is required. |
| 323 if (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) { | 323 if (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) { |
| 324 BoxPainter::paintNinePieceImage(*m_inlineFlowBox.boxModelObject(), paint
Info.context, paintRect, m_inlineFlowBox.layoutObject().styleRef(), maskNinePiec
eImage, compositeOp); | 324 BoxPainter::paintNinePieceImage(*m_inlineFlowBox.deprecatedBoxModelObjec
t(), paintInfo.context, paintRect, m_inlineFlowBox.layoutObject().styleRef(), ma
skNinePieceImage, compositeOp); |
| 325 } else { | 325 } else { |
| 326 // We have a mask image that spans multiple lines. | 326 // We have a mask image that spans multiple lines. |
| 327 // FIXME: What the heck do we do with RTL here? The math we're using is
obviously not right, | 327 // FIXME: What the heck do we do with RTL here? The math we're using is
obviously not right, |
| 328 // but it isn't even clear how this should work at all. | 328 // but it isn't even clear how this should work at all. |
| 329 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff
set, frameRect.size(), LTR); | 329 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff
set, frameRect.size(), LTR); |
| 330 LayoutRect clipRect = clipRectForNinePieceImageStrip(&m_inlineFlowBox, m
askNinePieceImage, paintRect); | 330 LayoutRect clipRect = clipRectForNinePieceImageStrip(&m_inlineFlowBox, m
askNinePieceImage, paintRect); |
| 331 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 331 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 332 paintInfo.context->clip(clipRect); | 332 paintInfo.context->clip(clipRect); |
| 333 BoxPainter::paintNinePieceImage(*m_inlineFlowBox.boxModelObject(), paint
Info.context, imageStripPaintRect, m_inlineFlowBox.layoutObject().styleRef(), ma
skNinePieceImage, compositeOp); | 333 BoxPainter::paintNinePieceImage(*m_inlineFlowBox.deprecatedBoxModelObjec
t(), paintInfo.context, imageStripPaintRect, m_inlineFlowBox.layoutObject().styl
eRef(), maskNinePieceImage, compositeOp); |
| 334 } | 334 } |
| 335 | 335 |
| 336 if (pushTransparencyLayer) | 336 if (pushTransparencyLayer) |
| 337 paintInfo.context->endLayer(); | 337 paintInfo.context->endLayer(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 LayoutRect InlineFlowBoxPainter::roundedFrameRectClampedToLineTopAndBottomIfNeed
ed() const | 340 LayoutRect InlineFlowBoxPainter::roundedFrameRectClampedToLineTopAndBottomIfNeed
ed() const |
| 341 { | 341 { |
| 342 // Pixel snap rect painting. | 342 // Pixel snap rect painting. |
| 343 LayoutRect rect(m_inlineFlowBox.roundedFrameRect()); | 343 LayoutRect rect(m_inlineFlowBox.roundedFrameRect()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 355 rect.setHeight(logicalHeight); | 355 rect.setHeight(logicalHeight); |
| 356 } else { | 356 } else { |
| 357 rect.setX(logicalTop); | 357 rect.setX(logicalTop); |
| 358 rect.setWidth(logicalHeight); | 358 rect.setWidth(logicalHeight); |
| 359 } | 359 } |
| 360 } | 360 } |
| 361 return rect; | 361 return rect; |
| 362 } | 362 } |
| 363 | 363 |
| 364 } // namespace blink | 364 } // namespace blink |
| OLD | NEW |