diff --git a/core/core.libraries.yml b/core/core.libraries.yml index a482cac..be9dac7 100644 --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -779,7 +779,7 @@ picturefill: version: 2.1.0 license: name: MIT - url: https://github.com/scottjehl/picturefill/blob/master/LICENSE + url: https://github.com/scottjehl/picturefill/blob/2.1.0/LICENSE gpl-compatible: true js: assets/vendor/picturefill/picturefill.js: { weight: -10 } diff --git a/core/includes/theme.inc b/core/includes/theme.inc index de3ebc0..86a81e9 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1083,22 +1083,21 @@ function template_preprocess_image(&$variables) { if (!empty($variables['uri'])) { $variables['attributes']['src'] = file_create_url($variables['uri']); } - + // Generate a srcset attribute conforming to the spec at + // http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#attr-img-srcset if (!empty($variables['srcset'])) { $srcsets = array(); foreach ($variables['srcset'] as $srcset) { // URI is mandatory. - if (isset($srcset['uri']) && !empty($srcset['uri'])) { - $srcset['src'] = file_create_url($srcset['uri']); - $new_source = $srcset['src']; - if (isset($srcset['width']) && !empty($srcset['width'])) { - $new_source .= ' ' . $srcset['width']; - } - elseif (isset($srcset['multiplier']) && !empty($srcset['multiplier'])) { - $new_source .= ' ' . $srcset['multiplier']; - } - $srcsets[] = $new_source; + $srcset['src'] = file_create_url($srcset['uri']); + $new_source = $srcset['src']; + if (isset($srcset['width']) && !empty($srcset['width'])) { + $new_source .= ' ' . $srcset['width']; + } + elseif (isset($srcset['multiplier']) && !empty($srcset['multiplier'])) { + $new_source .= ' ' . $srcset['multiplier']; } + $srcsets[] = $new_source; } $variables['attributes']['srcset'] = implode(', ', $srcsets); } diff --git a/core/modules/breakpoint/src/Tests/BreakpointDiscoveryTest.php b/core/modules/breakpoint/src/Tests/BreakpointDiscoveryTest.php index 40ee22d..1523d0e 100644 --- a/core/modules/breakpoint/src/Tests/BreakpointDiscoveryTest.php +++ b/core/modules/breakpoint/src/Tests/BreakpointDiscoveryTest.php @@ -35,7 +35,7 @@ public function testThemeBreakpoints() { $expected_breakpoints = array( 'breakpoint_theme_test.tv' => array( 'label' => 'tv', - 'mediaQuery' => 'only screen and (min-width: 3456px)', + 'mediaQuery' => 'only screen and (min-width: 1220px)', 'weight' => 0, 'multipliers' => array( '1x', diff --git a/core/modules/breakpoint/tests/src/BreakpointTest.php b/core/modules/breakpoint/tests/src/BreakpointTest.php index a2b62ea..3db03fb 100644 --- a/core/modules/breakpoint/tests/src/BreakpointTest.php +++ b/core/modules/breakpoint/tests/src/BreakpointTest.php @@ -87,9 +87,9 @@ public function testGetWeight() { * @covers ::getMediaQuery */ public function testGetMediaQuery() { - $this->pluginDefinition['mediaQuery'] = 'only screen and (min-width: 3456px)'; + $this->pluginDefinition['mediaQuery'] = 'only screen and (min-width: 1220px)'; $this->setupBreakpoint(); - $this->assertEquals('only screen and (min-width: 3456px)', $this->breakpoint->getMediaQuery()); + $this->assertEquals('only screen and (min-width: 1220px)', $this->breakpoint->getMediaQuery()); } /** diff --git a/core/modules/breakpoint/tests/themes/breakpoint_theme_test/breakpoint_theme_test.breakpoints.yml b/core/modules/breakpoint/tests/themes/breakpoint_theme_test/breakpoint_theme_test.breakpoints.yml index c3317d6..3e565e1 100644 --- a/core/modules/breakpoint/tests/themes/breakpoint_theme_test/breakpoint_theme_test.breakpoints.yml +++ b/core/modules/breakpoint/tests/themes/breakpoint_theme_test/breakpoint_theme_test.breakpoints.yml @@ -13,7 +13,7 @@ breakpoint_theme_test.narrow: # Out of order breakpoint to test sorting. breakpoint_theme_test.tv: label: tv - mediaQuery: 'only screen and (min-width: 3456px)' + mediaQuery: 'only screen and (min-width: 1220px)' weight: 0 multipliers: - 1x diff --git a/core/modules/image/src/ImageEffectInterface.php b/core/modules/image/src/ImageEffectInterface.php index 6c84ed5..14ae16d 100644 --- a/core/modules/image/src/ImageEffectInterface.php +++ b/core/modules/image/src/ImageEffectInterface.php @@ -44,10 +44,10 @@ public function applyEffect(ImageInterface $image); public function transformDimensions(array &$dimensions); /** - * Determines the mime type of the styled image. + * Determines the MIME type of the image effect. * * @param string $mime_type - * Mime type to be modified. + * MIME type to be modified. */ public function transformMimeType(&$mime_type); diff --git a/core/modules/image/src/ImageStyleInterface.php b/core/modules/image/src/ImageStyleInterface.php index d58e566..13a0d36 100644 --- a/core/modules/image/src/ImageStyleInterface.php +++ b/core/modules/image/src/ImageStyleInterface.php @@ -131,10 +131,10 @@ public function createDerivative($original_uri, $derivative_uri); public function transformDimensions(array &$dimensions); /** - * Determines the mime type of the styled image. + * Determines the MIME type of the image style. * * @param string $mime_type - * Mime type to be modified. + * MIME type to be modified. */ public function transformMimeType(&$mime_type); diff --git a/core/modules/image/src/Tests/ImageStyleTest.php b/core/modules/image/src/Tests/ImageStyleTest.php index dcb5aa8..a6a15c2 100644 --- a/core/modules/image/src/Tests/ImageStyleTest.php +++ b/core/modules/image/src/Tests/ImageStyleTest.php @@ -9,7 +9,7 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Tests\UnitTestCase; -use \Drupal\image\Entity\ImageStyle; +use Drupal\image\Entity\ImageStyle; /** * @coversDefaultClass \Drupal\image\Entity\ImageStyle @@ -57,32 +57,21 @@ class ImageStyleTest extends UnitTestCase { /** * {@inheritdoc} */ - public static function getInfo() { - return array( - 'description' => '', - 'name' => '\Drupal\image\Entity\ImageStyle unit test', - 'group' => 'Image', - ); - } - - /** - * {@inheritdoc} - */ public function setUp() { $this->entityTypeId = $this->randomMachineName(); $this->provider = $this->randomMachineName(); $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface'); $this->entityType->expects($this->any()) - ->method('getProvider') - ->will($this->returnValue($this->provider)); + ->method('getProvider') + ->will($this->returnValue($this->provider)); $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface'); $this->entityManager->expects($this->any()) - ->method('getDefinition') - ->with($this->entityTypeId) - ->will($this->returnValue($this->entityType)); + ->method('getDefinition') + ->with($this->entityTypeId) + ->will($this->returnValue($this->entityType)); $this->effectManager = $this->getMockBuilder('\Drupal\image\ImageEffectManager') - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); $container = new ContainerBuilder(); \Drupal::setContainer($container); } @@ -94,15 +83,15 @@ public function testTransformMimeType() { $image_effect_id = $this->randomMachineName(); $logger = $this->getMockBuilder('\Psr\Log\LoggerInterface')->getMock(); $image_effect = $this->getMockBuilder('\Drupal\image\ImageEffectBase') - ->setConstructorArgs(array(array(), $image_effect_id, array(), $logger)) - ->getMock(); + ->setConstructorArgs(array(array(), $image_effect_id, array(), $logger)) + ->getMock(); $image_effect->expects($this->any()) - ->method('transformMimeType') - ->will($this->returnCallback(function (&$mime_type) { $mime_type = 'image/webp';})); + ->method('transformMimeType') + ->will($this->returnCallback(function (&$mime_type) { $mime_type = 'image/webp';})); $this->effectManager->expects($this->any()) - ->method('createInstance') - ->with($image_effect_id) - ->will($this->returnValue($image_effect)); + ->method('createInstance') + ->with($image_effect_id) + ->will($this->returnValue($image_effect)); \Drupal::getContainer()->set('plugin.manager.image.effect', $this->effectManager); $image_style = new ImageStyle(array('effects' => array($image_effect_id => array('id' => $image_effect_id))), $this->entityTypeId);