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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2001803002: Use counters for opacity with transform-style:preserve-3d (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 // so it is legitimate to compute and cache the composited bounds for this l ayer. 393 // so it is legitimate to compute and cache the composited bounds for this l ayer.
394 updateCompositedBounds(); 394 updateCompositedBounds();
395 395
396 if (PaintLayerReflectionInfo* reflection = m_owningLayer.reflectionInfo()) { 396 if (PaintLayerReflectionInfo* reflection = m_owningLayer.reflectionInfo()) {
397 if (reflection->reflectionLayer()->hasCompositedLayerMapping()) 397 if (reflection->reflectionLayer()->hasCompositedLayerMapping())
398 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo sitedBounds(); 398 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo sitedBounds();
399 } 399 }
400 400
401 PaintLayerCompositor* compositor = this->compositor(); 401 PaintLayerCompositor* compositor = this->compositor();
402 LayoutObject* layoutObject = this->layoutObject(); 402 LayoutObject* layoutObject = this->layoutObject();
403 const ComputedStyle& style = layoutObject->styleRef();
403 404
404 bool layerConfigChanged = false; 405 bool layerConfigChanged = false;
405 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr oundLayer(&m_owningLayer)); 406 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr oundLayer(&m_owningLayer));
406 407
407 // The background layer is currently only used for fixed root backgrounds. 408 // The background layer is currently only used for fixed root backgrounds.
408 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground)) 409 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground))
409 layerConfigChanged = true; 410 layerConfigChanged = true;
410 411
411 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin gLayer))) 412 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin gLayer)))
412 layerConfigChanged = true; 413 layerConfigChanged = true;
(...skipping 18 matching lines...) Expand all
431 432
432 bool scrollingConfigChanged = false; 433 bool scrollingConfigChanged = false;
433 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { 434 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) {
434 layerConfigChanged = true; 435 layerConfigChanged = true;
435 scrollingConfigChanged = true; 436 scrollingConfigChanged = true;
436 } 437 }
437 438
438 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer(), needsAncestorClip)) 439 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer(), needsAncestorClip))
439 layerConfigChanged = true; 440 layerConfigChanged = true;
440 441
441 bool hasPerspective = false; 442 bool hasPerspective = style.hasPerspective();
442 // FIXME: Can |style| be really null that late in the DocumentCycle?
443 if (const ComputedStyle* style = layoutObject->style())
444 hasPerspective = style->hasPerspective();
445 bool needsChildTransformLayer = hasPerspective && layoutObject->isBox(); 443 bool needsChildTransformLayer = hasPerspective && layoutObject->isBox();
446 if (updateChildTransformLayer(needsChildTransformLayer)) 444 if (updateChildTransformLayer(needsChildTransformLayer))
447 layerConfigChanged = true; 445 layerConfigChanged = true;
448 446
449 if (updateSquashingLayers(!m_squashedLayers.isEmpty())) 447 if (updateSquashingLayers(!m_squashedLayers.isEmpty()))
450 layerConfigChanged = true; 448 layerConfigChanged = true;
451 449
452 updateScrollParent(scrollParent); 450 updateScrollParent(scrollParent);
453 updateClipParent(scrollParent); 451 updateClipParent(scrollParent);
454 452
455 if (layerConfigChanged) 453 if (layerConfigChanged)
456 updateInternalHierarchy(); 454 updateInternalHierarchy();
457 455
458 if (scrollingConfigChanged) { 456 if (scrollingConfigChanged) {
459 if (layoutObject->view()) 457 if (layoutObject->view())
460 compositor->scrollingLayerDidChange(&m_owningLayer); 458 compositor->scrollingLayerDidChange(&m_owningLayer);
461 } 459 }
462 460
463 // A mask layer is not part of the hierarchy proper, it's an auxiliary layer 461 // A mask layer is not part of the hierarchy proper, it's an auxiliary layer
464 // that's plugged into another GraphicsLayer that is part of the hierarchy. 462 // that's plugged into another GraphicsLayer that is part of the hierarchy.
465 // It has no parent or child GraphicsLayer. For that reason, we process it 463 // It has no parent or child GraphicsLayer. For that reason, we process it
466 // here, after the hierarchy has been updated. 464 // here, after the hierarchy has been updated.
467 bool maskLayerChanged = updateMaskLayer(layoutObject->hasMask()); 465 bool maskLayerChanged = updateMaskLayer(layoutObject->hasMask());
468 if (maskLayerChanged) 466 if (maskLayerChanged)
469 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); 467 m_graphicsLayer->setMaskLayer(m_maskLayer.get());
470 468
471 bool hasChildClippingLayer = compositor->clipsCompositingDescendants(&m_owni ngLayer) && (hasClippingLayer() || hasScrollingLayer()); 469 bool hasChildClippingLayer = compositor->clipsCompositingDescendants(&m_owni ngLayer) && (hasClippingLayer() || hasScrollingLayer());
472 // If we have a border radius or clip path on a scrolling layer, we need a c lipping mask to properly 470 // If we have a border radius or clip path on a scrolling layer, we need a c lipping mask to properly
473 // clip the scrolled contents, even if there are no composited descendants. 471 // clip the scrolled contents, even if there are no composited descendants.
474 bool hasClipPath = layoutObject->style()->clipPath(); 472 bool hasClipPath = style.clipPath();
475 bool needsChildClippingMask = (hasClipPath || layoutObject->style()->hasBord erRadius()) && (hasChildClippingLayer || isAcceleratedContents(layoutObject) || hasScrollingLayer()); 473 bool needsChildClippingMask = (hasClipPath || style.hasBorderRadius()) && (h asChildClippingLayer || isAcceleratedContents(layoutObject) || hasScrollingLayer ());
476 474
477 GraphicsLayer* layerToApplyChildClippingMask = nullptr; 475 GraphicsLayer* layerToApplyChildClippingMask = nullptr;
478 bool shouldApplyChildClippingMaskOnContents = false; 476 bool shouldApplyChildClippingMaskOnContents = false;
479 if (needsChildClippingMask) { 477 if (needsChildClippingMask) {
480 if (hasClipPath) { 478 if (hasClipPath) {
481 // Clip path clips the entire subtree, including scrollbars. It must be attached directly onto 479 // Clip path clips the entire subtree, including scrollbars. It must be attached directly onto
482 // the main m_graphicsLayer. 480 // the main m_graphicsLayer.
483 layerToApplyChildClippingMask = m_graphicsLayer.get(); 481 layerToApplyChildClippingMask = m_graphicsLayer.get();
484 } else if (hasClippingLayer()) { 482 } else if (hasClippingLayer()) {
485 layerToApplyChildClippingMask = clippingLayer(); 483 layerToApplyChildClippingMask = clippingLayer();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 layerConfigChanged = true; 547 layerConfigChanged = true;
550 } 548 }
551 549
552 // Changes to either the internal hierarchy or the mask layer have an impact 550 // Changes to either the internal hierarchy or the mask layer have an impact
553 // on painting phases, so we need to update when either are updated. 551 // on painting phases, so we need to update when either are updated.
554 if (layerConfigChanged || maskLayerChanged) 552 if (layerConfigChanged || maskLayerChanged)
555 updatePaintingPhases(); 553 updatePaintingPhases();
556 554
557 updateElementIdAndCompositorMutableProperties(); 555 updateElementIdAndCompositorMutableProperties();
558 556
557 m_owningLayer.update3DTransformedDescendantStatus();
558 if (style.preserves3D() && style.hasOpacity() && m_owningLayer.has3DTransfor medDescendant())
559 UseCounter::count(layoutObject->document(), UseCounter::OpacityWithPrese rve3DQuirk);
560
559 return layerConfigChanged; 561 return layerConfigChanged;
560 } 562 }
561 563
562 static IntRect clipBox(LayoutBox* layoutObject) 564 static IntRect clipBox(LayoutBox* layoutObject)
563 { 565 {
564 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect()); 566 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect());
565 if (layoutObject->hasOverflowClip() || layoutObject->style()->containsPaint( )) 567 if (layoutObject->hasOverflowClip() || layoutObject->style()->containsPaint( ))
566 result = layoutObject->overflowClipRect(LayoutPoint()); 568 result = layoutObject->overflowClipRect(LayoutPoint());
567 569
568 if (layoutObject->hasClip()) 570 if (layoutObject->hasClip())
(...skipping 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after
2571 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2573 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2572 name = "Scrolling Contents Layer"; 2574 name = "Scrolling Contents Layer";
2573 } else { 2575 } else {
2574 ASSERT_NOT_REACHED(); 2576 ASSERT_NOT_REACHED();
2575 } 2577 }
2576 2578
2577 return name; 2579 return name;
2578 } 2580 }
2579 2581
2580 } // namespace blink 2582 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | third_party/WebKit/Source/core/paint/PaintLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698