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

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

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Blind fix for Mac. Created 5 years, 10 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
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/paint/BoxPainter.h" 8 #include "core/paint/BoxPainter.h"
9 #include "core/paint/RenderDrawingRecorder.h" 9 #include "core/paint/RenderDrawingRecorder.h"
10 #include "core/rendering/InlineFlowBox.h" 10 #include "core/rendering/InlineFlowBox.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.renderer().style()->direction()); 113 LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(), frameSize, m_inlineFlowBox.renderer().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, RenderStyle* s, ShadowStyle shadowStyle, const LayoutRect& paintRect) 120 void InlineFlowBoxPainter::paintBoxShadow(const PaintInfo& info, const RenderSty le* 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 RenderStyle* style = box->renderer().style(); 135 const RenderStyle* style = box->renderer().style();
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 187 }
188 188
189 void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintIn fo, const LayoutPoint& paintOffset) 189 void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintIn fo, const LayoutPoint& paintOffset)
190 { 190 {
191 ASSERT(paintInfo.phase == PaintPhaseForeground); 191 ASSERT(paintInfo.phase == PaintPhaseForeground);
192 if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.renderer()) || m_inlin eFlowBox.renderer().style()->visibility() != VISIBLE) 192 if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.renderer()) || m_inlin eFlowBox.renderer().style()->visibility() != VISIBLE)
193 return; 193 return;
194 194
195 // You can use p::first-line to specify a background. If so, the root line b oxes for 195 // You can use p::first-line to specify a background. If so, the root line b oxes for
196 // a line may actually have to paint a background. 196 // a line may actually have to paint a background.
197 RenderStyle* styleToUse = m_inlineFlowBox.renderer().style(m_inlineFlowBox.i sFirstLineStyle()); 197 const RenderStyle* styleToUse = m_inlineFlowBox.renderer().style(m_inlineFlo wBox.isFirstLineStyle());
198 bool shouldPaintBoxDecorationBackground; 198 bool shouldPaintBoxDecorationBackground;
199 if (m_inlineFlowBox.parent()) 199 if (m_inlineFlowBox.parent())
200 shouldPaintBoxDecorationBackground = m_inlineFlowBox.renderer().hasBoxDe corationBackground(); 200 shouldPaintBoxDecorationBackground = m_inlineFlowBox.renderer().hasBoxDe corationBackground();
201 else 201 else
202 shouldPaintBoxDecorationBackground = m_inlineFlowBox.isFirstLineStyle() && styleToUse != m_inlineFlowBox.renderer().style(); 202 shouldPaintBoxDecorationBackground = m_inlineFlowBox.isFirstLineStyle() && styleToUse != m_inlineFlowBox.renderer().style();
203 203
204 if (!shouldPaintBoxDecorationBackground) 204 if (!shouldPaintBoxDecorationBackground)
205 return; 205 return;
206 206
207 LayoutRect frameRect = roundedFrameRectClampedToLineTopAndBottomIfNeeded(); 207 LayoutRect frameRect = roundedFrameRectClampedToLineTopAndBottomIfNeeded();
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 rect.setHeight(logicalHeight); 330 rect.setHeight(logicalHeight);
331 } else { 331 } else {
332 rect.setX(logicalTop); 332 rect.setX(logicalTop);
333 rect.setWidth(logicalHeight); 333 rect.setWidth(logicalHeight);
334 } 334 }
335 } 335 }
336 return rect; 336 return rect;
337 } 337 }
338 338
339 } // namespace blink 339 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698