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

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

Issue 21430003: Implement interfaces in PaintInfo and make it a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getterPaintInfo01
Patch Set: Second try Created 7 years, 4 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 void RenderBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 1049 void RenderBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
1050 { 1050 {
1051 LayoutPoint adjustedPaintOffset = paintOffset + location(); 1051 LayoutPoint adjustedPaintOffset = paintOffset + location();
1052 // default implementation. Just pass paint through to the children 1052 // default implementation. Just pass paint through to the children
1053 PaintInfo childInfo(paintInfo); 1053 PaintInfo childInfo(paintInfo);
1054 childInfo.updatePaintingRootForChildren(this); 1054 childInfo.updatePaintingRootForChildren(this);
1055 for (RenderObject* child = firstChild(); child; child = child->nextSibling() ) 1055 for (RenderObject* child = firstChild(); child; child = child->nextSibling() )
1056 child->paint(childInfo, adjustedPaintOffset); 1056 child->paint(childInfo, adjustedPaintOffset);
1057 } 1057 }
1058 1058
1059 void RenderBox::paintRootBoxFillLayers(const PaintInfo& paintInfo) 1059 void RenderBox::paintRootBoxFillLayers(PaintInfo& paintInfo)
1060 { 1060 {
1061 if (paintInfo.skipRootBackground()) 1061 if (paintInfo.skipRootBackground())
1062 return; 1062 return;
1063 1063
1064 RenderObject* rootBackgroundRenderer = rendererForRootBackground(); 1064 RenderObject* rootBackgroundRenderer = rendererForRootBackground();
1065 1065
1066 const FillLayer* bgLayer = rootBackgroundRenderer->style()->backgroundLayers (); 1066 const FillLayer* bgLayer = rootBackgroundRenderer->style()->backgroundLayers ();
1067 Color bgColor = rootBackgroundRenderer->resolveColor(CSSPropertyBackgroundCo lor); 1067 Color bgColor = rootBackgroundRenderer->resolveColor(CSSPropertyBackgroundCo lor);
1068 1068
1069 paintFillLayers(paintInfo, bgColor, bgLayer, view()->backgroundRect(this), B ackgroundBleedNone, CompositeSourceOver, rootBackgroundRenderer); 1069 paintFillLayers(paintInfo, bgColor, bgLayer, view()->backgroundRect(this), B ackgroundBleedNone, CompositeSourceOver, rootBackgroundRenderer);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 return BackgroundBleedBackgroundOverBorder; 1102 return BackgroundBleedBackgroundOverBorder;
1103 1103
1104 return BackgroundBleedUseTransparencyLayer; 1104 return BackgroundBleedUseTransparencyLayer;
1105 } 1105 }
1106 1106
1107 void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& pai ntOffset) 1107 void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& pai ntOffset)
1108 { 1108 {
1109 if (!paintInfo.shouldPaintWithinRoot(this)) 1109 if (!paintInfo.shouldPaintWithinRoot(this))
1110 return; 1110 return;
1111 1111
1112 LayoutRect paintRect = borderBoxRectInRegion(paintInfo.renderRegion); 1112 LayoutRect paintRect = borderBoxRectInRegion(paintInfo.getRenderRegion());
1113 paintRect.moveBy(paintOffset); 1113 paintRect.moveBy(paintOffset);
1114 1114
1115 BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance( paintInfo.context); 1115 BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance( paintInfo.getContext());
1116 1116
1117 // FIXME: Should eventually give the theme control over whether the box shad ow should paint, since controls could have 1117 // FIXME: Should eventually give the theme control over whether the box shad ow should paint, since controls could have
1118 // custom shadows of their own. 1118 // custom shadows of their own.
1119 if (!boxShadowShouldBeAppliedToBackground(bleedAvoidance)) 1119 if (!boxShadowShouldBeAppliedToBackground(bleedAvoidance))
1120 paintBoxShadow(paintInfo, paintRect, style(), Normal); 1120 paintBoxShadow(paintInfo, paintRect, style(), Normal);
1121 1121
1122 GraphicsContextStateSaver stateSaver(*paintInfo.context, false); 1122 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext()), false);
1123 if (bleedAvoidance == BackgroundBleedUseTransparencyLayer) { 1123 if (bleedAvoidance == BackgroundBleedUseTransparencyLayer) {
1124 // To avoid the background color bleeding out behind the border, we'll r ender background and border 1124 // To avoid the background color bleeding out behind the border, we'll r ender background and border
1125 // into a transparency layer, and then clip that in one go (which requir es setting up the clip before 1125 // into a transparency layer, and then clip that in one go (which requir es setting up the clip before
1126 // beginning the layer). 1126 // beginning the layer).
1127 RoundedRect border = style()->getRoundedBorderFor(paintRect, view()); 1127 RoundedRect border = style()->getRoundedBorderFor(paintRect, view());
1128 stateSaver.save(); 1128 stateSaver.save();
1129 paintInfo.context->clipRoundedRect(border); 1129 paintInfo.getContext()->clipRoundedRect(border);
1130 paintInfo.context->beginTransparencyLayer(1); 1130 paintInfo.getContext()->beginTransparencyLayer(1);
1131 } 1131 }
1132 1132
1133 // If we have a native theme appearance, paint that before painting our back ground. 1133 // If we have a native theme appearance, paint that before painting our back ground.
1134 // The theme will tell us whether or not we should also paint the CSS backgr ound. 1134 // The theme will tell us whether or not we should also paint the CSS backgr ound.
1135 IntRect snappedPaintRect(pixelSnappedIntRect(paintRect)); 1135 IntRect snappedPaintRect(pixelSnappedIntRect(paintRect));
1136 bool themePainted = style()->hasAppearance() && !theme()->paint(this, paintI nfo, snappedPaintRect); 1136 bool themePainted = style()->hasAppearance() && !theme()->paint(this, paintI nfo, snappedPaintRect);
1137 if (!themePainted) { 1137 if (!themePainted) {
1138 if (bleedAvoidance == BackgroundBleedBackgroundOverBorder) 1138 if (bleedAvoidance == BackgroundBleedBackgroundOverBorder)
1139 paintBorder(paintInfo, paintRect, style(), bleedAvoidance); 1139 paintBorder(paintInfo, paintRect, style(), bleedAvoidance);
1140 1140
1141 paintBackground(paintInfo, paintRect, bleedAvoidance); 1141 paintBackground(paintInfo, paintRect, bleedAvoidance);
1142 1142
1143 if (style()->hasAppearance()) 1143 if (style()->hasAppearance())
1144 theme()->paintDecorations(this, paintInfo, snappedPaintRect); 1144 theme()->paintDecorations(this, paintInfo, snappedPaintRect);
1145 } 1145 }
1146 paintBoxShadow(paintInfo, paintRect, style(), Inset); 1146 paintBoxShadow(paintInfo, paintRect, style(), Inset);
1147 1147
1148 // The theme will tell us whether or not we should also paint the CSS border . 1148 // The theme will tell us whether or not we should also paint the CSS border .
1149 if (bleedAvoidance != BackgroundBleedBackgroundOverBorder && (!style()->hasA ppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, snapp edPaintRect))) && style()->hasBorder()) 1149 if (bleedAvoidance != BackgroundBleedBackgroundOverBorder && (!style()->hasA ppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, snapp edPaintRect))) && style()->hasBorder())
1150 paintBorder(paintInfo, paintRect, style(), bleedAvoidance); 1150 paintBorder(paintInfo, paintRect, style(), bleedAvoidance);
1151 1151
1152 if (bleedAvoidance == BackgroundBleedUseTransparencyLayer) 1152 if (bleedAvoidance == BackgroundBleedUseTransparencyLayer)
1153 paintInfo.context->endTransparencyLayer(); 1153 paintInfo.getContext()->endTransparencyLayer();
1154 } 1154 }
1155 1155
1156 void RenderBox::paintBackground(const PaintInfo& paintInfo, const LayoutRect& pa intRect, BackgroundBleedAvoidance bleedAvoidance) 1156 void RenderBox::paintBackground(PaintInfo& paintInfo, const LayoutRect& paintRec t, BackgroundBleedAvoidance bleedAvoidance)
1157 { 1157 {
1158 if (isRoot()) { 1158 if (isRoot()) {
1159 paintRootBoxFillLayers(paintInfo); 1159 paintRootBoxFillLayers(paintInfo);
1160 return; 1160 return;
1161 } 1161 }
1162 if (isBody() && skipBodyBackground(this)) 1162 if (isBody() && skipBodyBackground(this))
1163 return; 1163 return;
1164 if (backgroundIsKnownToBeObscured()) 1164 if (backgroundIsKnownToBeObscured())
1165 return; 1165 return;
1166 paintFillLayers(paintInfo, resolveColor(CSSPropertyBackgroundColor), style() ->backgroundLayers(), paintRect, bleedAvoidance); 1166 paintFillLayers(paintInfo, resolveColor(CSSPropertyBackgroundColor), style() ->backgroundLayers(), paintRect, bleedAvoidance);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 StyleColor bgColor = resolveStyleColor(CSSPropertyBackgroundColor); 1307 StyleColor bgColor = resolveStyleColor(CSSPropertyBackgroundColor);
1308 if (bgColor.isValid() && bgColor.alpha() == 255) 1308 if (bgColor.isValid() && bgColor.alpha() == 255)
1309 return true; 1309 return true;
1310 } 1310 }
1311 1311
1312 return false; 1312 return false;
1313 } 1313 }
1314 1314
1315 void RenderBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 1315 void RenderBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
1316 { 1316 {
1317 if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIB LE || paintInfo.phase != PaintPhaseMask || paintInfo.context->paintingDisabled() ) 1317 if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIB LE || paintInfo.getPhase() != PaintPhaseMask || paintInfo.getContext()->painting Disabled())
1318 return; 1318 return;
1319 1319
1320 LayoutRect paintRect = LayoutRect(paintOffset, size()); 1320 LayoutRect paintRect = LayoutRect(paintOffset, size());
1321 paintMaskImages(paintInfo, paintRect); 1321 paintMaskImages(paintInfo, paintRect);
1322 } 1322 }
1323 1323
1324 void RenderBox::paintMaskImages(const PaintInfo& paintInfo, const LayoutRect& pa intRect) 1324 void RenderBox::paintMaskImages(PaintInfo& paintInfo, const LayoutRect& paintRec t)
1325 { 1325 {
1326 // Figure out if we need to push a transparency layer to render our mask. 1326 // Figure out if we need to push a transparency layer to render our mask.
1327 bool pushTransparencyLayer = false; 1327 bool pushTransparencyLayer = false;
1328 bool compositedMask = hasLayer() && layer()->hasCompositedMask(); 1328 bool compositedMask = hasLayer() && layer()->hasCompositedMask();
1329 bool flattenCompositingLayers = view()->frameView() && view()->frameView()-> paintBehavior() & PaintBehaviorFlattenCompositingLayers; 1329 bool flattenCompositingLayers = view()->frameView() && view()->frameView()-> paintBehavior() & PaintBehaviorFlattenCompositingLayers;
1330 CompositeOperator compositeOp = CompositeSourceOver; 1330 CompositeOperator compositeOp = CompositeSourceOver;
1331 1331
1332 bool allMaskImagesLoaded = true; 1332 bool allMaskImagesLoaded = true;
1333 1333
1334 if (!compositedMask || flattenCompositingLayers) { 1334 if (!compositedMask || flattenCompositingLayers) {
1335 pushTransparencyLayer = true; 1335 pushTransparencyLayer = true;
1336 StyleImage* maskBoxImage = style()->maskBoxImage().image(); 1336 StyleImage* maskBoxImage = style()->maskBoxImage().image();
1337 const FillLayer* maskLayers = style()->maskLayers(); 1337 const FillLayer* maskLayers = style()->maskLayers();
1338 1338
1339 // Don't render a masked element until all the mask images have loaded, to prevent a flash of unmasked content. 1339 // Don't render a masked element until all the mask images have loaded, to prevent a flash of unmasked content.
1340 if (maskBoxImage) 1340 if (maskBoxImage)
1341 allMaskImagesLoaded &= maskBoxImage->isLoaded(); 1341 allMaskImagesLoaded &= maskBoxImage->isLoaded();
1342 1342
1343 if (maskLayers) 1343 if (maskLayers)
1344 allMaskImagesLoaded &= maskLayers->imagesAreLoaded(); 1344 allMaskImagesLoaded &= maskLayers->imagesAreLoaded();
1345 1345
1346 paintInfo.context->setCompositeOperation(CompositeDestinationIn); 1346 paintInfo.getContext()->setCompositeOperation(CompositeDestinationIn);
1347 paintInfo.context->beginTransparencyLayer(1); 1347 paintInfo.getContext()->beginTransparencyLayer(1);
1348 compositeOp = CompositeSourceOver; 1348 compositeOp = CompositeSourceOver;
1349 } 1349 }
1350 1350
1351 if (allMaskImagesLoaded) { 1351 if (allMaskImagesLoaded) {
1352 paintFillLayers(paintInfo, Color(), style()->maskLayers(), paintRect, Ba ckgroundBleedNone, compositeOp); 1352 paintFillLayers(paintInfo, Color(), style()->maskLayers(), paintRect, Ba ckgroundBleedNone, compositeOp);
1353 paintNinePieceImage(paintInfo.context, paintRect, style(), style()->mask BoxImage(), compositeOp); 1353 paintNinePieceImage(paintInfo.getContext(), paintRect, style(), style()- >maskBoxImage(), compositeOp);
1354 } 1354 }
1355 1355
1356 if (pushTransparencyLayer) 1356 if (pushTransparencyLayer)
1357 paintInfo.context->endTransparencyLayer(); 1357 paintInfo.getContext()->endTransparencyLayer();
1358 } 1358 }
1359 1359
1360 LayoutRect RenderBox::maskClipRect() 1360 LayoutRect RenderBox::maskClipRect()
1361 { 1361 {
1362 const NinePieceImage& maskBoxImage = style()->maskBoxImage(); 1362 const NinePieceImage& maskBoxImage = style()->maskBoxImage();
1363 if (maskBoxImage.image()) { 1363 if (maskBoxImage.image()) {
1364 LayoutRect borderImageRect = borderBoxRect(); 1364 LayoutRect borderImageRect = borderBoxRect();
1365 1365
1366 // Apply outsets to the border box. 1366 // Apply outsets to the border box.
1367 borderImageRect.expand(style()->maskBoxImageOutsets()); 1367 borderImageRect.expand(style()->maskBoxImageOutsets());
1368 return borderImageRect; 1368 return borderImageRect;
1369 } 1369 }
1370 1370
1371 LayoutRect result; 1371 LayoutRect result;
1372 LayoutRect borderBox = borderBoxRect(); 1372 LayoutRect borderBox = borderBoxRect();
1373 for (const FillLayer* maskLayer = style()->maskLayers(); maskLayer; maskLaye r = maskLayer->next()) { 1373 for (const FillLayer* maskLayer = style()->maskLayers(); maskLayer; maskLaye r = maskLayer->next()) {
1374 if (maskLayer->image()) { 1374 if (maskLayer->image()) {
1375 BackgroundImageGeometry geometry; 1375 BackgroundImageGeometry geometry;
1376 calculateBackgroundImageGeometry(maskLayer, borderBox, geometry); 1376 calculateBackgroundImageGeometry(maskLayer, borderBox, geometry);
1377 result.unite(geometry.destRect()); 1377 result.unite(geometry.destRect());
1378 } 1378 }
1379 } 1379 }
1380 return result; 1380 return result;
1381 } 1381 }
1382 1382
1383 void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, cons t FillLayer* fillLayer, const LayoutRect& rect, 1383 void RenderBox::paintFillLayers(PaintInfo& paintInfo, const Color& c, const Fill Layer* fillLayer, const LayoutRect& rect,
1384 BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject* backgroundObject) 1384 BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject* backgroundObject)
1385 { 1385 {
1386 Vector<const FillLayer*, 8> layers; 1386 Vector<const FillLayer*, 8> layers;
1387 const FillLayer* curLayer = fillLayer; 1387 const FillLayer* curLayer = fillLayer;
1388 bool shouldDrawBackgroundInSeparateBuffer = false; 1388 bool shouldDrawBackgroundInSeparateBuffer = false;
1389 while (curLayer) { 1389 while (curLayer) {
1390 layers.append(curLayer); 1390 layers.append(curLayer);
1391 // Stop traversal when an opaque layer is encountered. 1391 // Stop traversal when an opaque layer is encountered.
1392 // FIXME : It would be possible for the following occlusion culling test to be more aggressive 1392 // FIXME : It would be possible for the following occlusion culling test to be more aggressive
1393 // on layers with no repeat by testing whether the image covers the layo ut rect. 1393 // on layers with no repeat by testing whether the image covers the layo ut rect.
1394 // Testing that here would imply duplicating a lot of calculations that are currently done in 1394 // Testing that here would imply duplicating a lot of calculations that are currently done in
1395 // RenderBoxModelObject::paintFillLayerExtended. A more efficient soluti on might be to move 1395 // RenderBoxModelObject::paintFillLayerExtended. A more efficient soluti on might be to move
1396 // the layer recursion into paintFillLayerExtended, or to compute the la yer geometry here 1396 // the layer recursion into paintFillLayerExtended, or to compute the la yer geometry here
1397 // and pass it down. 1397 // and pass it down.
1398 1398
1399 if (!shouldDrawBackgroundInSeparateBuffer && curLayer->blendMode() != Bl endModeNormal) 1399 if (!shouldDrawBackgroundInSeparateBuffer && curLayer->blendMode() != Bl endModeNormal)
1400 shouldDrawBackgroundInSeparateBuffer = true; 1400 shouldDrawBackgroundInSeparateBuffer = true;
1401 1401
1402 // The clipOccludesNextLayers condition must be evaluated first to avoid short-circuiting. 1402 // The clipOccludesNextLayers condition must be evaluated first to avoid short-circuiting.
1403 if (curLayer->clipOccludesNextLayers(curLayer == fillLayer) && curLayer- >hasOpaqueImage(this) && curLayer->image()->canRender(this, style()->effectiveZo om()) && curLayer->hasRepeatXY() && curLayer->blendMode() == BlendModeNormal) 1403 if (curLayer->clipOccludesNextLayers(curLayer == fillLayer) && curLayer- >hasOpaqueImage(this) && curLayer->image()->canRender(this, style()->effectiveZo om()) && curLayer->hasRepeatXY() && curLayer->blendMode() == BlendModeNormal)
1404 break; 1404 break;
1405 curLayer = curLayer->next(); 1405 curLayer = curLayer->next();
1406 } 1406 }
1407 1407
1408 GraphicsContext* context = paintInfo.context; 1408 GraphicsContext* context = paintInfo.getContext();
1409 if (!context) 1409 if (!context)
1410 shouldDrawBackgroundInSeparateBuffer = false; 1410 shouldDrawBackgroundInSeparateBuffer = false;
1411 if (shouldDrawBackgroundInSeparateBuffer) 1411 if (shouldDrawBackgroundInSeparateBuffer)
1412 context->beginTransparencyLayer(1); 1412 context->beginTransparencyLayer(1);
1413 1413
1414 Vector<const FillLayer*>::const_reverse_iterator topLayer = layers.rend(); 1414 Vector<const FillLayer*>::const_reverse_iterator topLayer = layers.rend();
1415 for (Vector<const FillLayer*>::const_reverse_iterator it = layers.rbegin(); it != topLayer; ++it) 1415 for (Vector<const FillLayer*>::const_reverse_iterator it = layers.rbegin(); it != topLayer; ++it)
1416 paintFillLayer(paintInfo, c, *it, rect, bleedAvoidance, op, backgroundOb ject); 1416 paintFillLayer(paintInfo, c, *it, rect, bleedAvoidance, op, backgroundOb ject);
1417 1417
1418 if (shouldDrawBackgroundInSeparateBuffer) 1418 if (shouldDrawBackgroundInSeparateBuffer)
1419 context->endTransparencyLayer(); 1419 context->endTransparencyLayer();
1420 } 1420 }
1421 1421
1422 void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, 1422 void RenderBox::paintFillLayer(PaintInfo& paintInfo, const Color& c, const FillL ayer* fillLayer, const LayoutRect& rect,
1423 BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject* backgroundObject) 1423 BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject* backgroundObject)
1424 { 1424 {
1425 paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, Lay outSize(), op, backgroundObject); 1425 paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, Lay outSize(), op, backgroundObject);
1426 } 1426 }
1427 1427
1428 static bool layersUseImage(WrappedImagePtr image, const FillLayer* layers) 1428 static bool layersUseImage(WrappedImagePtr image, const FillLayer* layers)
1429 { 1429 {
1430 for (const FillLayer* curLayer = layers; curLayer; curLayer = curLayer->next ()) { 1430 for (const FillLayer* curLayer = layers; curLayer; curLayer = curLayer->next ()) {
1431 if (curLayer->image() && image == curLayer->image()->data()) 1431 if (curLayer->image() && image == curLayer->image()->data())
1432 return true; 1432 return true;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 layerRenderer->repaintRectangle(geometry.destRect()); 1494 layerRenderer->repaintRectangle(geometry.destRect());
1495 if (geometry.destRect() == rendererRect) 1495 if (geometry.destRect() == rendererRect)
1496 return true; 1496 return true;
1497 } 1497 }
1498 } 1498 }
1499 return false; 1499 return false;
1500 } 1500 }
1501 1501
1502 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu latedOffset) 1502 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu latedOffset)
1503 { 1503 {
1504 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == Paint PhaseSelfOutline || paintInfo.phase == PaintPhaseMask) 1504 if (paintInfo.getPhase() == PaintPhaseBlockBackground || paintInfo.getPhase( ) == PaintPhaseSelfOutline || paintInfo.getPhase() == PaintPhaseMask)
1505 return false; 1505 return false;
1506 1506
1507 bool isControlClip = hasControlClip(); 1507 bool isControlClip = hasControlClip();
1508 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer(); 1508 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer();
1509 1509
1510 if (!isControlClip && !isOverflowClip) 1510 if (!isControlClip && !isOverflowClip)
1511 return false; 1511 return false;
1512 1512
1513 if (paintInfo.phase == PaintPhaseOutline) 1513 if (paintInfo.getPhase() == PaintPhaseOutline) {
1514 paintInfo.phase = PaintPhaseChildOutlines; 1514 paintInfo.setPhase(PaintPhaseChildOutlines);
1515 else if (paintInfo.phase == PaintPhaseChildBlockBackground) { 1515 } else if (paintInfo.getPhase() == PaintPhaseChildBlockBackground) {
1516 paintInfo.phase = PaintPhaseBlockBackground; 1516 paintInfo.setPhase(PaintPhaseBlockBackground);
1517 paintObject(paintInfo, accumulatedOffset); 1517 paintObject(paintInfo, accumulatedOffset);
1518 paintInfo.phase = PaintPhaseChildBlockBackgrounds; 1518 paintInfo.setPhase(PaintPhaseChildBlockBackgrounds);
1519 } 1519 }
1520 IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accum ulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderRegion)); 1520 IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accum ulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.getRenderRegion()) );
1521 paintInfo.context->save(); 1521 paintInfo.getContext()->save();
1522 if (style()->hasBorderRadius()) 1522 if (style()->hasBorderRadius())
1523 paintInfo.context->clipRoundedRect(style()->getRoundedInnerBorderFor(Lay outRect(accumulatedOffset, size()))); 1523 paintInfo.getContext()->clipRoundedRect(style()->getRoundedInnerBorderFo r(LayoutRect(accumulatedOffset, size())));
1524 paintInfo.context->clip(clipRect); 1524 paintInfo.getContext()->clip(clipRect);
1525 return true; 1525 return true;
1526 } 1526 }
1527 1527
1528 void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase, const LayoutPoint& accumulatedOffset) 1528 void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase, const LayoutPoint& accumulatedOffset)
1529 { 1529 {
1530 ASSERT(hasControlClip() || (hasOverflowClip() && !layer()->isSelfPaintingLay er())); 1530 ASSERT(hasControlClip() || (hasOverflowClip() && !layer()->isSelfPaintingLay er()));
1531 1531
1532 paintInfo.context->restore(); 1532 paintInfo.getContext()->restore();
1533 if (originalPhase == PaintPhaseOutline) { 1533 if (originalPhase == PaintPhaseOutline) {
1534 paintInfo.phase = PaintPhaseSelfOutline; 1534 paintInfo.setPhase(PaintPhaseSelfOutline);
1535 paintObject(paintInfo, accumulatedOffset); 1535 paintObject(paintInfo, accumulatedOffset);
1536 paintInfo.phase = originalPhase; 1536 paintInfo.setPhase(originalPhase);
1537 } else if (originalPhase == PaintPhaseChildBlockBackground) 1537 } else if (originalPhase == PaintPhaseChildBlockBackground) {
1538 paintInfo.phase = originalPhase; 1538 paintInfo.setPhase(originalPhase);
1539 }
1539 } 1540 }
1540 1541
1541 LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, RenderRegion * region, OverlayScrollbarSizeRelevancy relevancy) 1542 LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, RenderRegion * region, OverlayScrollbarSizeRelevancy relevancy)
1542 { 1543 {
1543 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the propert y 1544 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the propert y
1544 // here. 1545 // here.
1545 LayoutRect clipRect = borderBoxRectInRegion(region); 1546 LayoutRect clipRect = borderBoxRectInRegion(region);
1546 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft( ), borderTop())); 1547 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft( ), borderTop()));
1547 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom())); 1548 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
1548 1549
(...skipping 3121 matching lines...) Expand 10 before | Expand all | Expand 10 after
4670 } 4671 }
4671 4672
4672 if (didSplitParentAnonymousBoxes) 4673 if (didSplitParentAnonymousBoxes)
4673 markBoxForRelayoutAfterSplit(this); 4674 markBoxForRelayoutAfterSplit(this);
4674 4675
4675 ASSERT(beforeChild->parent() == this); 4676 ASSERT(beforeChild->parent() == this);
4676 return beforeChild; 4677 return beforeChild;
4677 } 4678 }
4678 4679
4679 } // namespace WebCore 4680 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698