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

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

Issue 1299323005: blink: Add backdrop-filter support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: removed some todos Created 5 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 bool DeprecatedPaintLayer::paintsWithFilters() const 216 bool DeprecatedPaintLayer::paintsWithFilters() const
217 { 217 {
218 if (!layoutObject()->hasFilter()) 218 if (!layoutObject()->hasFilter())
219 return false; 219 return false;
220 220
221 // https://code.google.com/p/chromium/issues/detail?id=343759 221 // https://code.google.com/p/chromium/issues/detail?id=343759
222 DisableCompositingQueryAsserts disabler; 222 DisableCompositingQueryAsserts disabler;
223 return !m_compositedDeprecatedPaintLayerMapping || compositingState() != Pai ntsIntoOwnBacking; 223 return !m_compositedDeprecatedPaintLayerMapping || compositingState() != Pai ntsIntoOwnBacking;
224 } 224 }
225 225
226 bool DeprecatedPaintLayer::paintsWithBackdropFilters() const
227 {
228 if (!layoutObject()->hasBackdropFilter())
229 return false;
230
231 // https://code.google.com/p/chromium/issues/detail?id=343759
232 DisableCompositingQueryAsserts disabler;
233 return !m_compositedDeprecatedPaintLayerMapping || compositingState() != Pai ntsIntoOwnBacking;
234 }
235
226 LayoutSize DeprecatedPaintLayer::subpixelAccumulation() const 236 LayoutSize DeprecatedPaintLayer::subpixelAccumulation() const
227 { 237 {
228 return m_subpixelAccumulation; 238 return m_subpixelAccumulation;
229 } 239 }
230 240
231 void DeprecatedPaintLayer::setSubpixelAccumulation(const LayoutSize& size) 241 void DeprecatedPaintLayer::setSubpixelAccumulation(const LayoutSize& size)
232 { 242 {
233 m_subpixelAccumulation = size; 243 m_subpixelAccumulation = size;
234 } 244 }
235 245
(...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after
2421 } 2431 }
2422 2432
2423 bool DeprecatedPaintLayer::hasVisibleBoxDecorations() const 2433 bool DeprecatedPaintLayer::hasVisibleBoxDecorations() const
2424 { 2434 {
2425 if (!hasVisibleContent()) 2435 if (!hasVisibleContent())
2426 return false; 2436 return false;
2427 2437
2428 return hasBoxDecorationsOrBackground() || hasOverflowControls(); 2438 return hasBoxDecorationsOrBackground() || hasOverflowControls();
2429 } 2439 }
2430 2440
2441 // TODO(hendrikw): Do we need a function like this for background filters?
2431 void DeprecatedPaintLayer::updateFilters(const ComputedStyle* oldStyle, const Co mputedStyle& newStyle) 2442 void DeprecatedPaintLayer::updateFilters(const ComputedStyle* oldStyle, const Co mputedStyle& newStyle)
2432 { 2443 {
2433 if (!newStyle.hasFilter() && (!oldStyle || !oldStyle->hasFilter())) 2444 if (!newStyle.hasFilter() && (!oldStyle || !oldStyle->hasFilter()))
2434 return; 2445 return;
2435 2446
2436 updateOrRemoveFilterClients(); 2447 updateOrRemoveFilterClients();
2437 updateOrRemoveFilterEffectBuilder(); 2448 updateOrRemoveFilterEffectBuilder();
2438 } 2449 }
2439 2450
2440 bool DeprecatedPaintLayer::attemptDirectCompositingUpdate(StyleDifference diff, const ComputedStyle* oldStyle) 2451 bool DeprecatedPaintLayer::attemptDirectCompositingUpdate(StyleDifference diff, const ComputedStyle* oldStyle)
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 if (!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldStyle )) { 2534 if (!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldStyle )) {
2524 ASSERT(!oldStyle || diff.needsFullLayout()); 2535 ASSERT(!oldStyle || diff.needsFullLayout());
2525 updateReflectionInfo(oldStyle); 2536 updateReflectionInfo(oldStyle);
2526 } 2537 }
2527 2538
2528 updateDescendantDependentFlags(); 2539 updateDescendantDependentFlags();
2529 2540
2530 updateTransform(oldStyle, layoutObject()->styleRef()); 2541 updateTransform(oldStyle, layoutObject()->styleRef());
2531 updateFilters(oldStyle, layoutObject()->styleRef()); 2542 updateFilters(oldStyle, layoutObject()->styleRef());
2532 2543
2544 // TODO(hendrikw) updateBackgroundFilters?
2545
2533 setNeedsCompositingInputsUpdate(); 2546 setNeedsCompositingInputsUpdate();
2534 } 2547 }
2535 2548
2536 bool DeprecatedPaintLayer::scrollsOverflow() const 2549 bool DeprecatedPaintLayer::scrollsOverflow() const
2537 { 2550 {
2538 if (DeprecatedPaintLayerScrollableArea* scrollableArea = this->scrollableAre a()) 2551 if (DeprecatedPaintLayerScrollableArea* scrollableArea = this->scrollableAre a())
2539 return scrollableArea->scrollsOverflow(); 2552 return scrollableArea->scrollsOverflow();
2540 2553
2541 return false; 2554 return false;
2542 } 2555 }
2543 2556
2544 FilterOperations DeprecatedPaintLayer::computeFilterOperations(const ComputedSty le& style) 2557 namespace {
2558
2559 FilterOperations computeFilterOperationsHandleReferenceFilters(const FilterOpera tions& filters, float effectiveZoom, Node* enclosingElement)
2545 { 2560 {
2546 const FilterOperations& filters = style.filter();
2547 if (filters.hasReferenceFilter()) { 2561 if (filters.hasReferenceFilter()) {
2548 for (size_t i = 0; i < filters.size(); ++i) { 2562 for (size_t i = 0; i < filters.size(); ++i) {
2549 FilterOperation* filterOperation = filters.operations().at(i).get(); 2563 FilterOperation* filterOperation = filters.operations().at(i).get();
2550 if (filterOperation->type() != FilterOperation::REFERENCE) 2564 if (filterOperation->type() != FilterOperation::REFERENCE)
2551 continue; 2565 continue;
2552 ReferenceFilterOperation& referenceOperation = toReferenceFilterOper ation(*filterOperation); 2566 ReferenceFilterOperation& referenceOperation = toReferenceFilterOper ation(*filterOperation);
2553 // FIXME: Cache the ReferenceFilter if it didn't change. 2567 // FIXME: Cache the ReferenceFilter if it didn't change.
2554 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte rBuilder::build(style.effectiveZoom(), toElement(enclosingElement()), nullptr, r eferenceOperation); 2568 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte rBuilder::build(effectiveZoom, toElement(enclosingElement), nullptr, referenceOp eration);
2555 referenceOperation.setFilter(referenceFilter.release()); 2569 referenceOperation.setFilter(referenceFilter.release());
2556 } 2570 }
2557 } 2571 }
2558 2572
2559 return filters; 2573 return filters;
2560 } 2574 }
2561 2575
2576 } // unnamed namespace
2577
2578 FilterOperations DeprecatedPaintLayer::computeFilterOperations(const ComputedSty le& style)
2579 {
2580 return computeFilterOperationsHandleReferenceFilters(style.filter(), style.e ffectiveZoom(), enclosingElement());
2581 }
2582
2583 FilterOperations DeprecatedPaintLayer::computeBackdropFilterOperations(const Com putedStyle& style)
2584 {
2585 return computeFilterOperationsHandleReferenceFilters(style.backdropFilter(), style.effectiveZoom(), enclosingElement());
2586 }
2587
2562 void DeprecatedPaintLayer::updateOrRemoveFilterClients() 2588 void DeprecatedPaintLayer::updateOrRemoveFilterClients()
2563 { 2589 {
2590 // TODO(hendrikw) backdrop filter?
2564 if (!hasFilter()) { 2591 if (!hasFilter()) {
2565 removeFilterInfoIfNeeded(); 2592 removeFilterInfoIfNeeded();
2566 return; 2593 return;
2567 } 2594 }
2568 2595
2569 if (layoutObject()->style()->filter().hasReferenceFilter()) 2596 if (layoutObject()->style()->filter().hasReferenceFilter())
2570 ensureFilterInfo()->updateReferenceFilterClients(layoutObject()->style() ->filter()); 2597 ensureFilterInfo()->updateReferenceFilterClients(layoutObject()->style() ->filter());
2571 else if (hasFilterInfo()) 2598 else if (hasFilterInfo())
2572 filterInfo()->removeReferenceFilterClients(); 2599 filterInfo()->removeReferenceFilterClients();
2573 } 2600 }
2574 2601
2575 void DeprecatedPaintLayer::updateOrRemoveFilterEffectBuilder() 2602 void DeprecatedPaintLayer::updateOrRemoveFilterEffectBuilder()
2576 { 2603 {
2604 // TODO(hendrikw) backdrop filter?
2605
2577 // FilterEffectBuilder is only used to render the filters in software mode, 2606 // FilterEffectBuilder is only used to render the filters in software mode,
2578 // so we always need to run updateOrRemoveFilterEffectBuilder after the comp osited 2607 // so we always need to run updateOrRemoveFilterEffectBuilder after the comp osited
2579 // mode might have changed for this layer. 2608 // mode might have changed for this layer.
2580 if (!paintsWithFilters()) { 2609 if (!paintsWithFilters()) {
2581 // Don't delete the whole filter info here, because we might use it 2610 // Don't delete the whole filter info here, because we might use it
2582 // for loading CSS shader files. 2611 // for loading CSS shader files.
2583 if (DeprecatedPaintLayerFilterInfo* filterInfo = this->filterInfo()) 2612 if (DeprecatedPaintLayerFilterInfo* filterInfo = this->filterInfo())
2584 filterInfo->setBuilder(nullptr); 2613 filterInfo->setBuilder(nullptr);
2585 2614
2586 return; 2615 return;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2671 2700
2672 void showLayerTree(const blink::LayoutObject* layoutObject) 2701 void showLayerTree(const blink::LayoutObject* layoutObject)
2673 { 2702 {
2674 if (!layoutObject) { 2703 if (!layoutObject) {
2675 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2704 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2676 return; 2705 return;
2677 } 2706 }
2678 showLayerTree(layoutObject->enclosingLayer()); 2707 showLayerTree(layoutObject->enclosingLayer());
2679 } 2708 }
2680 #endif 2709 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698