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

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

Issue 766943003: Remove uses of PaintBehaviorFlattenCompositingLayers (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years 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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 // Pixel snap mask painting. 1196 // Pixel snap mask painting.
1197 LayoutRect frameRect = roundedFrameRect(); 1197 LayoutRect frameRect = roundedFrameRect();
1198 1198
1199 // Move x/y to our coordinates. 1199 // Move x/y to our coordinates.
1200 LayoutRect localRect(frameRect); 1200 LayoutRect localRect(frameRect);
1201 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location(); 1201 LayoutPoint adjustedPaintOffset = paintOffset + localRect.location();
1202 1202
1203 const NinePieceImage& maskNinePieceImage = renderer().style()->maskBoxImage( ); 1203 const NinePieceImage& maskNinePieceImage = renderer().style()->maskBoxImage( );
1204 StyleImage* maskBoxImage = renderer().style()->maskBoxImage().image(); 1204 StyleImage* maskBoxImage = renderer().style()->maskBoxImage().image();
1205 1205
1206 // Figure out if we need to push a transparency layer to render our mask.
1207 bool pushTransparencyLayer = false;
1208 bool flattenCompositingLayers = renderer().view()->frameView() && renderer() .view()->frameView()->paintBehavior() & PaintBehaviorFlattenCompositingLayers;
1209 CompositeOperator compositeOp = CompositeSourceOver;
1210 if (flattenCompositingLayers) {
1211 if ((maskBoxImage && renderer().style()->maskLayers().hasImage()) || ren derer().style()->maskLayers().next())
1212 pushTransparencyLayer = true;
1213
1214 compositeOp = CompositeDestinationIn;
1215 if (pushTransparencyLayer) {
1216 paintInfo.context->setCompositeOperation(CompositeDestinationIn);
1217 paintInfo.context->beginTransparencyLayer(1.0f);
1218 compositeOp = CompositeSourceOver;
1219 }
1220 }
1221
1222 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, frameRect.size()); 1206 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, frameRect.size());
1223 paintFillLayers(paintInfo, Color::transparent, renderer().style()->maskLayer s(), paintRect, compositeOp); 1207 paintFillLayers(paintInfo, Color::transparent, renderer().style()->maskLayer s(), paintRect, CompositeSourceOver);
1224 1208
1225 bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(renderer()); 1209 bool hasBoxImage = maskBoxImage && maskBoxImage->canRender(renderer());
1226 if (!hasBoxImage || !maskBoxImage->isLoaded()) { 1210 if (!hasBoxImage || !maskBoxImage->isLoaded()) {
1227 if (pushTransparencyLayer)
1228 paintInfo.context->endLayer();
1229 return; // Don't paint anything while we wait for the image to load. 1211 return; // Don't paint anything while we wait for the image to load.
1230 } 1212 }
1231 1213
1232 // The simple case is where we are the only box for this object. In those 1214 // The simple case is where we are the only box for this object. In those
1233 // cases only a single call to draw is required. 1215 // cases only a single call to draw is required.
1234 if (!prevLineBox() && !nextLineBox()) { 1216 if (!prevLineBox() && !nextLineBox()) {
1235 boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(adju stedPaintOffset, frameRect.size()), renderer().style(), maskNinePieceImage, comp ositeOp); 1217 boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(adju stedPaintOffset, frameRect.size()), renderer().style(), maskNinePieceImage, Comp ositeSourceOver);
1236 } else { 1218 } else {
1237 // We have a mask image that spans multiple lines. 1219 // We have a mask image that spans multiple lines.
1238 // We need to adjust _tx and _ty by the width of all previous lines. 1220 // We need to adjust _tx and _ty by the width of all previous lines.
1239 LayoutUnit logicalOffsetOnLine = 0; 1221 LayoutUnit logicalOffsetOnLine = 0;
1240 for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox ()) 1222 for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox ())
1241 logicalOffsetOnLine += curr->logicalWidth(); 1223 logicalOffsetOnLine += curr->logicalWidth();
1242 LayoutUnit totalLogicalWidth = logicalOffsetOnLine; 1224 LayoutUnit totalLogicalWidth = logicalOffsetOnLine;
1243 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox()) 1225 for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
1244 totalLogicalWidth += curr->logicalWidth(); 1226 totalLogicalWidth += curr->logicalWidth();
1245 LayoutUnit stripX = adjustedPaintOffset.x() - logicalOffsetOnLine; 1227 LayoutUnit stripX = adjustedPaintOffset.x() - logicalOffsetOnLine;
1246 LayoutUnit stripY = adjustedPaintOffset.y(); 1228 LayoutUnit stripY = adjustedPaintOffset.y();
1247 LayoutUnit stripWidth = totalLogicalWidth; 1229 LayoutUnit stripWidth = totalLogicalWidth;
1248 LayoutUnit stripHeight = frameRect.height(); 1230 LayoutUnit stripHeight = frameRect.height();
1249 1231
1250 LayoutRect clipRect = clipRectForNinePieceImageStrip(this, maskNinePiece Image, paintRect); 1232 LayoutRect clipRect = clipRectForNinePieceImageStrip(this, maskNinePiece Image, paintRect);
1251 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1233 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1252 paintInfo.context->clip(clipRect); 1234 paintInfo.context->clip(clipRect);
1253 boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(stri pX, stripY, stripWidth, stripHeight), renderer().style(), maskNinePieceImage, co mpositeOp); 1235 boxModelObject()->paintNinePieceImage(paintInfo.context, LayoutRect(stri pX, stripY, stripWidth, stripHeight), renderer().style(), maskNinePieceImage, Co mpositeSourceOver);
1254 } 1236 }
1255
1256 if (pushTransparencyLayer)
1257 paintInfo.context->endLayer();
1258 } 1237 }
1259 1238
1260 InlineBox* InlineFlowBox::firstLeafChild() const 1239 InlineBox* InlineFlowBox::firstLeafChild() const
1261 { 1240 {
1262 InlineBox* leaf = 0; 1241 InlineBox* leaf = 0;
1263 for (InlineBox* child = firstChild(); child && !leaf; child = child->nextOnL ine()) 1242 for (InlineBox* child = firstChild(); child && !leaf; child = child->nextOnL ine())
1264 leaf = child->isLeaf() ? child : toInlineFlowBox(child)->firstLeafChild( ); 1243 leaf = child->isLeaf() ? child : toInlineFlowBox(child)->firstLeafChild( );
1265 return leaf; 1244 return leaf;
1266 } 1245 }
1267 1246
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 ASSERT(child->prevOnLine() == prev); 1425 ASSERT(child->prevOnLine() == prev);
1447 prev = child; 1426 prev = child;
1448 } 1427 }
1449 ASSERT(prev == m_lastChild); 1428 ASSERT(prev == m_lastChild);
1450 #endif 1429 #endif
1451 } 1430 }
1452 1431
1453 #endif 1432 #endif
1454 1433
1455 } // namespace blink 1434 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/rendering/PaintPhase.h » ('j') | sky/engine/core/rendering/RenderBox.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698