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

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

Issue 1316163002: Make the LayoutRect->FloatRect constructor explicit. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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/FramePainter.cpp ('k') | Source/core/paint/LayerClipRecorderTest.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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 GraphicsContextStateSaver stateSaver(*paintInfo.context); 112 GraphicsContextStateSaver stateSaver(*paintInfo.context);
113 // TODO(chrishtr): this should be pixel-snapped. 113 // TODO(chrishtr): this should be pixel-snapped.
114 paintInfo.context->clip(FloatRect(LayoutRect(rect.x(), rect.y(), m_inlin eFlowBox.width(), m_inlineFlowBox.height()))); 114 paintInfo.context->clip(FloatRect(LayoutRect(rect.x(), rect.y(), m_inlin eFlowBox.width(), m_inlineFlowBox.height())));
115 BoxPainter::paintFillLayerExtended(*boxModel, paintInfo, c, fillLayer, r ect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op); 115 BoxPainter::paintFillLayerExtended(*boxModel, paintInfo, c, fillLayer, r ect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op);
116 } else { 116 } else {
117 // We have a fill image that spans multiple lines. 117 // We have a fill image that spans multiple lines.
118 // FIXME: frameSize ought to be the same as rect.size(). 118 // FIXME: frameSize ought to be the same as rect.size().
119 LayoutSize frameSize(m_inlineFlowBox.width(), m_inlineFlowBox.height()); 119 LayoutSize frameSize(m_inlineFlowBox.width(), m_inlineFlowBox.height());
120 LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(), frameSize, m_inlineFlowBox.layoutObject().style()->direction()); 120 LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(), frameSize, m_inlineFlowBox.layoutObject().style()->direction());
121 GraphicsContextStateSaver stateSaver(*paintInfo.context); 121 GraphicsContextStateSaver stateSaver(*paintInfo.context);
122 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), m_inlineFlowBox.w idth(), m_inlineFlowBox.height())); 122 // TODO(chrishtr): this should likely be pixel-snapped.
123 paintInfo.context->clip(FloatRect(LayoutRect(rect.x(), rect.y(), m_inlin eFlowBox.width(), m_inlineFlowBox.height())));
123 BoxPainter::paintFillLayerExtended(*boxModel, paintInfo, c, fillLayer, i mageStripPaintRect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op); 124 BoxPainter::paintFillLayerExtended(*boxModel, paintInfo, c, fillLayer, i mageStripPaintRect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op);
124 } 125 }
125 } 126 }
126 127
127 void InlineFlowBoxPainter::paintBoxShadow(const PaintInfo& info, const ComputedS tyle& s, ShadowStyle shadowStyle, const LayoutRect& paintRect) 128 void InlineFlowBoxPainter::paintBoxShadow(const PaintInfo& info, const ComputedS tyle& s, ShadowStyle shadowStyle, const LayoutRect& paintRect)
128 { 129 {
129 if ((!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || !m _inlineFlowBox.parent()) { 130 if ((!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || !m _inlineFlowBox.parent()) {
130 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle); 131 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle);
131 } else { 132 } else {
132 // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't 133 // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't
133 // protrude incorrectly at the edges, and we want to possibly include sh adows cast from the previous/following lines 134 // protrude incorrectly at the edges, and we want to possibly include sh adows cast from the previous/following lines
134 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle, m_inlineFlow Box.includeLogicalLeftEdge(), m_inlineFlowBox.includeLogicalRightEdge()); 135 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle, m_inlineFlow Box.includeLogicalLeftEdge(), m_inlineFlowBox.includeLogicalRightEdge());
135 } 136 }
136 } 137 }
137 138
138
139 static LayoutRect clipRectForNinePieceImageStrip(InlineFlowBox* box, const NineP ieceImage& image, const LayoutRect& paintRect) 139 static LayoutRect clipRectForNinePieceImageStrip(InlineFlowBox* box, const NineP ieceImage& image, const LayoutRect& paintRect)
140 { 140 {
141 LayoutRect clipRect(paintRect); 141 LayoutRect clipRect(paintRect);
142 const ComputedStyle& style = box->layoutObject().styleRef(); 142 const ComputedStyle& style = box->layoutObject().styleRef();
143 LayoutRectOutsets outsets = style.imageOutsets(image); 143 LayoutRectOutsets outsets = style.imageOutsets(image);
144 if (box->isHorizontal()) { 144 if (box->isHorizontal()) {
145 clipRect.setY(paintRect.y() - outsets.top()); 145 clipRect.setY(paintRect.y() - outsets.top());
146 clipRect.setHeight(paintRect.height() + outsets.top() + outsets.bottom() ); 146 clipRect.setHeight(paintRect.height() + outsets.top() + outsets.bottom() );
147 if (box->includeLogicalLeftEdge()) { 147 if (box->includeLogicalLeftEdge()) {
148 clipRect.setX(paintRect.x() - outsets.left()); 148 clipRect.setX(paintRect.x() - outsets.left());
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 rect.setHeight(logicalHeight); 361 rect.setHeight(logicalHeight);
362 } else { 362 } else {
363 rect.setX(logicalTop); 363 rect.setX(logicalTop);
364 rect.setWidth(logicalHeight); 364 rect.setWidth(logicalHeight);
365 } 365 }
366 } 366 }
367 return rect; 367 return rect;
368 } 368 }
369 369
370 } // namespace blink 370 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/FramePainter.cpp ('k') | Source/core/paint/LayerClipRecorderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698