Changeset 261548 in webkit


Ignore:
Timestamp:
May 12, 2020 12:20:57 AM (4 years ago)
Author:
commit-queue@webkit.org
Message:

Need to advertise support for WebP in the Accept header
https://bugs.webkit.org/show_bug.cgi?id=211735

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2020-05-12
Reviewed by Darin Adler.

Source/WebCore:

On Mac and iOS, the system has to support WebP: HAVE(WEBP).
On other platforms, WebKit has to be able to decode WebP images: USE(WEBP).

  • css/CSSCalculationValue.cpp:

(WebCore::createCSS):
Fix unrealted coding style issue.

  • loader/cache/CachedResourceRequest.cpp:

(WebCore::acceptHeaderValueForImageResource):
(WebCore::acceptHeaderValueFromType):

LayoutTests:

  • http/tests/misc/resources/image-checks-for-accept.php:

Make sure the Accept header accepts all images mime types.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r261547 r261548  
     12020-05-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Need to advertise support for WebP in the Accept header
     4        https://bugs.webkit.org/show_bug.cgi?id=211735
     5
     6        Reviewed by Darin Adler.
     7
     8        * http/tests/misc/resources/image-checks-for-accept.php:
     9        Make sure the Accept header accepts all images mime types.
     10
    1112020-05-11  Diego Pino Garcia  <dpino@igalia.com>
    212
  • trunk/LayoutTests/http/tests/misc/resources/image-checks-for-accept.php

    r225472 r261548  
    11<?php
    2     if($_SERVER["HTTP_ACCEPT"] == "image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"
    3         || $_SERVER["HTTP_ACCEPT"] == "image/png,image/svg+xml,image/*;q=0.8,video/*;q=0.8,*/*;q=0.5")
     2    $allimages = 'image/*';
     3    $pos = strpos($_SERVER["HTTP_ACCEPT"], $allimages);
     4    if ($pos !== false)
    45    {
    56        header("Content-Type: image/jpg");
  • trunk/Source/WebCore/ChangeLog

    r261546 r261548  
     12020-05-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Need to advertise support for WebP in the Accept header
     4        https://bugs.webkit.org/show_bug.cgi?id=211735
     5
     6        Reviewed by Darin Adler.
     7
     8        On Mac and iOS, the system has to support WebP: HAVE(WEBP).
     9        On other platforms, WebKit has to be able to decode WebP images: USE(WEBP).
     10
     11        * css/CSSCalculationValue.cpp:
     12        (WebCore::createCSS):
     13        Fix unrealted coding style issue.
     14
     15        * loader/cache/CachedResourceRequest.cpp:
     16        (WebCore::acceptHeaderValueForImageResource):
     17        (WebCore::acceptHeaderValueFromType):
     18
    1192020-05-11  Darin Adler  <darin@apple.com>
    220
  • trunk/Source/WebCore/css/CSSCalculationValue.cpp

    r259703 r261548  
    19551955                return nullptr;
    19561956            return CSSCalcOperationNode::createSum(WTFMove(children));
    1957         } case CalcOperator::Subtract: {
     1957        }
     1958        case CalcOperator::Subtract: {
    19581959            ASSERT(operationChildren.size() == 2);
    19591960
  • trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp

    r261036 r261548  
    123123}
    124124
     125static inline constexpr ASCIILiteral acceptHeaderValueForImageResource(bool supportsVideoImage)
     126{
     127#if HAVE(WEBP) || USE(WEBP)
     128    #define WEBP_HEADER_PART "image/webp,"
     129#else
     130    #define WEBP_HEADER_PART ""
     131#endif
     132    if (supportsVideoImage)
     133        return WEBP_HEADER_PART "image/png,image/svg+xml,image/*;q=0.8,video/*;q=0.8,*/*;q=0.5"_s;
     134    return WEBP_HEADER_PART "image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"_s;
     135    #undef WEBP_HEADER_PART
     136}
     137
    125138static inline String acceptHeaderValueFromType(CachedResource::Type type)
    126139{
     
    129142        return "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"_s;
    130143    case CachedResource::Type::ImageResource:
    131         if (ImageDecoder::supportsMediaType(ImageDecoder::MediaType::Video))
    132             return "image/png,image/svg+xml,image/*;q=0.8,video/*;q=0.8,*/*;q=0.5"_s;
    133         return "image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"_s;
     144        return acceptHeaderValueForImageResource(ImageDecoder::supportsMediaType(ImageDecoder::MediaType::Video));
    134145    case CachedResource::Type::CSSStyleSheet:
    135146        return "text/css,*/*;q=0.1"_s;
Note: See TracChangeset for help on using the changeset viewer.