Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: Source/core/paint/InlineFlowBoxPainter.cpp

Issue 1303413004: Convert some call sites to use explicit LayoutRect->FloatRect conversion. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/ImagePainter.cpp ('k') | Source/core/paint/InlineTextBoxPainter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 void InlineFlowBoxPainter::paintFillLayer(const PaintInfo& paintInfo, const Colo r& c, const FillLayer& fillLayer, const LayoutRect& rect, SkXfermode::Mode op) 103 void InlineFlowBoxPainter::paintFillLayer(const PaintInfo& paintInfo, const Colo r& c, const FillLayer& fillLayer, const LayoutRect& rect, SkXfermode::Mode op)
104 { 104 {
105 StyleImage* img = fillLayer.image(); 105 StyleImage* img = fillLayer.image();
106 bool hasFillImage = img && img->canRender(m_inlineFlowBox.layoutObject(), m_ inlineFlowBox.layoutObject().style()->effectiveZoom()); 106 bool hasFillImage = img && img->canRender(m_inlineFlowBox.layoutObject(), m_ inlineFlowBox.layoutObject().style()->effectiveZoom());
107 if ((!hasFillImage && !m_inlineFlowBox.layoutObject().style()->hasBorderRadi us()) || (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || ! m_inlineFlowBox.parent()) { 107 if ((!hasFillImage && !m_inlineFlowBox.layoutObject().style()->hasBorderRadi us()) || (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || ! m_inlineFlowBox.parent()) {
108 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.deprecatedBoxModelOb ject(), paintInfo, c, fillLayer, rect, BackgroundBleedNone, &m_inlineFlowBox, re ct.size(), op); 108 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.deprecatedBoxModelOb ject(), paintInfo, c, fillLayer, rect, BackgroundBleedNone, &m_inlineFlowBox, re ct.size(), op);
109 } else if (m_inlineFlowBox.layoutObject().style()->boxDecorationBreak() == D CLONE) { 109 } else if (m_inlineFlowBox.layoutObject().style()->boxDecorationBreak() == D CLONE) {
110 GraphicsContextStateSaver stateSaver(*paintInfo.context); 110 GraphicsContextStateSaver stateSaver(*paintInfo.context);
111 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), m_inlineFlowBox.w idth(), m_inlineFlowBox.height())); 111 // TODO(chrishtr): this should be pixel-snapped.
112 paintInfo.context->clip(FloatRect(LayoutRect(rect.x(), rect.y(), m_inlin eFlowBox.width(), m_inlineFlowBox.height())));
112 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.deprecatedBoxModelOb ject(), paintInfo, c, fillLayer, rect, BackgroundBleedNone, &m_inlineFlowBox, re ct.size(), op); 113 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.deprecatedBoxModelOb ject(), paintInfo, c, fillLayer, rect, BackgroundBleedNone, &m_inlineFlowBox, re ct.size(), op);
113 } else { 114 } else {
114 // We have a fill image that spans multiple lines. 115 // We have a fill image that spans multiple lines.
115 // FIXME: frameSize ought to be the same as rect.size(). 116 // FIXME: frameSize ought to be the same as rect.size().
116 LayoutSize frameSize(m_inlineFlowBox.width(), m_inlineFlowBox.height()); 117 LayoutSize frameSize(m_inlineFlowBox.width(), m_inlineFlowBox.height());
117 LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(), frameSize, m_inlineFlowBox.layoutObject().style()->direction()); 118 LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(), frameSize, m_inlineFlowBox.layoutObject().style()->direction());
118 GraphicsContextStateSaver stateSaver(*paintInfo.context); 119 GraphicsContextStateSaver stateSaver(*paintInfo.context);
119 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), m_inlineFlowBox.w idth(), m_inlineFlowBox.height())); 120 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), m_inlineFlowBox.w idth(), m_inlineFlowBox.height()));
120 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.deprecatedBoxModelOb ject(), paintInfo, c, fillLayer, imageStripPaintRect, BackgroundBleedNone, &m_in lineFlowBox, rect.size(), op); 121 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.deprecatedBoxModelOb ject(), paintInfo, c, fillLayer, imageStripPaintRect, BackgroundBleedNone, &m_in lineFlowBox, rect.size(), op);
121 } 122 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 break; 263 break;
263 case PaintBordersWithoutClip: 264 case PaintBordersWithoutClip:
264 BoxPainter::paintBorder(*m_inlineFlowBox.deprecatedBoxModelObject(), pai ntInfo, adjustedFrameRect, m_inlineFlowBox.layoutObject().styleRef(m_inlineFlowB ox.isFirstLineStyle()), 265 BoxPainter::paintBorder(*m_inlineFlowBox.deprecatedBoxModelObject(), pai ntInfo, adjustedFrameRect, m_inlineFlowBox.layoutObject().styleRef(m_inlineFlowB ox.isFirstLineStyle()),
265 BackgroundBleedNone, m_inlineFlowBox.includeLogicalLeftEdge(), m_inl ineFlowBox.includeLogicalRightEdge()); 266 BackgroundBleedNone, m_inlineFlowBox.includeLogicalLeftEdge(), m_inl ineFlowBox.includeLogicalRightEdge());
266 break; 267 break;
267 case PaintBordersWithClip: 268 case PaintBordersWithClip:
268 // FIXME: What the heck do we do with RTL here? The math we're using is obviously not right, 269 // FIXME: What the heck do we do with RTL here? The math we're using is obviously not right,
269 // but it isn't even clear how this should work at all. 270 // but it isn't even clear how this should work at all.
270 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff set, frameRect.size(), LTR); 271 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff set, frameRect.size(), LTR);
271 GraphicsContextStateSaver stateSaver(*paintInfo.context); 272 GraphicsContextStateSaver stateSaver(*paintInfo.context);
272 paintInfo.context->clip(adjustedClipRect); 273 // TODO(chrishtr): this should be pixel-snapped.
274 paintInfo.context->clip(FloatRect(adjustedClipRect));
273 BoxPainter::paintBorder(*m_inlineFlowBox.deprecatedBoxModelObject(), pai ntInfo, imageStripPaintRect, m_inlineFlowBox.layoutObject().styleRef(m_inlineFlo wBox.isFirstLineStyle())); 275 BoxPainter::paintBorder(*m_inlineFlowBox.deprecatedBoxModelObject(), pai ntInfo, imageStripPaintRect, m_inlineFlowBox.layoutObject().styleRef(m_inlineFlo wBox.isFirstLineStyle()));
274 break; 276 break;
275 } 277 }
276 } 278 }
277 279
278 void InlineFlowBoxPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoi nt& paintOffset) 280 void InlineFlowBoxPainter::paintMask(const PaintInfo& paintInfo, const LayoutPoi nt& paintOffset)
279 { 281 {
280 if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.layoutObject()) || m_i nlineFlowBox.layoutObject().style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) 282 if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.layoutObject()) || m_i nlineFlowBox.layoutObject().style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
281 return; 283 return;
282 284
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 323
322 // The simple case is where we are the only box for this object. In those 324 // The simple case is where we are the only box for this object. In those
323 // cases only a single call to draw is required. 325 // cases only a single call to draw is required.
324 if (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) { 326 if (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) {
325 BoxPainter::paintNinePieceImage(*m_inlineFlowBox.deprecatedBoxModelObjec t(), paintInfo.context, paintRect, m_inlineFlowBox.layoutObject().styleRef(), ma skNinePieceImage, compositeOp); 327 BoxPainter::paintNinePieceImage(*m_inlineFlowBox.deprecatedBoxModelObjec t(), paintInfo.context, paintRect, m_inlineFlowBox.layoutObject().styleRef(), ma skNinePieceImage, compositeOp);
326 } else { 328 } else {
327 // We have a mask image that spans multiple lines. 329 // We have a mask image that spans multiple lines.
328 // FIXME: What the heck do we do with RTL here? The math we're using is obviously not right, 330 // FIXME: What the heck do we do with RTL here? The math we're using is obviously not right,
329 // but it isn't even clear how this should work at all. 331 // but it isn't even clear how this should work at all.
330 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff set, frameRect.size(), LTR); 332 LayoutRect imageStripPaintRect = paintRectForImageStrip(adjustedPaintOff set, frameRect.size(), LTR);
331 LayoutRect clipRect = clipRectForNinePieceImageStrip(&m_inlineFlowBox, m askNinePieceImage, paintRect); 333 FloatRect clipRect(clipRectForNinePieceImageStrip(&m_inlineFlowBox, mask NinePieceImage, paintRect));
332 GraphicsContextStateSaver stateSaver(*paintInfo.context); 334 GraphicsContextStateSaver stateSaver(*paintInfo.context);
335 // TODO(chrishtr): this should be pixel-snapped.
333 paintInfo.context->clip(clipRect); 336 paintInfo.context->clip(clipRect);
334 BoxPainter::paintNinePieceImage(*m_inlineFlowBox.deprecatedBoxModelObjec t(), paintInfo.context, imageStripPaintRect, m_inlineFlowBox.layoutObject().styl eRef(), maskNinePieceImage, compositeOp); 337 BoxPainter::paintNinePieceImage(*m_inlineFlowBox.deprecatedBoxModelObjec t(), paintInfo.context, imageStripPaintRect, m_inlineFlowBox.layoutObject().styl eRef(), maskNinePieceImage, compositeOp);
335 } 338 }
336 339
337 if (pushTransparencyLayer) 340 if (pushTransparencyLayer)
338 paintInfo.context->endLayer(); 341 paintInfo.context->endLayer();
339 } 342 }
340 343
341 LayoutRect InlineFlowBoxPainter::roundedFrameRectClampedToLineTopAndBottomIfNeed ed() const 344 LayoutRect InlineFlowBoxPainter::roundedFrameRectClampedToLineTopAndBottomIfNeed ed() const
342 { 345 {
(...skipping 13 matching lines...) Expand all
356 rect.setHeight(logicalHeight); 359 rect.setHeight(logicalHeight);
357 } else { 360 } else {
358 rect.setX(logicalTop); 361 rect.setX(logicalTop);
359 rect.setWidth(logicalHeight); 362 rect.setWidth(logicalHeight);
360 } 363 }
361 } 364 }
362 return rect; 365 return rect;
363 } 366 }
364 367
365 } // namespace blink 368 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/ImagePainter.cpp ('k') | Source/core/paint/InlineTextBoxPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698