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

Side by Side Diff: sky/engine/core/rendering/InlineFlowBox.cpp

Issue 891573002: Removed a bunch of unneeded paint phase checks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 overflowRect.moveBy(paintOffset); 995 overflowRect.moveBy(paintOffset);
996 996
997 if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect))) 997 if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect)))
998 return; 998 return;
999 999
1000 if (paintInfo.phase == PaintPhaseMask) { 1000 if (paintInfo.phase == PaintPhaseMask) {
1001 paintMask(paintInfo, paintOffset); 1001 paintMask(paintInfo, paintOffset);
1002 return; 1002 return;
1003 } 1003 }
1004 1004
1005 if (paintInfo.phase == PaintPhaseForeground) 1005 paintBoxDecorationBackground(paintInfo, paintOffset);
1006 paintBoxDecorationBackground(paintInfo, paintOffset);
1007 1006
1008 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 1007 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
1009 if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPaintin gLayer()) 1008 if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPaintin gLayer())
1010 curr->paint(paintInfo, paintOffset, lineTop, lineBottom); 1009 curr->paint(paintInfo, paintOffset, lineTop, lineBottom);
1011 } 1010 }
1012 } 1011 }
1013 1012
1014 void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer& fillLayer, const LayoutRect& rect) 1013 void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer& fillLayer, const LayoutRect& rect)
1015 { 1014 {
1016 if (fillLayer.next()) 1015 if (fillLayer.next())
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 clipRect.setX(paintRect.x() - outsets.left()); 1091 clipRect.setX(paintRect.x() - outsets.left());
1093 clipRect.setWidth(paintRect.width() + outsets.left()); 1092 clipRect.setWidth(paintRect.width() + outsets.left());
1094 } 1093 }
1095 if (box->includeLogicalRightEdge()) 1094 if (box->includeLogicalRightEdge())
1096 clipRect.setWidth(clipRect.width() + outsets.right()); 1095 clipRect.setWidth(clipRect.width() + outsets.right());
1097 return clipRect; 1096 return clipRect;
1098 } 1097 }
1099 1098
1100 void InlineFlowBox::paintBoxDecorationBackground(PaintInfo& paintInfo, const Lay outPoint& paintOffset) 1099 void InlineFlowBox::paintBoxDecorationBackground(PaintInfo& paintInfo, const Lay outPoint& paintOffset)
1101 { 1100 {
1102 ASSERT(paintInfo.phase == PaintPhaseForeground);
1103
1104 // You can use p::first-line to specify a background. If so, the root line b oxes for 1101 // You can use p::first-line to specify a background. If so, the root line b oxes for
1105 // a line may actually have to paint a background. 1102 // a line may actually have to paint a background.
1106 RenderStyle* styleToUse = renderer().style(isFirstLineStyle()); 1103 RenderStyle* styleToUse = renderer().style(isFirstLineStyle());
1107 bool shouldPaintBoxDecorationBackground; 1104 bool shouldPaintBoxDecorationBackground;
1108 if (parent()) 1105 if (parent())
1109 shouldPaintBoxDecorationBackground = renderer().hasBoxDecorationBackgrou nd(); 1106 shouldPaintBoxDecorationBackground = renderer().hasBoxDecorationBackgrou nd();
1110 else 1107 else
1111 shouldPaintBoxDecorationBackground = isFirstLineStyle() && styleToUse != renderer().style(); 1108 shouldPaintBoxDecorationBackground = isFirstLineStyle() && styleToUse != renderer().style();
1112 1109
1113 if (!shouldPaintBoxDecorationBackground) 1110 if (!shouldPaintBoxDecorationBackground)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 LayoutRect clipRect = clipRectForNinePieceImageStrip(this, borderIma ge, paintRect); 1163 LayoutRect clipRect = clipRectForNinePieceImageStrip(this, borderIma ge, paintRect);
1167 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1164 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1168 paintInfo.context->clip(clipRect); 1165 paintInfo.context->clip(clipRect);
1169 boxModelObject()->paintBorder(paintInfo, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer().style(isFirstLineStyle())); 1166 boxModelObject()->paintBorder(paintInfo, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer().style(isFirstLineStyle()));
1170 } 1167 }
1171 } 1168 }
1172 } 1169 }
1173 1170
1174 void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffs et) 1171 void InlineFlowBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffs et)
1175 { 1172 {
1176 if (paintInfo.phase != PaintPhaseMask)
ojan 2015/01/30 01:25:59 The caller already does this check.
abarth-chromium 2015/01/30 02:37:56 ASSERT?
ojan 2015/01/30 02:54:49 I'll be removing the paint phase entirely in my ne
1177 return;
1178
1179 // Pixel snap mask painting. 1173 // Pixel snap mask painting.
1180 LayoutRect frameRect = roundedFrameRect(); 1174 LayoutRect frameRect = roundedFrameRect();
1181 1175
1182 // Move x/y to our coordinates. 1176 // Move x/y to our coordinates.
1183 LayoutRect localRect(frameRect); 1177 LayoutRect localRect(frameRect);
1184 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); 1178 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location();
1185 1179
1186 const NinePieceImage& maskNinePieceImage = renderer().style()->maskBoxImage( ); 1180 const NinePieceImage& maskNinePieceImage = renderer().style()->maskBoxImage( );
1187 StyleImage* maskBoxImage = renderer().style()->maskBoxImage().image(); 1181 StyleImage* maskBoxImage = renderer().style()->maskBoxImage().image();
1188 1182
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 ASSERT(child->prevOnLine() == prev); 1402 ASSERT(child->prevOnLine() == prev);
1409 prev = child; 1403 prev = child;
1410 } 1404 }
1411 ASSERT(prev == m_lastChild); 1405 ASSERT(prev == m_lastChild);
1412 #endif 1406 #endif
1413 } 1407 }
1414 1408
1415 #endif 1409 #endif
1416 1410
1417 } // namespace blink 1411 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/rendering/InlineTextBox.cpp » ('j') | sky/engine/core/rendering/InlineTextBox.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698