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

Side by Side Diff: Source/core/rendering/InlineFlowBox.cpp

Issue 381473002: Use reference for FillLayer if possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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/rendering/InlineFlowBox.h ('k') | Source/core/rendering/RenderBlock.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 /* 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 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 else 1148 else
1149 childInfo.updatePaintingRootForChildren(&renderer()); 1149 childInfo.updatePaintingRootForChildren(&renderer());
1150 1150
1151 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 1151 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
1152 if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPai ntingLayer()) 1152 if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPai ntingLayer())
1153 curr->paint(childInfo, paintOffset, lineTop, lineBottom); 1153 curr->paint(childInfo, paintOffset, lineTop, lineBottom);
1154 } 1154 }
1155 } 1155 }
1156 } 1156 }
1157 1157
1158 void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, CompositeOperator op) 1158 void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer& fillLayer, const LayoutRect& rect, CompositeOperator op)
1159 { 1159 {
1160 if (!fillLayer) 1160 if (fillLayer.next())
1161 return; 1161 paintFillLayers(paintInfo, c, *fillLayer.next(), rect, op);
1162 paintFillLayers(paintInfo, c, fillLayer->next(), rect, op);
1163 paintFillLayer(paintInfo, c, fillLayer, rect, op); 1162 paintFillLayer(paintInfo, c, fillLayer, rect, op);
1164 } 1163 }
1165 1164
1166 bool InlineFlowBox::boxShadowCanBeAppliedToBackground(const FillLayer& lastBackg roundLayer) const 1165 bool InlineFlowBox::boxShadowCanBeAppliedToBackground(const FillLayer& lastBackg roundLayer) const
1167 { 1166 {
1168 // The checks here match how paintFillLayer() decides whether to clip (if it does, the shadow 1167 // The checks here match how paintFillLayer() decides whether to clip (if it does, the shadow
1169 // would be clipped out, so it has to be drawn separately). 1168 // would be clipped out, so it has to be drawn separately).
1170 StyleImage* image = lastBackgroundLayer.image(); 1169 StyleImage* image = lastBackgroundLayer.image();
1171 bool hasFillImage = image && image->canRender(renderer(), renderer().style() ->effectiveZoom()); 1170 bool hasFillImage = image && image->canRender(renderer(), renderer().style() ->effectiveZoom());
1172 return (!hasFillImage && !renderer().style()->hasBorderRadius()) || (!prevLi neBox() && !nextLineBox()) || !parent(); 1171 return (!hasFillImage && !renderer().style()->hasBorderRadius()) || (!prevLi neBox() && !nextLineBox()) || !parent();
1173 } 1172 }
1174 1173
1175 void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, c onst FillLayer* fillLayer, const LayoutRect& rect, CompositeOperator op) 1174 void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, c onst FillLayer& fillLayer, const LayoutRect& rect, CompositeOperator op)
1176 { 1175 {
1177 StyleImage* img = fillLayer->image(); 1176 StyleImage* img = fillLayer.image();
1178 bool hasFillImage = img && img->canRender(renderer(), renderer().style()->ef fectiveZoom()); 1177 bool hasFillImage = img && img->canRender(renderer(), renderer().style()->ef fectiveZoom());
1179 if ((!hasFillImage && !renderer().style()->hasBorderRadius()) || (!prevLineB ox() && !nextLineBox()) || !parent()) { 1178 if ((!hasFillImage && !renderer().style()->hasBorderRadius()) || (!prevLineB ox() && !nextLineBox()) || !parent()) {
1180 boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, rect, BackgroundBleedNone, this, rect.size(), op); 1179 boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, rect, BackgroundBleedNone, this, rect.size(), op);
1181 } else if (renderer().style()->boxDecorationBreak() == DCLONE) { 1180 } else if (renderer().style()->boxDecorationBreak() == DCLONE) {
1182 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1181 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1183 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height() )); 1182 paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height() ));
1184 boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, rect, BackgroundBleedNone, this, rect.size(), op); 1183 boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, rect, BackgroundBleedNone, this, rect.size(), op);
1185 } else { 1184 } else {
1186 // We have a fill image that spans multiple lines. 1185 // We have a fill image that spans multiple lines.
1187 // We need to adjust tx and ty by the width of all previous lines. 1186 // We need to adjust tx and ty by the width of all previous lines.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 1367
1369 const NinePieceImage& maskNinePieceImage = renderer().style()->maskBoxImage( ); 1368 const NinePieceImage& maskNinePieceImage = renderer().style()->maskBoxImage( );
1370 StyleImage* maskBoxImage = renderer().style()->maskBoxImage().image(); 1369 StyleImage* maskBoxImage = renderer().style()->maskBoxImage().image();
1371 1370
1372 // Figure out if we need to push a transparency layer to render our mask. 1371 // Figure out if we need to push a transparency layer to render our mask.
1373 bool pushTransparencyLayer = false; 1372 bool pushTransparencyLayer = false;
1374 bool compositedMask = renderer().hasLayer() && boxModelObject()->layer()->ha sCompositedMask(); 1373 bool compositedMask = renderer().hasLayer() && boxModelObject()->layer()->ha sCompositedMask();
1375 bool flattenCompositingLayers = renderer().view()->frameView() && renderer() .view()->frameView()->paintBehavior() & PaintBehaviorFlattenCompositingLayers; 1374 bool flattenCompositingLayers = renderer().view()->frameView() && renderer() .view()->frameView()->paintBehavior() & PaintBehaviorFlattenCompositingLayers;
1376 CompositeOperator compositeOp = CompositeSourceOver; 1375 CompositeOperator compositeOp = CompositeSourceOver;
1377 if (!compositedMask || flattenCompositingLayers) { 1376 if (!compositedMask || flattenCompositingLayers) {
1378 if ((maskBoxImage && renderer().style()->maskLayers()->hasImage()) || re nderer().style()->maskLayers()->next()) 1377 if ((maskBoxImage && renderer().style()->maskLayers().hasImage()) || ren derer().style()->maskLayers().next())
1379 pushTransparencyLayer = true; 1378 pushTransparencyLayer = true;
1380 1379
1381 compositeOp = CompositeDestinationIn; 1380 compositeOp = CompositeDestinationIn;
1382 if (pushTransparencyLayer) { 1381 if (pushTransparencyLayer) {
1383 paintInfo.context->setCompositeOperation(CompositeDestinationIn); 1382 paintInfo.context->setCompositeOperation(CompositeDestinationIn);
1384 paintInfo.context->beginTransparencyLayer(1.0f); 1383 paintInfo.context->beginTransparencyLayer(1.0f);
1385 compositeOp = CompositeSourceOver; 1384 compositeOp = CompositeSourceOver;
1386 } 1385 }
1387 } 1386 }
1388 1387
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1662 ASSERT(child->prevOnLine() == prev); 1661 ASSERT(child->prevOnLine() == prev);
1663 prev = child; 1662 prev = child;
1664 } 1663 }
1665 ASSERT(prev == m_lastChild); 1664 ASSERT(prev == m_lastChild);
1666 #endif 1665 #endif
1667 } 1666 }
1668 1667
1669 #endif 1668 #endif
1670 1669
1671 } // namespace WebCore 1670 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/InlineFlowBox.h ('k') | Source/core/rendering/RenderBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698