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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayer.cpp

Issue 1194733002: Adding the 'filter' context attribute to 2D canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: applied corrections Created 5 years, 6 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 2602 matching lines...) Expand 10 before | Expand all | Expand 10 after
2613 { 2613 {
2614 const FilterOperations& filters = style.filter(); 2614 const FilterOperations& filters = style.filter();
2615 if (filters.hasReferenceFilter()) { 2615 if (filters.hasReferenceFilter()) {
2616 for (size_t i = 0; i < filters.size(); ++i) { 2616 for (size_t i = 0; i < filters.size(); ++i) {
2617 FilterOperation* filterOperation = filters.operations().at(i).get(); 2617 FilterOperation* filterOperation = filters.operations().at(i).get();
2618 if (filterOperation->type() != FilterOperation::REFERENCE) 2618 if (filterOperation->type() != FilterOperation::REFERENCE)
2619 continue; 2619 continue;
2620 ReferenceFilterOperation& referenceOperation = toReferenceFilterOper ation(*filterOperation); 2620 ReferenceFilterOperation& referenceOperation = toReferenceFilterOper ation(*filterOperation);
2621 // FIXME: Cache the ReferenceFilter if it didn't change. 2621 // FIXME: Cache the ReferenceFilter if it didn't change.
2622 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte r::create(style.effectiveZoom()); 2622 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte r::create(style.effectiveZoom());
2623 referenceFilter->setLastEffect(ReferenceFilterBuilder::build(referen ceFilter.get(), *layoutObject(), referenceFilter->sourceGraphic(), 2623 referenceFilter->setLastEffect(ReferenceFilterBuilder::build(referen ceFilter.get(), toElement(enclosingElement()), referenceFilter->sourceGraphic(),
2624 referenceOperation)); 2624 referenceOperation));
2625 referenceOperation.setFilter(referenceFilter.release()); 2625 referenceOperation.setFilter(referenceFilter.release());
2626 } 2626 }
2627 } 2627 }
2628 2628
2629 return filters; 2629 return filters;
2630 } 2630 }
2631 2631
2632 void DeprecatedPaintLayer::updateOrRemoveFilterClients() 2632 void DeprecatedPaintLayer::updateOrRemoveFilterClients()
2633 { 2633 {
(...skipping 21 matching lines...) Expand all
2655 2655
2656 return; 2656 return;
2657 } 2657 }
2658 2658
2659 DeprecatedPaintLayerFilterInfo* filterInfo = ensureFilterInfo(); 2659 DeprecatedPaintLayerFilterInfo* filterInfo = ensureFilterInfo();
2660 if (!filterInfo->builder()) 2660 if (!filterInfo->builder())
2661 filterInfo->setBuilder(FilterEffectBuilder::create()); 2661 filterInfo->setBuilder(FilterEffectBuilder::create());
2662 2662
2663 // If the filter fails to build, remove it from the layer. It will still att empt to 2663 // If the filter fails to build, remove it from the layer. It will still att empt to
2664 // go through regular processing (e.g. compositing), but never apply anythin g. 2664 // go through regular processing (e.g. compositing), but never apply anythin g.
2665 if (!filterInfo->builder()->build(layoutObject(), computeFilterOperations(la youtObject()->styleRef()))) 2665 float zoom = layoutObject()->style() ? layoutObject()->style()->effectiveZoo m() : 1.0f;
2666 if (!filterInfo->builder()->build(toElement(enclosingElement()), computeFilt erOperations(layoutObject()->styleRef()), zoom))
2666 filterInfo->setBuilder(nullptr); 2667 filterInfo->setBuilder(nullptr);
2667 } 2668 }
2668 2669
2669 void DeprecatedPaintLayer::filterNeedsPaintInvalidation() 2670 void DeprecatedPaintLayer::filterNeedsPaintInvalidation()
2670 { 2671 {
2671 { 2672 {
2672 DeprecatedScheduleStyleRecalcDuringLayout marker(layoutObject()->documen t().lifecycle()); 2673 DeprecatedScheduleStyleRecalcDuringLayout marker(layoutObject()->documen t().lifecycle());
2673 // It's possible for scheduleSVGFilterLayerUpdateHack to schedule a styl e recalc, which 2674 // It's possible for scheduleSVGFilterLayerUpdateHack to schedule a styl e recalc, which
2674 // is a problem because this function can be called while performing lay out. 2675 // is a problem because this function can be called while performing lay out.
2675 // Presumably this represents an illegal data flow of layout or composit ing 2676 // Presumably this represents an illegal data flow of layout or composit ing
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2740 2741
2741 void showLayerTree(const blink::LayoutObject* layoutObject) 2742 void showLayerTree(const blink::LayoutObject* layoutObject)
2742 { 2743 {
2743 if (!layoutObject) { 2744 if (!layoutObject) {
2744 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2745 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2745 return; 2746 return;
2746 } 2747 }
2747 showLayerTree(layoutObject->enclosingLayer()); 2748 showLayerTree(layoutObject->enclosingLayer());
2748 } 2749 }
2749 #endif 2750 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/svg/ReferenceFilterBuilder.cpp ('k') | Source/core/paint/FilterEffectBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698