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

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

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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/InlineFlowBoxPainter.h ('k') | Source/core/paint/InlinePainter.h » ('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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // We have a fill image that spans multiple lines. 110 // We have a fill image that spans multiple lines.
111 // FIXME: frameSize ought to be the same as rect.size(). 111 // FIXME: frameSize ought to be the same as rect.size().
112 LayoutSize frameSize(m_inlineFlowBox.width().toLayoutUnit(), m_inlineFlo wBox.height().toLayoutUnit()); 112 LayoutSize frameSize(m_inlineFlowBox.width().toLayoutUnit(), m_inlineFlo wBox.height().toLayoutUnit());
113 LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(), frameSize, m_inlineFlowBox.layoutObject().style()->direction()); 113 LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(), frameSize, m_inlineFlowBox.layoutObject().style()->direction());
114 GraphicsContextStateSaver stateSaver(*paintInfo.context); 114 GraphicsContextStateSaver stateSaver(*paintInfo.context);
115 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), m_inlineFlowBox.w idth(), m_inlineFlowBox.height())); 115 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), m_inlineFlowBox.w idth(), m_inlineFlowBox.height()));
116 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.boxModelObject(), pa intInfo, c, fillLayer, imageStripPaintRect, BackgroundBleedNone, &m_inlineFlowBo x, rect.size(), op); 116 BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.boxModelObject(), pa intInfo, c, fillLayer, imageStripPaintRect, BackgroundBleedNone, &m_inlineFlowBo x, rect.size(), op);
117 } 117 }
118 } 118 }
119 119
120 void InlineFlowBoxPainter::paintBoxShadow(const PaintInfo& info, const LayoutSty le& s, ShadowStyle shadowStyle, const LayoutRect& paintRect) 120 void InlineFlowBoxPainter::paintBoxShadow(const PaintInfo& info, const ComputedS tyle& s, ShadowStyle shadowStyle, const LayoutRect& paintRect)
121 { 121 {
122 if ((!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || !m _inlineFlowBox.parent()) { 122 if ((!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || !m _inlineFlowBox.parent()) {
123 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle); 123 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle);
124 } else { 124 } else {
125 // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't 125 // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't
126 // protrude incorrectly at the edges, and we want to possibly include sh adows cast from the previous/following lines 126 // protrude incorrectly at the edges, and we want to possibly include sh adows cast from the previous/following lines
127 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle, m_inlineFlow Box.includeLogicalLeftEdge(), m_inlineFlowBox.includeLogicalRightEdge()); 127 BoxPainter::paintBoxShadow(info, paintRect, s, shadowStyle, m_inlineFlow Box.includeLogicalLeftEdge(), m_inlineFlowBox.includeLogicalRightEdge());
128 } 128 }
129 } 129 }
130 130
131 131
132 static LayoutRect clipRectForNinePieceImageStrip(InlineFlowBox* box, const NineP ieceImage& image, const LayoutRect& paintRect) 132 static LayoutRect clipRectForNinePieceImageStrip(InlineFlowBox* box, const NineP ieceImage& image, const LayoutRect& paintRect)
133 { 133 {
134 LayoutRect clipRect(paintRect); 134 LayoutRect clipRect(paintRect);
135 const LayoutStyle& style = box->layoutObject().styleRef(); 135 const ComputedStyle& style = box->layoutObject().styleRef();
136 LayoutRectOutsets outsets = style.imageOutsets(image); 136 LayoutRectOutsets outsets = style.imageOutsets(image);
137 if (box->isHorizontal()) { 137 if (box->isHorizontal()) {
138 clipRect.setY(paintRect.y() - outsets.top()); 138 clipRect.setY(paintRect.y() - outsets.top());
139 clipRect.setHeight(paintRect.height() + outsets.top() + outsets.bottom() ); 139 clipRect.setHeight(paintRect.height() + outsets.top() + outsets.bottom() );
140 if (box->includeLogicalLeftEdge()) { 140 if (box->includeLogicalLeftEdge()) {
141 clipRect.setX(paintRect.x() - outsets.left()); 141 clipRect.setX(paintRect.x() - outsets.left());
142 clipRect.setWidth(paintRect.width() + outsets.left()); 142 clipRect.setWidth(paintRect.width() + outsets.left());
143 } 143 }
144 if (box->includeLogicalRightEdge()) 144 if (box->includeLogicalRightEdge())
145 clipRect.setWidth(clipRect.width() + outsets.right()); 145 clipRect.setWidth(clipRect.width() + outsets.right());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 return LayoutRect(stripX, stripY, stripWidth, stripHeight); 186 return LayoutRect(stripX, stripY, stripWidth, stripHeight);
187 } 187 }
188 188
189 189
190 InlineFlowBoxPainter::BorderPaintingType InlineFlowBoxPainter::getBorderPaintTyp e(const LayoutRect& adjustedFrameRect, LayoutRect& adjustedClipRect) const 190 InlineFlowBoxPainter::BorderPaintingType InlineFlowBoxPainter::getBorderPaintTyp e(const LayoutRect& adjustedFrameRect, LayoutRect& adjustedClipRect) const
191 { 191 {
192 adjustedClipRect = adjustedFrameRect; 192 adjustedClipRect = adjustedFrameRect;
193 if (m_inlineFlowBox.parent() && m_inlineFlowBox.layoutObject().style()->hasB order()) { 193 if (m_inlineFlowBox.parent() && m_inlineFlowBox.layoutObject().style()->hasB order()) {
194 const NinePieceImage& borderImage = m_inlineFlowBox.layoutObject().style ()->borderImage(); 194 const NinePieceImage& borderImage = m_inlineFlowBox.layoutObject().style ()->borderImage();
195 StyleImage* borderImageSource = borderImage.image(); 195 StyleImage* borderImageSource = borderImage.image();
196 const LayoutStyle* styleToUse = m_inlineFlowBox.layoutObject().style(m_i nlineFlowBox.isFirstLineStyle()); 196 const ComputedStyle* styleToUse = m_inlineFlowBox.layoutObject().style(m _inlineFlowBox.isFirstLineStyle());
197 bool hasBorderImage = borderImageSource && borderImageSource->canRender( m_inlineFlowBox.layoutObject(), styleToUse->effectiveZoom()); 197 bool hasBorderImage = borderImageSource && borderImageSource->canRender( m_inlineFlowBox.layoutObject(), styleToUse->effectiveZoom());
198 if (hasBorderImage && !borderImageSource->isLoaded()) 198 if (hasBorderImage && !borderImageSource->isLoaded())
199 return DontPaintBorders; 199 return DontPaintBorders;
200 200
201 // The simple case is where we either have no border image or we are the only box for this object. 201 // The simple case is where we either have no border image or we are the only box for this object.
202 // In those cases only a single call to draw is required. 202 // In those cases only a single call to draw is required.
203 if (!hasBorderImage || (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowB ox.nextLineBox())) 203 if (!hasBorderImage || (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowB ox.nextLineBox()))
204 return PaintBordersWithoutClip; 204 return PaintBordersWithoutClip;
205 205
206 // We have a border image that spans multiple lines. 206 // We have a border image that spans multiple lines.
207 adjustedClipRect = clipRectForNinePieceImageStrip(&m_inlineFlowBox, bord erImage, adjustedFrameRect); 207 adjustedClipRect = clipRectForNinePieceImageStrip(&m_inlineFlowBox, bord erImage, adjustedFrameRect);
208 return PaintBordersWithClip; 208 return PaintBordersWithClip;
209 } 209 }
210 return DontPaintBorders; 210 return DontPaintBorders;
211 } 211 }
212 212
213 void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintIn fo, const LayoutPoint& paintOffset) 213 void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintIn fo, const LayoutPoint& paintOffset)
214 { 214 {
215 ASSERT(paintInfo.phase == PaintPhaseForeground); 215 ASSERT(paintInfo.phase == PaintPhaseForeground);
216 if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.layoutObject()) || m_i nlineFlowBox.layoutObject().style()->visibility() != VISIBLE) 216 if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.layoutObject()) || m_i nlineFlowBox.layoutObject().style()->visibility() != VISIBLE)
217 return; 217 return;
218 218
219 // You can use p::first-line to specify a background. If so, the root line b oxes for 219 // You can use p::first-line to specify a background. If so, the root line b oxes for
220 // a line may actually have to paint a background. 220 // a line may actually have to paint a background.
221 const LayoutStyle* styleToUse = m_inlineFlowBox.layoutObject().style(m_inlin eFlowBox.isFirstLineStyle()); 221 const ComputedStyle* styleToUse = m_inlineFlowBox.layoutObject().style(m_inl ineFlowBox.isFirstLineStyle());
222 bool shouldPaintBoxDecorationBackground; 222 bool shouldPaintBoxDecorationBackground;
223 if (m_inlineFlowBox.parent()) 223 if (m_inlineFlowBox.parent())
224 shouldPaintBoxDecorationBackground = m_inlineFlowBox.layoutObject().hasB oxDecorationBackground(); 224 shouldPaintBoxDecorationBackground = m_inlineFlowBox.layoutObject().hasB oxDecorationBackground();
225 else 225 else
226 shouldPaintBoxDecorationBackground = m_inlineFlowBox.isFirstLineStyle() && styleToUse != m_inlineFlowBox.layoutObject().style(); 226 shouldPaintBoxDecorationBackground = m_inlineFlowBox.isFirstLineStyle() && styleToUse != m_inlineFlowBox.layoutObject().style();
227 227
228 if (!shouldPaintBoxDecorationBackground) 228 if (!shouldPaintBoxDecorationBackground)
229 return; 229 return;
230 230
231 LayoutRect frameRect = roundedFrameRectClampedToLineTopAndBottomIfNeeded(); 231 LayoutRect frameRect = roundedFrameRectClampedToLineTopAndBottomIfNeeded();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 rect.setHeight(logicalHeight); 350 rect.setHeight(logicalHeight);
351 } else { 351 } else {
352 rect.setX(logicalTop); 352 rect.setX(logicalTop);
353 rect.setWidth(logicalHeight); 353 rect.setWidth(logicalHeight);
354 } 354 }
355 } 355 }
356 return rect; 356 return rect;
357 } 357 }
358 358
359 } // namespace blink 359 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/InlineFlowBoxPainter.h ('k') | Source/core/paint/InlinePainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698