1. 23 Aug, 2013 1 commit
    • commit-queue@webkit.org's avatar
      Fix srcset's image candidate algorithm when DPR exceeds all candidates · 058b9ddc
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=120168
      
      Source/WebCore:
      
      When the DPR exceeded the 'x' qualifier of all image candidates, none was chosen.
      
      From the srcset spec: "If there are any entries in candidates that have an associated pixel density that is less than a
      user-agent-defined value giving the nominal pixel density of the display, then remove them, unless that would remove all the
      entries, in which case remove only the entries whose associated pixel density is less than the greatest such pixel density."
      
      Fixed by returning the last one in the list of candidates sorted by their qualifier, in case none of them is equal or greater than
      DPR.
      
      Patch by Yoav Weiss <yoav@yoav.ws> on 2013-08-23
      Reviewed by Andreas Kling.
      
      Test: fast/hidpi/image-srcset-fraction.html
      
      * html/parser/HTMLParserIdioms.cpp:
      (WebCore::bestFitSourceForImageAttributes):
      
      LayoutTests:
      
      From the srcset spec: "If there are any entries in candidates that have an associated pixel density that is less than a
      user-agent-defined value giving the nominal pixel density of the display, then remove them, unless that would remove all the
      entries, in which case remove only the entries whose associated pixel density is less than the greatest such pixel density."
      
      This test verifies that when all the candidates' qualifiers are smaller than the DPR, the highest one is returned.
      
      Patch by Yoav Weiss <yoav@yoav.ws> on 2013-08-23
      Reviewed by Andreas Kling.
      
      * fast/hidpi/image-srcset-fraction-expected.txt: Added.
      * fast/hidpi/image-srcset-fraction.html: Added.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154497 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      058b9ddc