Changeset 185846 in webkit


Ignore:
Timestamp:
Jun 22, 2015 3:06:45 PM (9 years ago)
Author:
dino@apple.com
Message:

Element with blur backdrop-filter shows edge duplication and dark edges
https://bugs.webkit.org/show_bug.cgi?id=146215
<rdar://problem/20367695>

Reviewed by Tim Horton.

Source/WebCore:

The input images to backdrop filters should duplicate their edge pixels
outwards, rather than using transparent pixels. This is a flag we
set on the Gaussian blur, but means we have to remember if the
FilterOperations list came from a regular filter or a backdrop filter.

Test: css3/filters/backdrop/blur-input-bounds.html

  • css/CSSPropertyNames.in: New custom convertor for backdrop-filter.
  • css/StyleBuilderConverter.h:

(WebCore::StyleBuilderConverter::convertBackdropFilterOperations): New convertor
that sets the backdrop flag, but is otherwise the same as a normal filter
convertor.

  • page/animation/CSSPropertyAnimation.cpp:

(WebCore::blendFilterOperations): Inherit the backdrop flag if either of our
inputs has it.

  • platform/graphics/ca/mac/PlatformCAFiltersMac.mm: Set the inputNormalizeEdges

key on the CAFilter if necessary.

  • platform/graphics/filters/FilterOperations.cpp: Add a new flag indicating if

these operations are intended for backdrops.
(WebCore::FilterOperations::operator=):
(WebCore::FilterOperations::operator==):

  • platform/graphics/filters/FilterOperations.h:

(WebCore::FilterOperations::isUsedForBackdropFilters):
(WebCore::FilterOperations::setUsedForBackdropFilters):

LayoutTests:

Add a pixel test to show that the input images to backdrop filters should duplicate their
edge pixels. Unfortunately this is not reproducible with normal filters, so it
can't be a reference test.

  • css3/filters/backdrop/blur-input-bounds.html: Added.
  • platform/mac/css3/filters/backdrop/blur-input-bounds-expected.png: Added.
  • platform/mac/css3/filters/backdrop/blur-input-bounds-expected.txt: Added.
Location:
trunk
Files:
4 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r185842 r185846  
     12015-06-22  Dean Jackson  <dino@apple.com>
     2
     3        Element with blur backdrop-filter shows edge duplication and dark edges
     4        https://bugs.webkit.org/show_bug.cgi?id=146215
     5        <rdar://problem/20367695>
     6
     7        Reviewed by Tim Horton.
     8
     9        Add a pixel test to show that the input images to backdrop filters should duplicate their
     10        edge pixels. Unfortunately this is not reproducible with normal filters, so it
     11        can't be a reference test.
     12
     13        * css3/filters/backdrop/blur-input-bounds.html: Added.
     14        * platform/mac/css3/filters/backdrop/blur-input-bounds-expected.png: Added.
     15        * platform/mac/css3/filters/backdrop/blur-input-bounds-expected.txt: Added.
     16
    1172015-06-22  Myles C. Maxfield  <mmaxfield@apple.com>
    218
  • trunk/Source/WebCore/ChangeLog

    r185844 r185846  
     12015-06-22  Dean Jackson  <dino@apple.com>
     2
     3        Element with blur backdrop-filter shows edge duplication and dark edges
     4        https://bugs.webkit.org/show_bug.cgi?id=146215
     5        <rdar://problem/20367695>
     6
     7        Reviewed by Tim Horton.
     8
     9        The input images to backdrop filters should duplicate their edge pixels
     10        outwards, rather than using transparent pixels. This is a flag we
     11        set on the Gaussian blur, but means we have to remember if the
     12        FilterOperations list came from a regular filter or a backdrop filter.
     13
     14        Test: css3/filters/backdrop/blur-input-bounds.html
     15
     16        * css/CSSPropertyNames.in: New custom convertor for backdrop-filter.
     17        * css/StyleBuilderConverter.h:
     18        (WebCore::StyleBuilderConverter::convertBackdropFilterOperations): New convertor
     19        that sets the backdrop flag, but is otherwise the same as a normal filter
     20        convertor.
     21        * page/animation/CSSPropertyAnimation.cpp:
     22        (WebCore::blendFilterOperations): Inherit the backdrop flag if either of our
     23        inputs has it.
     24        * platform/graphics/ca/mac/PlatformCAFiltersMac.mm: Set the inputNormalizeEdges
     25        key on the CAFilter if necessary.
     26        * platform/graphics/filters/FilterOperations.cpp: Add a new flag indicating if
     27        these operations are intended for backdrops.
     28        (WebCore::FilterOperations::operator=):
     29        (WebCore::FilterOperations::operator==):
     30        * platform/graphics/filters/FilterOperations.h:
     31        (WebCore::FilterOperations::isUsedForBackdropFilters):
     32        (WebCore::FilterOperations::setUsedForBackdropFilters):
     33
    1342015-06-22  Tim Horton  <timothy_horton@apple.com>
    235
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r183805 r185846  
    477477-webkit-justify-content = justify-content
    478478#if defined(ENABLE_FILTERS_LEVEL_2) && ENABLE_FILTERS_LEVEL_2
    479 -webkit-backdrop-filter [ConditionalConverter=FilterOperations]
     479-webkit-backdrop-filter [ConditionalConverter=BackdropFilterOperations]
    480480#endif
    481481justify-self [Initial=initialSelfAlignment, Converter=SelfOrDefaultAlignmentData]
  • trunk/Source/WebCore/css/StyleBuilderConverter.h

    r183748 r185846  
    105105    static Optional<Length> convertMarqueeIncrement(StyleResolver&, CSSValue&);
    106106    static Optional<FilterOperations> convertFilterOperations(StyleResolver&, CSSValue&);
     107#if ENABLE(FILTERS_LEVEL_2)
     108    static Optional<FilterOperations> convertBackdropFilterOperations(StyleResolver&, CSSValue&);
     109#endif
    107110    static Vector<RefPtr<MaskImageOperation>> convertMaskImageOperations(StyleResolver&, CSSValue&);
    108111#if PLATFORM(IOS)
     
    10061009}
    10071010
     1011#if ENABLE(FILTERS_LEVEL_2)
     1012inline Optional<FilterOperations> StyleBuilderConverter::convertBackdropFilterOperations(StyleResolver& styleResolver, CSSValue& value)
     1013{
     1014    FilterOperations operations;
     1015    if (styleResolver.createFilterOperations(value, operations)) {
     1016        operations.setUsedForBackdropFilters(true);
     1017        return operations;
     1018    }
     1019    return Nullopt;
     1020}
     1021#endif
     1022
    10081023static inline WebKitCSSResourceValue* maskImageValueFromIterator(CSSValueList& maskImagesList, CSSValueList::iterator it)
    10091024{
  • trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp

    r185238 r185846  
    193193        }
    194194    }
     195#if ENABLE(FILTERS_LEVEL_2)
     196    result.setUsedForBackdropFilters(from.isUsedForBackdropFilters() || to.isUsedForBackdropFilters());
     197#endif
     198
    195199    return result;
    196200}
  • trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCAFiltersMac.mm

    r181191 r185846  
    162162            CAFilter *filter = [CAFilter filterWithType:kCAFilterGaussianBlur];
    163163            [filter setValue:[NSNumber numberWithFloat:floatValueForLength(blurOperation.stdDeviation(), 0)] forKey:@"inputRadius"];
     164#if ENABLE(FILTERS_LEVEL_2)
     165            if (filters.isUsedForBackdropFilters())
     166                [filter setValue:[NSNumber numberWithBool:YES] forKey:@"inputNormalizeEdges"];
     167#endif
    164168            [filter setName:filterName];
    165169            [array.get() addObject:filter];
  • trunk/Source/WebCore/platform/graphics/filters/FilterOperations.cpp

    r174654 r185846  
    5252{
    5353    m_operations = other.m_operations;
     54#if ENABLE(FILTERS_LEVEL_2)
     55    m_usedForBackdropFilters = other.m_usedForBackdropFilters;
     56#endif
    5457    return *this;
    5558}
     
    5962    if (m_operations.size() != o.m_operations.size())
    6063        return false;
    61        
     64
     65#if ENABLE(FILTERS_LEVEL_2)
     66    if (m_usedForBackdropFilters != o.m_usedForBackdropFilters)
     67        return false;
     68#endif
     69
    6270    unsigned s = m_operations.size();
    6371    for (unsigned i = 0; i < s; i++) {
  • trunk/Source/WebCore/platform/graphics/filters/FilterOperations.h

    r180441 r185846  
    4343   
    4444    WEBCORE_EXPORT FilterOperations& operator=(const FilterOperations&);
    45    
     45
    4646    bool operator==(const FilterOperations&) const;
    4747    bool operator!=(const FilterOperations& o) const
     
    7171
    7272    bool hasReferenceFilter() const;
     73
     74#if ENABLE(FILTERS_LEVEL_2)
     75    bool isUsedForBackdropFilters() const { return m_usedForBackdropFilters; }
     76    void setUsedForBackdropFilters(bool usedForBackdrop) { m_usedForBackdropFilters = usedForBackdrop; }
     77#endif
     78
    7379private:
    7480    Vector<RefPtr<FilterOperation>> m_operations;
     81#if ENABLE(FILTERS_LEVEL_2)
     82    bool m_usedForBackdropFilters { false };
     83#endif
    7584};
    7685
Note: See TracChangeset for help on using the changeset viewer.