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

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

Issue 423823004: Add support for SVG Clip paths in HTML (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed unwanted code from RenderLayerClipPathInfo.* and Renderlayer.cpp and Renamed filters to svg… Created 6 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) 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 3531 matching lines...) Expand 10 before | Expand all | Expand 10 after
3542 3542
3543 void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle) 3543 void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle)
3544 { 3544 {
3545 if (!newStyle->hasFilter() && (!oldStyle || !oldStyle->hasFilter())) 3545 if (!newStyle->hasFilter() && (!oldStyle || !oldStyle->hasFilter()))
3546 return; 3546 return;
3547 3547
3548 updateOrRemoveFilterClients(); 3548 updateOrRemoveFilterClients();
3549 updateOrRemoveFilterEffectRenderer(); 3549 updateOrRemoveFilterEffectRenderer();
3550 } 3550 }
3551 3551
3552 void RenderLayer::updateClipPathInfo(const RenderStyle* oldStyle, const RenderSt yle* newStyle)
3553 {
3554 if (!newStyle->clipPath() && (!oldStyle || !oldStyle->clipPath()))
3555 return;
3556
3557 if (renderer()->hasClipPath() && renderer()->style()->clipPath()->type() == ClipPathOperation::REFERENCE) {
3558 if (!m_clipPathInfo)
3559 m_clipPathInfo = adoptPtr(new RenderLayerClipPathInfo(this));
3560 m_clipPathInfo->updateReferenceClipPathClients(renderer()->style()->clip Path());
3561 } else if (m_clipPathInfo) {
3562 m_clipPathInfo = nullptr;
3563 }
3564 }
3565
3552 bool RenderLayer::attemptDirectCompositingUpdate(StyleDifference diff, const Ren derStyle* oldStyle) 3566 bool RenderLayer::attemptDirectCompositingUpdate(StyleDifference diff, const Ren derStyle* oldStyle)
3553 { 3567 {
3554 CompositingReasons oldPotentialCompositingReasonsFromStyle = m_potentialComp ositingReasonsFromStyle; 3568 CompositingReasons oldPotentialCompositingReasonsFromStyle = m_potentialComp ositingReasonsFromStyle;
3555 compositor()->updatePotentialCompositingReasonsFromStyle(this); 3569 compositor()->updatePotentialCompositingReasonsFromStyle(this);
3556 3570
3557 // This function implements an optimization for transforms and opacity. 3571 // This function implements an optimization for transforms and opacity.
3558 // A common pattern is for a touchmove handler to update the transform 3572 // A common pattern is for a touchmove handler to update the transform
3559 // and/or an opacity of an element every frame while the user moves their 3573 // and/or an opacity of an element every frame while the user moves their
3560 // finger across the screen. The conditions below recognize when the 3574 // finger across the screen. The conditions below recognize when the
3561 // compositing state is set up to receive a direct transform or opacity 3575 // compositing state is set up to receive a direct transform or opacity
3562 // update. 3576 // update.
3563 3577
3564 if (!diff.hasAtMostPropertySpecificDifferences(StyleDifference::TransformCha nged | StyleDifference::OpacityChanged)) 3578 if (!diff.hasAtMostPropertySpecificDifferences(StyleDifference::TransformCha nged | StyleDifference::OpacityChanged))
3565 return false; 3579 return false;
3566 // The potentialCompositingReasonsFromStyle could have changed without 3580 // The potentialCompositingReasonsFromStyle could have changed without
3567 // a corresponding StyleDifference if an animation started or ended. 3581 // a corresponding StyleDifference if an animation started or ended.
3568 if (m_potentialCompositingReasonsFromStyle != oldPotentialCompositingReasons FromStyle) 3582 if (m_potentialCompositingReasonsFromStyle != oldPotentialCompositingReasons FromStyle)
3569 return false; 3583 return false;
3570 // We could add support for reflections if we updated the transform on 3584 // We could add support for reflections if we updated the transform on
3571 // the reflection layers. 3585 // the reflection layers.
3572 if (renderer()->hasReflection()) 3586 if (renderer()->hasReflection())
3573 return false; 3587 return false;
3574 // If we're unwinding a scheduleSVGFilterLayerUpdateHack(), then we can't 3588 // If we're unwinding a scheduleSVGEffectsLayerUpdateHack(), then we can't
3575 // perform a direct compositing update because the filters code is going 3589 // perform a direct compositing update because the filters code is going
3576 // to produce different output this time around. We can remove this code 3590 // to produce different output this time around. We can remove this code
3577 // once we fix the chicken/egg bugs in the filters code and delete the 3591 // once we fix the chicken/egg bugs in the filters code and delete the
3578 // scheduleSVGFilterLayerUpdateHack(). 3592 // scheduleSVGEffectsLayerUpdateHack().
3579 if (renderer()->node() && renderer()->node()->svgFilterNeedsLayerUpdate()) 3593 if (renderer()->node() && renderer()->node()->svgEffectsNeedsLayerUpdate())
3580 return false; 3594 return false;
3581 if (!m_compositedLayerMapping) 3595 if (!m_compositedLayerMapping)
3582 return false; 3596 return false;
3583 3597
3584 // To cut off almost all the work in the compositing update for 3598 // To cut off almost all the work in the compositing update for
3585 // this case, we treat inline transforms has having assumed overlap 3599 // this case, we treat inline transforms has having assumed overlap
3586 // (similar to how we treat animated transforms). Notice that we read 3600 // (similar to how we treat animated transforms). Notice that we read
3587 // CompositingReasonInlineTransform from the m_compositingReasons, which 3601 // CompositingReasonInlineTransform from the m_compositingReasons, which
3588 // means that the inline transform actually triggered assumed overlap in 3602 // means that the inline transform actually triggered assumed overlap in
3589 // the overlap map. 3603 // the overlap map.
(...skipping 30 matching lines...) Expand all
3620 3634
3621 // Overlay scrollbars can make this layer self-painting so we need 3635 // Overlay scrollbars can make this layer self-painting so we need
3622 // to recompute the bit once scrollbars have been updated. 3636 // to recompute the bit once scrollbars have been updated.
3623 updateSelfPaintingLayer(); 3637 updateSelfPaintingLayer();
3624 3638
3625 if (!oldStyle || !renderer()->style()->reflectionDataEquivalent(oldStyle)) { 3639 if (!oldStyle || !renderer()->style()->reflectionDataEquivalent(oldStyle)) {
3626 ASSERT(!oldStyle || diff.needsFullLayout()); 3640 ASSERT(!oldStyle || diff.needsFullLayout());
3627 updateReflectionInfo(oldStyle); 3641 updateReflectionInfo(oldStyle);
3628 } 3642 }
3629 3643
3644 updateClipPathInfo(oldStyle, renderer()->style());
3645
3630 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 3646 if (RuntimeEnabledFeatures::cssCompositingEnabled())
3631 m_blendInfo.updateBlendMode(); 3647 m_blendInfo.updateBlendMode();
3632 3648
3633 updateDescendantDependentFlags(); 3649 updateDescendantDependentFlags();
3634 3650
3635 updateTransform(oldStyle, renderer()->style()); 3651 updateTransform(oldStyle, renderer()->style());
3636 updateFilters(oldStyle, renderer()->style()); 3652 updateFilters(oldStyle, renderer()->style());
3637 3653
3638 setNeedsCompositingInputsUpdate(); 3654 setNeedsCompositingInputsUpdate();
3639 } 3655 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
3707 // We can optimize away code paths in other places if we know that there are no software filters. 3723 // We can optimize away code paths in other places if we know that there are no software filters.
3708 renderer()->document().view()->setHasSoftwareFilters(true); 3724 renderer()->document().view()->setHasSoftwareFilters(true);
3709 } 3725 }
3710 3726
3711 // If the filter fails to build, remove it from the layer. It will still att empt to 3727 // If the filter fails to build, remove it from the layer. It will still att empt to
3712 // go through regular processing (e.g. compositing), but never apply anythin g. 3728 // go through regular processing (e.g. compositing), but never apply anythin g.
3713 if (!filterInfo->renderer()->build(renderer(), computeFilterOperations(rende rer()->style()))) 3729 if (!filterInfo->renderer()->build(renderer(), computeFilterOperations(rende rer()->style())))
3714 filterInfo->setRenderer(nullptr); 3730 filterInfo->setRenderer(nullptr);
3715 } 3731 }
3716 3732
3717 void RenderLayer::filterNeedsPaintInvalidation() 3733 void RenderLayer::SVGEffectsNeedsPaintInvalidation()
3718 { 3734 {
3719 { 3735 {
3720 DeprecatedScheduleStyleRecalcDuringLayout marker(renderer()->document(). lifecycle()); 3736 DeprecatedScheduleStyleRecalcDuringLayout marker(renderer()->document(). lifecycle());
3721 // It's possible for scheduleSVGFilterLayerUpdateHack to schedule a styl e recalc, which 3737 // It's possible for scheduleSVGEffectsLayerUpdateHack to schedule a sty le recalc, which
3722 // is a problem because this function can be called while performing lay out. 3738 // is a problem because this function can be called while performing lay out.
3723 // Presumably this represents an illegal data flow of layout or composit ing 3739 // Presumably this represents an illegal data flow of layout or composit ing
3724 // information into the style system. 3740 // information into the style system.
3725 toElement(renderer()->node())->scheduleSVGFilterLayerUpdateHack(); 3741 toElement(renderer()->node())->scheduleSVGEffectsLayerUpdateHack();
3726 } 3742 }
3727 3743
3728 if (renderer()->view()) { 3744 if (renderer()->view()) {
3729 if (renderer()->frameView()->isInPerformLayout()) 3745 if (renderer()->frameView()->isInPerformLayout())
3730 renderer()->setShouldDoFullPaintInvalidation(true); 3746 renderer()->setShouldDoFullPaintInvalidation(true);
3731 else 3747 else
3732 renderer()->paintInvalidationForWholeRenderer(); 3748 renderer()->paintInvalidationForWholeRenderer();
3733 } 3749 }
3734 } 3750 }
3735 3751
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3790 } 3806 }
3791 } 3807 }
3792 3808
3793 void showLayerTree(const blink::RenderObject* renderer) 3809 void showLayerTree(const blink::RenderObject* renderer)
3794 { 3810 {
3795 if (!renderer) 3811 if (!renderer)
3796 return; 3812 return;
3797 showLayerTree(renderer->enclosingLayer()); 3813 showLayerTree(renderer->enclosingLayer());
3798 } 3814 }
3799 #endif 3815 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698