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

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

Issue 1586723003: Fix a bad cast in PaintLayerClipper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 4 years, 11 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
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 "core/paint/InlineFlowBoxPainter.h" 5 #include "core/paint/InlineFlowBoxPainter.h"
6 6
7 #include "core/layout/LayoutBlock.h" 7 #include "core/layout/LayoutBlock.h"
8 #include "core/layout/LayoutInline.h" 8 #include "core/layout/LayoutInline.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/layout/api/LineLayoutBoxModel.h" 10 #include "core/layout/api/LineLayoutBoxModel.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (!hasBorderImage || (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowB ox.nextLineBox())) 172 if (!hasBorderImage || (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowB ox.nextLineBox()))
173 return PaintBordersWithoutClip; 173 return PaintBordersWithoutClip;
174 174
175 // We have a border image that spans multiple lines. 175 // We have a border image that spans multiple lines.
176 adjustedClipRect = pixelSnappedIntRect(clipRectForNinePieceImageStrip(m_ inlineFlowBox, borderImage, adjustedFrameRect)); 176 adjustedClipRect = pixelSnappedIntRect(clipRectForNinePieceImageStrip(m_ inlineFlowBox, borderImage, adjustedFrameRect));
177 return PaintBordersWithClip; 177 return PaintBordersWithClip;
178 } 178 }
179 return DontPaintBorders; 179 return DontPaintBorders;
180 } 180 }
181 181
182 void InlineFlowBoxPainter::paintBoxShadowAndFillLayers(const PaintInfo& paintInf o, const ComputedStyle& style, LayoutRect& paintRect)
183 {
184 // Shadow comes first and is behind the background and border.
185 if (!m_inlineFlowBox.boxModelObject().boxShadowShouldBeAppliedToBackground(B ackgroundBleedNone, &m_inlineFlowBox))
186 paintBoxShadow(paintInfo, style, Normal, paintRect);
187
188 Color backgroundColor = m_inlineFlowBox.layoutObject().resolveColor(style, C SSPropertyBackgroundColor);
189 paintFillLayers(paintInfo, backgroundColor, style.backgroundLayers(), paintR ect);
190 paintBoxShadow(paintInfo, style, Inset, paintRect);
191 }
192
182 void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintIn fo, const LayoutPoint& paintOffset, const LayoutRect& cullRect) 193 void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintIn fo, const LayoutPoint& paintOffset, const LayoutRect& cullRect)
183 { 194 {
184 ASSERT(paintInfo.phase == PaintPhaseForeground); 195 ASSERT(paintInfo.phase == PaintPhaseForeground);
185 if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.layoutObject()) || m_i nlineFlowBox.lineLayoutItem().style()->visibility() != VISIBLE) 196 if (!paintInfo.shouldPaintWithinRoot(&m_inlineFlowBox.layoutObject()) || m_i nlineFlowBox.lineLayoutItem().style()->visibility() != VISIBLE)
186 return; 197 return;
187 198
188 // You can use p::first-line to specify a background. If so, the root line b oxes for 199 // You can use p::first-line to specify a background. If so, the root line b oxes for
189 // a line may actually have to paint a background. 200 // a line may actually have to paint a background.
190 const ComputedStyle* styleToUse = m_inlineFlowBox.lineLayoutItem().style(m_i nlineFlowBox.isFirstLineStyle()); 201 const ComputedStyle* styleToUse = m_inlineFlowBox.lineLayoutItem().style(m_i nlineFlowBox.isFirstLineStyle());
191 bool shouldPaintBoxDecorationBackground; 202 bool shouldPaintBoxDecorationBackground;
(...skipping 15 matching lines...) Expand all
207 // Move x/y to our coordinates. 218 // Move x/y to our coordinates.
208 LayoutRect localRect(frameRect); 219 LayoutRect localRect(frameRect);
209 m_inlineFlowBox.flipForWritingMode(localRect); 220 m_inlineFlowBox.flipForWritingMode(localRect);
210 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); 221 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location();
211 222
212 LayoutRect adjustedFrameRect = LayoutRect(adjustedPaintOffset, frameRect.siz e()); 223 LayoutRect adjustedFrameRect = LayoutRect(adjustedPaintOffset, frameRect.siz e());
213 224
214 IntRect adjustedClipRect; 225 IntRect adjustedClipRect;
215 BorderPaintingType borderPaintingType = getBorderPaintType(adjustedFrameRect , adjustedClipRect); 226 BorderPaintingType borderPaintingType = getBorderPaintType(adjustedFrameRect , adjustedClipRect);
216 227
217 // Shadow comes first and is behind the background and border. 228 if (m_inlineFlowBox.lineLayoutItem().style()->containsPaint()) {
218 if (!m_inlineFlowBox.boxModelObject().boxShadowShouldBeAppliedToBackground(B ackgroundBleedNone, &m_inlineFlowBox)) 229 GraphicsContextStateSaver stateSaver(paintInfo.context);
219 paintBoxShadow(paintInfo, *styleToUse, Normal, adjustedFrameRect); 230 paintInfo.context.clip(adjustedClipRect);
220 231 paintBoxShadowAndFillLayers(paintInfo, *styleToUse, adjustedFrameRect);
chrishtr 2016/01/14 18:32:56 Why is it just box shadow and fill layers of inlin
221 Color backgroundColor = m_inlineFlowBox.layoutObject().resolveColor(*styleTo Use, CSSPropertyBackgroundColor); 232 } else {
222 paintFillLayers(paintInfo, backgroundColor, styleToUse->backgroundLayers(), adjustedFrameRect); 233 paintBoxShadowAndFillLayers(paintInfo, *styleToUse, adjustedFrameRect);
223 paintBoxShadow(paintInfo, *styleToUse, Inset, adjustedFrameRect); 234 }
224 235
225 switch (borderPaintingType) { 236 switch (borderPaintingType) {
226 case DontPaintBorders: 237 case DontPaintBorders:
227 break; 238 break;
228 case PaintBordersWithoutClip: 239 case PaintBordersWithoutClip:
229 BoxPainter::paintBorder(*toLayoutBoxModelObject(LineLayoutPaintShim::lay outObjectFrom(m_inlineFlowBox.boxModelObject())), paintInfo, adjustedFrameRect, m_inlineFlowBox.lineLayoutItem().styleRef(m_inlineFlowBox.isFirstLineStyle()), B ackgroundBleedNone, m_inlineFlowBox.includeLogicalLeftEdge(), m_inlineFlowBox.in cludeLogicalRightEdge()); 240 BoxPainter::paintBorder(*toLayoutBoxModelObject(LineLayoutPaintShim::lay outObjectFrom(m_inlineFlowBox.boxModelObject())), paintInfo, adjustedFrameRect, m_inlineFlowBox.lineLayoutItem().styleRef(m_inlineFlowBox.isFirstLineStyle()), B ackgroundBleedNone, m_inlineFlowBox.includeLogicalLeftEdge(), m_inlineFlowBox.in cludeLogicalRightEdge());
230 break; 241 break;
231 case PaintBordersWithClip: 242 case PaintBordersWithClip:
232 // FIXME: What the heck do we do with RTL here? The math we're using is obviously not right, 243 // FIXME: What the heck do we do with RTL here? The math we're using is obviously not right,
233 // but it isn't even clear how this should work at all. 244 // but it isn't even clear how this should work at all.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 rect.setHeight(logicalHeight); 333 rect.setHeight(logicalHeight);
323 } else { 334 } else {
324 rect.setX(logicalTop); 335 rect.setX(logicalTop);
325 rect.setWidth(logicalHeight); 336 rect.setWidth(logicalHeight);
326 } 337 }
327 } 338 }
328 return rect; 339 return rect;
329 } 340 }
330 341
331 } // namespace blink 342 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698