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

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

Issue 27030009: Revert "Make compositingState explicit (re-land #2 with bogus ASSERT removed)" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix build error Created 7 years, 2 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/RenderLayer.h ('k') | Source/core/rendering/RenderLayerCompositor.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) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 m_compositedLayerMapping->contentChanged(changeType); 213 m_compositedLayerMapping->contentChanged(changeType);
214 } 214 }
215 215
216 bool RenderLayer::canRender3DTransforms() const 216 bool RenderLayer::canRender3DTransforms() const
217 { 217 {
218 return compositor()->canRender3DTransforms(); 218 return compositor()->canRender3DTransforms();
219 } 219 }
220 220
221 bool RenderLayer::paintsWithFilters() const 221 bool RenderLayer::paintsWithFilters() const
222 { 222 {
223 // FIXME: Eventually there will be more factors than isComposited() to decid e whether or not to render the filter
223 if (!renderer()->hasFilter()) 224 if (!renderer()->hasFilter())
224 return false; 225 return false;
225 226
226 if (compositingState() != PaintsIntoOwnBacking) 227 if (!isComposited())
227 return true; 228 return true;
228 229
229 if (!m_compositedLayerMapping || !m_compositedLayerMapping->canCompositeFilt ers()) 230 if (!m_compositedLayerMapping || !m_compositedLayerMapping->canCompositeFilt ers())
230 return true; 231 return true;
231 232
232 return false; 233 return false;
233 } 234 }
234 235
235 bool RenderLayer::requiresFullLayerImageForFilters() const 236 bool RenderLayer::requiresFullLayerImageForFilters() const
236 { 237 {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 304 }
304 305
305 repainter().repaintAfterLayout(geometryMap, flags & CheckForRepaint); 306 repainter().repaintAfterLayout(geometryMap, flags & CheckForRepaint);
306 307
307 // Go ahead and update the reflection's position and size. 308 // Go ahead and update the reflection's position and size.
308 if (m_reflection) 309 if (m_reflection)
309 m_reflection->layout(); 310 m_reflection->layout();
310 311
311 // Clear the IsCompositingUpdateRoot flag once we've found the first composi ting layer in this update. 312 // Clear the IsCompositingUpdateRoot flag once we've found the first composi ting layer in this update.
312 bool isUpdateRoot = (flags & IsCompositingUpdateRoot); 313 bool isUpdateRoot = (flags & IsCompositingUpdateRoot);
313 if (compositedLayerMapping()) 314 if (isComposited())
314 flags &= ~IsCompositingUpdateRoot; 315 flags &= ~IsCompositingUpdateRoot;
315 316
316 if (useRegionBasedColumns() && renderer()->isInFlowRenderFlowThread()) { 317 if (useRegionBasedColumns() && renderer()->isInFlowRenderFlowThread()) {
317 updatePagination(); 318 updatePagination();
318 flags |= UpdatePagination; 319 flags |= UpdatePagination;
319 } 320 }
320 321
321 if (renderer()->hasColumns()) 322 if (renderer()->hasColumns())
322 flags |= UpdatePagination; 323 flags |= UpdatePagination;
323 324
324 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) 325 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
325 child->updateLayerPositions(geometryMap, flags); 326 child->updateLayerPositions(geometryMap, flags);
326 327
327 if ((flags & UpdateCompositingLayers) && compositedLayerMapping()) { 328 if ((flags & UpdateCompositingLayers) && isComposited()) {
328 CompositedLayerMapping::UpdateAfterLayoutFlags updateFlags = CompositedL ayerMapping::CompositingChildrenOnly; 329 CompositedLayerMapping::UpdateAfterLayoutFlags updateFlags = CompositedL ayerMapping::CompositingChildrenOnly;
329 if (flags & NeedsFullRepaintInBacking) 330 if (flags & NeedsFullRepaintInBacking)
330 updateFlags |= CompositedLayerMapping::NeedsFullRepaint; 331 updateFlags |= CompositedLayerMapping::NeedsFullRepaint;
331 if (isUpdateRoot) 332 if (isUpdateRoot)
332 updateFlags |= CompositedLayerMapping::IsUpdateRoot; 333 updateFlags |= CompositedLayerMapping::IsUpdateRoot;
333 compositedLayerMapping()->updateAfterLayout(updateFlags); 334 compositedLayerMapping()->updateAfterLayout(updateFlags);
334 } 335 }
335 336
336 if (geometryMap) 337 if (geometryMap)
337 geometryMap->popMappingsToAncestor(parent()); 338 geometryMap->popMappingsToAncestor(parent());
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 { 837 {
837 const Settings* settings = renderer()->document().settings(); 838 const Settings* settings = renderer()->document().settings();
838 return settings && settings->regionBasedColumnsEnabled(); 839 return settings && settings->regionBasedColumnsEnabled();
839 } 840 }
840 841
841 void RenderLayer::updatePagination() 842 void RenderLayer::updatePagination()
842 { 843 {
843 m_isPaginated = false; 844 m_isPaginated = false;
844 m_enclosingPaginationLayer = 0; 845 m_enclosingPaginationLayer = 0;
845 846
846 if (compositedLayerMapping() || !parent()) 847 if (isComposited() || !parent())
847 return; // FIXME: We will have to deal with paginated compositing layers someday. 848 return; // FIXME: We will have to deal with paginated compositing layers someday.
848 // FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though. 849 // FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though.
849 850
850 // The main difference between the paginated booleans for the old column cod e and the new column code 851 // The main difference between the paginated booleans for the old column cod e and the new column code
851 // is that each paginated layer has to paint on its own with the new code. T here is no 852 // is that each paginated layer has to paint on its own with the new code. T here is no
852 // recurring into child layers. This means that the m_isPaginated bits for t he new column code can't just be set on 853 // recurring into child layers. This means that the m_isPaginated bits for t he new column code can't just be set on
853 // "roots" that get split and paint all their descendants. Instead each laye r has to be checked individually and 854 // "roots" that get split and paint all their descendants. Instead each laye r has to be checked individually and
854 // genuinely know if it is going to have to split itself up when painting on ly its contents (and not any other descendant 855 // genuinely know if it is going to have to split itself up when painting on ly its contents (and not any other descendant
855 // layers). We track an enclosingPaginationLayer instead of using a simple b it, since we want to be able to get back 856 // layers). We track an enclosingPaginationLayer instead of using a simple b it, since we want to be able to get back
856 // to that layer easily. 857 // to that layer easily.
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 if (positionedParent->renderer()->hasOverflowClip()) { 1188 if (positionedParent->renderer()->hasOverflowClip()) {
1188 LayoutSize offset = positionedParent->scrolledContentOffset(); 1189 LayoutSize offset = positionedParent->scrolledContentOffset();
1189 localPoint -= offset; 1190 localPoint -= offset;
1190 } 1191 }
1191 1192
1192 if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()- >isInFlowPositioned() && positionedParent->renderer()->isRenderInline()) { 1193 if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()- >isInFlowPositioned() && positionedParent->renderer()->isRenderInline()) {
1193 LayoutSize offset = toRenderInline(positionedParent->renderer())->of fsetForInFlowPositionedInline(toRenderBox(renderer())); 1194 LayoutSize offset = toRenderInline(positionedParent->renderer())->of fsetForInFlowPositionedInline(toRenderBox(renderer()));
1194 localPoint += offset; 1195 localPoint += offset;
1195 } 1196 }
1196 } else if (parent()) { 1197 } else if (parent()) {
1197 if (compositedLayerMapping()) { 1198 if (isComposited()) {
1198 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column. 1199 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column.
1199 // They won't split across columns properly. 1200 // They won't split across columns properly.
1200 LayoutSize columnOffset; 1201 LayoutSize columnOffset;
1201 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isR oot() && renderer()->view()->hasColumns()) 1202 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isR oot() && renderer()->view()->hasColumns())
1202 renderer()->view()->adjustForColumns(columnOffset, localPoint); 1203 renderer()->view()->adjustForColumns(columnOffset, localPoint);
1203 else 1204 else
1204 parent()->renderer()->adjustForColumns(columnOffset, localPoint) ; 1205 parent()->renderer()->adjustForColumns(columnOffset, localPoint) ;
1205 1206
1206 localPoint += columnOffset; 1207 localPoint += columnOffset;
1207 } 1208 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 curr = curr->parent(); 1318 curr = curr->parent();
1318 1319
1319 return curr; 1320 return curr;
1320 } 1321 }
1321 1322
1322 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) 1323 static inline const RenderLayer* compositingContainer(const RenderLayer* layer)
1323 { 1324 {
1324 return layer->isNormalFlowOnly() ? layer->parent() : layer->ancestorStacking Container(); 1325 return layer->isNormalFlowOnly() ? layer->parent() : layer->ancestorStacking Container();
1325 } 1326 }
1326 1327
1327 // FIXME: having two different functions named enclosingCompositingLayer and enc losingCompositingLayerForRepaint
1328 // is error-prone and misleading for reading code that uses these functions - es pecially compounded with
1329 // the includeSelf option. It is very likely that some call sites of this functi on actually mean to use
1330 // enclosingCompositingLayerForRepaint().
1331 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const 1328 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const
1332 { 1329 {
1333 if (includeSelf && compositedLayerMapping()) 1330 if (includeSelf && isComposited())
1334 return const_cast<RenderLayer*>(this); 1331 return const_cast<RenderLayer*>(this);
1335 1332
1336 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) { 1333 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) {
1337 if (curr->compositedLayerMapping()) 1334 if (curr->isComposited())
1338 return const_cast<RenderLayer*>(curr); 1335 return const_cast<RenderLayer*>(curr);
1339 } 1336 }
1340 1337
1341 return 0; 1338 return 0;
1342 } 1339 }
1343 1340
1344 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const 1341 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const
1345 { 1342 {
1346 if (includeSelf && compositingState() == PaintsIntoOwnBacking) 1343 if (includeSelf && isComposited() && !compositedLayerMapping()->paintsIntoCo mpositedAncestor())
1347 return const_cast<RenderLayer*>(this); 1344 return const_cast<RenderLayer*>(this);
1348 1345
1349 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) { 1346 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) {
1350 if (curr->compositingState() == PaintsIntoOwnBacking) 1347 if (curr->isComposited() && !curr->compositedLayerMapping()->paintsIntoC ompositedAncestor())
1351 return const_cast<RenderLayer*>(curr); 1348 return const_cast<RenderLayer*>(curr);
1352 } 1349 }
1353 1350
1354 return 0; 1351 return 0;
1355 } 1352 }
1356 1353
1357 RenderLayer* RenderLayer::ancestorScrollingLayer() const 1354 RenderLayer* RenderLayer::ancestorScrollingLayer() const
1358 { 1355 {
1359 if (!acceleratedCompositingForOverflowScrollEnabled()) 1356 if (!acceleratedCompositingForOverflowScrollEnabled())
1360 return 0; 1357 return 0;
(...skipping 17 matching lines...) Expand all
1378 if (curr->requiresFullLayerImageForFilters()) 1375 if (curr->requiresFullLayerImageForFilters())
1379 return const_cast<RenderLayer*>(curr); 1376 return const_cast<RenderLayer*>(curr);
1380 } 1377 }
1381 1378
1382 return 0; 1379 return 0;
1383 } 1380 }
1384 1381
1385 RenderLayer* RenderLayer::enclosingFilterRepaintLayer() const 1382 RenderLayer* RenderLayer::enclosingFilterRepaintLayer() const
1386 { 1383 {
1387 for (const RenderLayer* curr = this; curr; curr = curr->parent()) { 1384 for (const RenderLayer* curr = this; curr; curr = curr->parent()) {
1388 if ((curr != this && curr->requiresFullLayerImageForFilters()) || curr-> compositingState() == PaintsIntoOwnBacking || curr->isRootLayer()) 1385 if ((curr != this && curr->requiresFullLayerImageForFilters()) || curr-> isComposited() || curr->isRootLayer())
1389 return const_cast<RenderLayer*>(curr); 1386 return const_cast<RenderLayer*>(curr);
1390 } 1387 }
1391 return 0; 1388 return 0;
1392 } 1389 }
1393 1390
1394 void RenderLayer::setFilterBackendNeedsRepaintingInRect(const LayoutRect& rect) 1391 void RenderLayer::setFilterBackendNeedsRepaintingInRect(const LayoutRect& rect)
1395 { 1392 {
1396 if (rect.isEmpty()) 1393 if (rect.isEmpty())
1397 return; 1394 return;
1398 1395
(...skipping 10 matching lines...) Expand all
1409 // shader can address any ouput pixel. 1406 // shader can address any ouput pixel.
1410 // Note: This is only for output rect, so there's no need to expand the dirty source rect. 1407 // Note: This is only for output rect, so there's no need to expand the dirty source rect.
1411 rectForRepaint.unite(calculateLayerBounds(this)); 1408 rectForRepaint.unite(calculateLayerBounds(this));
1412 } 1409 }
1413 1410
1414 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); 1411 RenderLayer* parentLayer = enclosingFilterRepaintLayer();
1415 ASSERT(parentLayer); 1412 ASSERT(parentLayer);
1416 FloatQuad repaintQuad(rectForRepaint); 1413 FloatQuad repaintQuad(rectForRepaint);
1417 LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, p arentLayer->renderer()).enclosingBoundingBox(); 1414 LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, p arentLayer->renderer()).enclosingBoundingBox();
1418 1415
1419 if (parentLayer->compositedLayerMapping()) { 1416 if (parentLayer->isComposited()) {
1420 parentLayer->setBackingNeedsRepaintInRect(parentLayerRect); 1417 parentLayer->setBackingNeedsRepaintInRect(parentLayerRect);
1421 return; 1418 return;
1422 } 1419 }
1423 1420
1424 if (parentLayer->paintsWithFilters()) { 1421 if (parentLayer->paintsWithFilters()) {
1425 parentLayer->setFilterBackendNeedsRepaintingInRect(parentLayerRect); 1422 parentLayer->setFilterBackendNeedsRepaintingInRect(parentLayerRect);
1426 return; 1423 return;
1427 } 1424 }
1428 1425
1429 if (parentLayer->isRootLayer()) { 1426 if (parentLayer->isRootLayer()) {
(...skipping 10 matching lines...) Expand all
1440 for (const RenderLayer* curr = this; curr; curr = curr->parent()) { 1437 for (const RenderLayer* curr = this; curr; curr = curr->parent()) {
1441 RenderLayerModelObject* renderer = curr->renderer(); 1438 RenderLayerModelObject* renderer = curr->renderer();
1442 if (renderer->style()->hasFilterOutsets()) 1439 if (renderer->style()->hasFilterOutsets())
1443 return true; 1440 return true;
1444 } 1441 }
1445 return false; 1442 return false;
1446 } 1443 }
1447 1444
1448 RenderLayer* RenderLayer::clippingRootForPainting() const 1445 RenderLayer* RenderLayer::clippingRootForPainting() const
1449 { 1446 {
1450 if (compositedLayerMapping()) 1447 if (isComposited())
1451 return const_cast<RenderLayer*>(this); 1448 return const_cast<RenderLayer*>(this);
1452 1449
1453 const RenderLayer* current = this; 1450 const RenderLayer* current = this;
1454 while (current) { 1451 while (current) {
1455 if (current->isRootLayer()) 1452 if (current->isRootLayer())
1456 return const_cast<RenderLayer*>(current); 1453 return const_cast<RenderLayer*>(current);
1457 1454
1458 current = compositingContainer(current); 1455 current = compositingContainer(current);
1459 ASSERT(current); 1456 ASSERT(current);
1460 if (current->transform() 1457 if (current->transform()
1461 || (current->compositingState() == PaintsIntoOwnBacking) 1458 || (current->isComposited() && !current->compositedLayerMapping()->p aintsIntoCompositedAncestor())
1462 ) 1459 )
1463 return const_cast<RenderLayer*>(current); 1460 return const_cast<RenderLayer*>(current);
1464 } 1461 }
1465 1462
1466 ASSERT_NOT_REACHED(); 1463 ASSERT_NOT_REACHED();
1467 return 0; 1464 return 0;
1468 } 1465 }
1469 1466
1470 LayoutPoint RenderLayer::absoluteToContents(const LayoutPoint& absolutePoint) co nst 1467 LayoutPoint RenderLayer::absoluteToContents(const LayoutPoint& absolutePoint) co nst
1471 { 1468 {
(...skipping 14 matching lines...) Expand all
1486 { 1483 {
1487 // FIXME: This seems incorrect; why would SVG layers be opaque? 1484 // FIXME: This seems incorrect; why would SVG layers be opaque?
1488 if (renderer()->node() && renderer()->node()->namespaceURI() == SVGNames::sv gNamespaceURI) 1485 if (renderer()->node() && renderer()->node()->namespaceURI() == SVGNames::sv gNamespaceURI)
1489 return false; 1486 return false;
1490 1487
1491 return renderer()->isTransparent() || renderer()->hasMask(); 1488 return renderer()->isTransparent() || renderer()->hasMask();
1492 } 1489 }
1493 1490
1494 RenderLayer* RenderLayer::transparentPaintingAncestor() 1491 RenderLayer* RenderLayer::transparentPaintingAncestor()
1495 { 1492 {
1496 if (compositedLayerMapping()) 1493 if (isComposited())
1497 return 0; 1494 return 0;
1498 1495
1499 for (RenderLayer* curr = parent(); curr; curr = curr->parent()) { 1496 for (RenderLayer* curr = parent(); curr; curr = curr->parent()) {
1500 if (curr->compositedLayerMapping()) 1497 if (curr->isComposited())
1501 return 0; 1498 return 0;
1502 if (curr->isTransparent()) 1499 if (curr->isTransparent())
1503 return curr; 1500 return curr;
1504 } 1501 }
1505 return 0; 1502 return 0;
1506 } 1503 }
1507 1504
1508 enum TransparencyClipBoxBehavior { 1505 enum TransparencyClipBoxBehavior {
1509 PaintingTransparencyClipBox, 1506 PaintingTransparencyClipBox,
1510 HitTestingTransparencyClipBox 1507 HitTestingTransparencyClipBox
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 } 1936 }
1940 1937
1941 bool RenderLayer::usesCompositedScrolling() const 1938 bool RenderLayer::usesCompositedScrolling() const
1942 { 1939 {
1943 RenderBox* box = renderBox(); 1940 RenderBox* box = renderBox();
1944 1941
1945 // Scroll form controls on the main thread so they exhibit correct touch scr oll event bubbling 1942 // Scroll form controls on the main thread so they exhibit correct touch scr oll event bubbling
1946 if (box && (box->isIntristicallyScrollable(VerticalScrollbar) || box->isIntr isticallyScrollable(HorizontalScrollbar))) 1943 if (box && (box->isIntristicallyScrollable(VerticalScrollbar) || box->isIntr isticallyScrollable(HorizontalScrollbar)))
1947 return false; 1944 return false;
1948 1945
1949 return compositedLayerMapping() && compositedLayerMapping()->scrollingLayer( ); 1946 return isComposited() && compositedLayerMapping()->scrollingLayer();
1950 } 1947 }
1951 1948
1952 bool RenderLayer::adjustForForceCompositedScrollingMode(bool value) const 1949 bool RenderLayer::adjustForForceCompositedScrollingMode(bool value) const
1953 { 1950 {
1954 switch (m_forceNeedsCompositedScrolling) { 1951 switch (m_forceNeedsCompositedScrolling) {
1955 case DoNotForceCompositedScrolling: 1952 case DoNotForceCompositedScrolling:
1956 return value; 1953 return value;
1957 case CompositedScrollingAlwaysOn: 1954 case CompositedScrollingAlwaysOn:
1958 return true; 1955 return true;
1959 case CompositedScrollingAlwaysOff: 1956 case CompositedScrollingAlwaysOff:
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 return false; 2571 return false;
2575 } 2572 }
2576 2573
2577 static bool paintForFixedRootBackground(const RenderLayer* layer, RenderLayer::P aintLayerFlags paintFlags) 2574 static bool paintForFixedRootBackground(const RenderLayer* layer, RenderLayer::P aintLayerFlags paintFlags)
2578 { 2575 {
2579 return layer->renderer()->isRoot() && (paintFlags & RenderLayer::PaintLayerP aintingRootBackgroundOnly); 2576 return layer->renderer()->isRoot() && (paintFlags & RenderLayer::PaintLayerP aintingRootBackgroundOnly);
2580 } 2577 }
2581 2578
2582 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 2579 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
2583 { 2580 {
2584 if (compositingState() != NotComposited) { 2581 if (isComposited()) {
2585 // The updatingControlTints() painting pass goes through compositing lay ers, 2582 // The updatingControlTints() painting pass goes through compositing lay ers,
2586 // but we need to ensure that we don't cache clip rects computed with th e wrong root in this case. 2583 // but we need to ensure that we don't cache clip rects computed with th e wrong root in this case.
2587 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai ntBehaviorFlattenCompositingLayers)) { 2584 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai ntBehaviorFlattenCompositingLayers)) {
2588 paintFlags |= PaintLayerTemporaryClipRects; 2585 paintFlags |= PaintLayerTemporaryClipRects;
2589 } else if (!compositedLayerMapping()->paintsIntoCompositedAncestor() 2586 } else if (!compositedLayerMapping()->paintsIntoCompositedAncestor()
2590 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle ction) 2587 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle ction)
2591 && !paintForFixedRootBackground(this, paintFlags)) { 2588 && !paintForFixedRootBackground(this, paintFlags)) {
2592 // If this RenderLayer should paint into its own backing, that will be done via CompositedLayerMapping::paintIntoLayer(). 2589 // If this RenderLayer should paint into its own backing, that will be done via CompositedLayerMapping::paintIntoLayer().
2593 return; 2590 return;
2594 } 2591 }
(...skipping 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after
4380 return pixelSnappedIntRect(localClipRect); 4377 return pixelSnappedIntRect(localClipRect);
4381 } 4378 }
4382 } 4379 }
4383 4380
4384 // FIXME: should probably just pass 'flags' down to descendants. 4381 // FIXME: should probably just pass 'flags' down to descendants.
4385 CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants) | (flags & IncludeCompositedDescendants); 4382 CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants) | (flags & IncludeCompositedDescendants);
4386 4383
4387 const_cast<RenderLayer*>(this)->updateLayerListsIfNeeded(); 4384 const_cast<RenderLayer*>(this)->updateLayerListsIfNeeded();
4388 4385
4389 if (RenderLayer* reflection = reflectionLayer()) { 4386 if (RenderLayer* reflection = reflectionLayer()) {
4390 if (!reflection->compositedLayerMapping()) { 4387 if (!reflection->isComposited()) {
4391 IntRect childUnionBounds = reflection->calculateLayerBounds(this, 0, descendantFlags); 4388 IntRect childUnionBounds = reflection->calculateLayerBounds(this, 0, descendantFlags);
4392 unionBounds.unite(childUnionBounds); 4389 unionBounds.unite(childUnionBounds);
4393 } 4390 }
4394 } 4391 }
4395 4392
4396 ASSERT(isStackingContainer() || (!posZOrderList() || !posZOrderList()->size( ))); 4393 ASSERT(isStackingContainer() || (!posZOrderList() || !posZOrderList()->size( )));
4397 4394
4398 #if !ASSERT_DISABLED 4395 #if !ASSERT_DISABLED
4399 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)); 4396 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this));
4400 #endif 4397 #endif
4401 4398
4402 // FIXME: Descendants that are composited should not necessarily be skipped, if they don't paint into their own
4403 // separate backing. Instead, they ought to contribute to the bounds of the layer we're trying to compute.
4404 // This applies to all z-order lists below.
4405 if (Vector<RenderLayer*>* negZOrderList = this->negZOrderList()) { 4399 if (Vector<RenderLayer*>* negZOrderList = this->negZOrderList()) {
4406 size_t listSize = negZOrderList->size(); 4400 size_t listSize = negZOrderList->size();
4407 for (size_t i = 0; i < listSize; ++i) { 4401 for (size_t i = 0; i < listSize; ++i) {
4408 RenderLayer* curLayer = negZOrderList->at(i); 4402 RenderLayer* curLayer = negZOrderList->at(i);
4409 if (flags & IncludeCompositedDescendants || !curLayer->compositedLay erMapping()) { 4403 if (flags & IncludeCompositedDescendants || !curLayer->isComposited( )) {
4410 IntRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags); 4404 IntRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
4411 unionBounds.unite(childUnionBounds); 4405 unionBounds.unite(childUnionBounds);
4412 } 4406 }
4413 } 4407 }
4414 } 4408 }
4415 4409
4416 if (Vector<RenderLayer*>* posZOrderList = this->posZOrderList()) { 4410 if (Vector<RenderLayer*>* posZOrderList = this->posZOrderList()) {
4417 size_t listSize = posZOrderList->size(); 4411 size_t listSize = posZOrderList->size();
4418 for (size_t i = 0; i < listSize; ++i) { 4412 for (size_t i = 0; i < listSize; ++i) {
4419 RenderLayer* curLayer = posZOrderList->at(i); 4413 RenderLayer* curLayer = posZOrderList->at(i);
4420 if (flags & IncludeCompositedDescendants || !curLayer->compositedLay erMapping()) { 4414 if (flags & IncludeCompositedDescendants || !curLayer->isComposited( )) {
4421 IntRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags); 4415 IntRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
4422 unionBounds.unite(childUnionBounds); 4416 unionBounds.unite(childUnionBounds);
4423 } 4417 }
4424 } 4418 }
4425 } 4419 }
4426 4420
4427 if (Vector<RenderLayer*>* normalFlowList = this->normalFlowList()) { 4421 if (Vector<RenderLayer*>* normalFlowList = this->normalFlowList()) {
4428 size_t listSize = normalFlowList->size(); 4422 size_t listSize = normalFlowList->size();
4429 for (size_t i = 0; i < listSize; ++i) { 4423 for (size_t i = 0; i < listSize; ++i) {
4430 RenderLayer* curLayer = normalFlowList->at(i); 4424 RenderLayer* curLayer = normalFlowList->at(i);
4431 if (flags & IncludeCompositedDescendants || !curLayer->compositedLay erMapping()) { 4425 if (flags & IncludeCompositedDescendants || !curLayer->isComposited( )) {
4432 IntRect curAbsBounds = curLayer->calculateLayerBounds(this, 0, d escendantFlags); 4426 IntRect curAbsBounds = curLayer->calculateLayerBounds(this, 0, d escendantFlags);
4433 unionBounds.unite(curAbsBounds); 4427 unionBounds.unite(curAbsBounds);
4434 } 4428 }
4435 } 4429 }
4436 } 4430 }
4437 4431
4438 // FIXME: We can optimize the size of the composited layers, by not enlargin g 4432 // FIXME: We can optimize the size of the composited layers, by not enlargin g
4439 // filtered areas with the outsets if we know that the filter is going to re nder in hardware. 4433 // filtered areas with the outsets if we know that the filter is going to re nder in hardware.
4440 // https://bugs.webkit.org/show_bug.cgi?id=81239 4434 // https://bugs.webkit.org/show_bug.cgi?id=81239
4441 if (flags & IncludeLayerFilterOutsets) 4435 if (flags & IncludeLayerFilterOutsets)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
4474 if (typeToClear == AllClipRectTypes) 4468 if (typeToClear == AllClipRectTypes)
4475 m_clipRectsCache = nullptr; 4469 m_clipRectsCache = nullptr;
4476 else { 4470 else {
4477 ASSERT(typeToClear < NumCachedClipRectsTypes); 4471 ASSERT(typeToClear < NumCachedClipRectsTypes);
4478 RefPtr<ClipRects> dummy; 4472 RefPtr<ClipRects> dummy;
4479 m_clipRectsCache->setClipRects(typeToClear, RespectOverflowClip, dummy); 4473 m_clipRectsCache->setClipRects(typeToClear, RespectOverflowClip, dummy);
4480 m_clipRectsCache->setClipRects(typeToClear, IgnoreOverflowClip, dummy); 4474 m_clipRectsCache->setClipRects(typeToClear, IgnoreOverflowClip, dummy);
4481 } 4475 }
4482 } 4476 }
4483 4477
4484 CompositingState RenderLayer::compositingState() const
4485 {
4486 // This is computed procedurally so there is no redundant state variable tha t
4487 // can get out of sync from the real actual compositing state.
4488
4489 if (!m_compositedLayerMapping)
4490 return NotComposited;
4491
4492 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit edAncestor())
4493 return HasOwnBackingButPaintsIntoAncestor;
4494
4495 ASSERT(m_compositedLayerMapping);
4496 return PaintsIntoOwnBacking;
4497 }
4498
4499 CompositedLayerMapping* RenderLayer::ensureCompositedLayerMapping() 4478 CompositedLayerMapping* RenderLayer::ensureCompositedLayerMapping()
4500 { 4479 {
4501 if (!m_compositedLayerMapping) { 4480 if (!m_compositedLayerMapping) {
4502 m_compositedLayerMapping = adoptPtr(new CompositedLayerMapping(this)); 4481 m_compositedLayerMapping = adoptPtr(new CompositedLayerMapping(this));
4503 compositor()->layerBecameComposited(this); 4482 compositor()->layerBecameComposited(this);
4504 4483
4505 updateOrRemoveFilterEffectRenderer(); 4484 updateOrRemoveFilterEffectRenderer();
4506 4485
4507 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 4486 if (RuntimeEnabledFeatures::cssCompositingEnabled())
4508 compositedLayerMapping()->setBlendMode(m_blendMode); 4487 compositedLayerMapping()->setBlendMode(m_blendMode);
(...skipping 26 matching lines...) Expand all
4535 return m_compositedLayerMapping ? m_compositedLayerMapping->scrollingContent sLayer() : 0; 4514 return m_compositedLayerMapping ? m_compositedLayerMapping->scrollingContent sLayer() : 0;
4536 } 4515 }
4537 4516
4538 GraphicsLayer* RenderLayer::layerForScrollChild() const 4517 GraphicsLayer* RenderLayer::layerForScrollChild() const
4539 { 4518 {
4540 return m_compositedLayerMapping ? m_compositedLayerMapping->childForSuperlay ers() : 0; 4519 return m_compositedLayerMapping ? m_compositedLayerMapping->childForSuperlay ers() : 0;
4541 } 4520 }
4542 4521
4543 bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const 4522 bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const
4544 { 4523 {
4545 return transform() && ((paintBehavior & PaintBehaviorFlattenCompositingLayer s) || compositingState() != PaintsIntoOwnBacking); 4524 return transform() && ((paintBehavior & PaintBehaviorFlattenCompositingLayer s) || !isComposited());
4546 } 4525 }
4547 4526
4548 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const 4527 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const
4549 { 4528 {
4550 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) 4529 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
4551 return false; 4530 return false;
4552 4531
4553 if (paintsWithTransparency(PaintBehaviorNormal)) 4532 if (paintsWithTransparency(PaintBehaviorNormal))
4554 return false; 4533 return false;
4555 4534
(...skipping 30 matching lines...) Expand all
4586 || listBackgroundIsKnownToBeOpaqueInRect(normalFlowList(), localRect); 4565 || listBackgroundIsKnownToBeOpaqueInRect(normalFlowList(), localRect);
4587 } 4566 }
4588 4567
4589 bool RenderLayer::listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer *>* list, const LayoutRect& localRect) const 4568 bool RenderLayer::listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer *>* list, const LayoutRect& localRect) const
4590 { 4569 {
4591 if (!list || list->isEmpty()) 4570 if (!list || list->isEmpty())
4592 return false; 4571 return false;
4593 4572
4594 for (Vector<RenderLayer*>::const_reverse_iterator iter = list->rbegin(); ite r != list->rend(); ++iter) { 4573 for (Vector<RenderLayer*>::const_reverse_iterator iter = list->rbegin(); ite r != list->rend(); ++iter) {
4595 const RenderLayer* childLayer = *iter; 4574 const RenderLayer* childLayer = *iter;
4596 if (childLayer->compositedLayerMapping()) 4575 if (childLayer->isComposited())
4597 continue; 4576 continue;
4598 4577
4599 if (!childLayer->canUseConvertToLayerCoords()) 4578 if (!childLayer->canUseConvertToLayerCoords())
4600 continue; 4579 continue;
4601 4580
4602 LayoutPoint childOffset; 4581 LayoutPoint childOffset;
4603 LayoutRect childLocalRect(localRect); 4582 LayoutRect childLocalRect(localRect);
4604 childLayer->convertToLayerCoords(this, childOffset); 4583 childLayer->convertToLayerCoords(this, childOffset);
4605 childLocalRect.moveBy(-childOffset); 4584 childLocalRect.moveBy(-childOffset);
4606 4585
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
4843 4822
4844 void RenderLayer::repaintIncludingDescendants() 4823 void RenderLayer::repaintIncludingDescendants()
4845 { 4824 {
4846 renderer()->repaint(); 4825 renderer()->repaint();
4847 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) 4826 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling())
4848 curr->repaintIncludingDescendants(); 4827 curr->repaintIncludingDescendants();
4849 } 4828 }
4850 4829
4851 void RenderLayer::setBackingNeedsRepaint() 4830 void RenderLayer::setBackingNeedsRepaint()
4852 { 4831 {
4853 ASSERT(compositedLayerMapping()); 4832 ASSERT(isComposited());
4854 compositedLayerMapping()->setContentsNeedDisplay(); 4833 compositedLayerMapping()->setContentsNeedDisplay();
4855 } 4834 }
4856 4835
4857 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r) 4836 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r)
4858 { 4837 {
4859 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible crash here, 4838 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible crash here,
4860 // so assert but check that the layer is composited. 4839 // so assert but check that the layer is composited.
4861 ASSERT(compositedLayerMapping()); 4840 ASSERT(isComposited());
4862 if (!compositedLayerMapping()) { 4841 if (!isComposited()) {
4863 // If we're trying to repaint the placeholder document layer, propagate the 4842 // If we're trying to repaint the placeholder document layer, propagate the
4864 // repaint to the native view system. 4843 // repaint to the native view system.
4865 LayoutRect absRect(r); 4844 LayoutRect absRect(r);
4866 LayoutPoint delta; 4845 LayoutPoint delta;
4867 convertToLayerCoords(root(), delta); 4846 convertToLayerCoords(root(), delta);
4868 absRect.moveBy(delta); 4847 absRect.moveBy(delta);
4869 4848
4870 RenderView* view = renderer()->view(); 4849 RenderView* view = renderer()->view();
4871 if (view) 4850 if (view)
4872 view->repaintViewRectangle(absRect); 4851 view->repaintViewRectangle(absRect);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
5069 5048
5070 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const 5049 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const
5071 { 5050 {
5072 ASSERT(newStyle); 5051 ASSERT(newStyle);
5073 return oldStyle && (oldStyle->clip() != newStyle->clip() || oldStyle->hasCli p() != newStyle->hasClip()); 5052 return oldStyle && (oldStyle->clip() != newStyle->clip() || oldStyle->hasCli p() != newStyle->hasClip());
5074 } 5053 }
5075 5054
5076 inline bool RenderLayer::needsCompositingLayersRebuiltForOverflow(const RenderSt yle* oldStyle, const RenderStyle* newStyle) const 5055 inline bool RenderLayer::needsCompositingLayersRebuiltForOverflow(const RenderSt yle* oldStyle, const RenderStyle* newStyle) const
5077 { 5056 {
5078 ASSERT(newStyle); 5057 ASSERT(newStyle);
5079 return !compositedLayerMapping() && oldStyle && (oldStyle->overflowX() != ne wStyle->overflowX()) && ancestorStackingContainer()->hasCompositingDescendant(); 5058 return !isComposited() && oldStyle && (oldStyle->overflowX() != newStyle->ov erflowX()) && ancestorStackingContainer()->hasCompositingDescendant();
5080 } 5059 }
5081 5060
5082 inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderSty le* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const 5061 inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderSty le* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const
5083 { 5062 {
5084 if (!hasOrHadFilters(oldStyle, newStyle)) 5063 if (!hasOrHadFilters(oldStyle, newStyle))
5085 return false; 5064 return false;
5086 5065
5087 if (renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyWebkitFilter)) { 5066 if (renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyWebkitFilter)) {
5088 // When the compositor is performing the filter animation, we shouldn't touch the compositing layers. 5067 // When the compositor is performing the filter animation, we shouldn't touch the compositing layers.
5089 // All of the layers above us should have been promoted to compositing l ayers already. 5068 // All of the layers above us should have been promoted to compositing l ayers already.
(...skipping 23 matching lines...) Expand all
5113 } 5092 }
5114 5093
5115 void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle) 5094 void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle)
5116 { 5095 {
5117 if (!hasOrHadFilters(oldStyle, newStyle)) 5096 if (!hasOrHadFilters(oldStyle, newStyle))
5118 return; 5097 return;
5119 5098
5120 updateOrRemoveFilterClients(); 5099 updateOrRemoveFilterClients();
5121 // During an accelerated animation, both WebKit and the compositor animate p roperties. 5100 // During an accelerated animation, both WebKit and the compositor animate p roperties.
5122 // However, WebKit shouldn't ask the compositor to update its filters if the compositor is performing the animation. 5101 // However, WebKit shouldn't ask the compositor to update its filters if the compositor is performing the animation.
5123 bool shouldUpdateFilters = compositedLayerMapping() && !renderer()->animatio n()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter ); 5102 bool shouldUpdateFilters = isComposited() && !renderer()->animation()->isRun ningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter);
5124 if (shouldUpdateFilters) 5103 if (shouldUpdateFilters)
5125 compositedLayerMapping()->updateFilters(renderer()->style()); 5104 compositedLayerMapping()->updateFilters(renderer()->style());
5126 updateOrRemoveFilterEffectRenderer(); 5105 updateOrRemoveFilterEffectRenderer();
5127 } 5106 }
5128 5107
5129 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) 5108 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
5130 { 5109 {
5131 updateIsNormalFlowOnly(); 5110 updateIsNormalFlowOnly();
5132 5111
5133 if (m_scrollableArea) 5112 if (m_scrollableArea)
(...skipping 25 matching lines...) Expand all
5159 if (paintsWithFilters()) 5138 if (paintsWithFilters())
5160 didPaintWithFilters = true; 5139 didPaintWithFilters = true;
5161 updateFilters(oldStyle, renderer()->style()); 5140 updateFilters(oldStyle, renderer()->style());
5162 5141
5163 const RenderStyle* newStyle = renderer()->style(); 5142 const RenderStyle* newStyle = renderer()->style();
5164 if (compositor()->updateLayerCompositingState(this) 5143 if (compositor()->updateLayerCompositingState(this)
5165 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) 5144 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle)
5166 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) 5145 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle)
5167 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)) 5146 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters))
5168 compositor()->setCompositingLayersNeedRebuild(); 5147 compositor()->setCompositingLayersNeedRebuild();
5169 else if (compositedLayerMapping()) 5148 else if (isComposited())
5170 compositedLayerMapping()->updateGraphicsLayerGeometry(); 5149 compositedLayerMapping()->updateGraphicsLayerGeometry();
5171 } 5150 }
5172 5151
5173 void RenderLayer::updateScrollableAreaSet(bool hasOverflow) 5152 void RenderLayer::updateScrollableAreaSet(bool hasOverflow)
5174 { 5153 {
5175 Frame* frame = renderer()->frame(); 5154 Frame* frame = renderer()->frame();
5176 if (!frame) 5155 if (!frame)
5177 return; 5156 return;
5178 5157
5179 FrameView* frameView = frame->view(); 5158 FrameView* frameView = frame->view();
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
5516 } 5495 }
5517 } 5496 }
5518 5497
5519 void showLayerTree(const WebCore::RenderObject* renderer) 5498 void showLayerTree(const WebCore::RenderObject* renderer)
5520 { 5499 {
5521 if (!renderer) 5500 if (!renderer)
5522 return; 5501 return;
5523 showLayerTree(renderer->enclosingLayer()); 5502 showLayerTree(renderer->enclosingLayer());
5524 } 5503 }
5525 #endif 5504 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerCompositor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698