diff --git a/includes/sanitizers/class-amp-base-sanitizer.php b/includes/sanitizers/class-amp-base-sanitizer.php
index fcf784d0678..43cbcc2b5aa 100644
--- a/includes/sanitizers/class-amp-base-sanitizer.php
+++ b/includes/sanitizers/class-amp-base-sanitizer.php
@@ -211,9 +211,6 @@ public function set_layout( $attributes ) {
if ( empty( $attributes['width'] ) ) {
$attributes['layout'] = 'fixed-height';
}
- if ( ! empty( $attributes['width'] ) && ! empty( $attributes['height'] ) ) {
- $attributes['layout'] = 'responsive';
- }
return $attributes;
}
diff --git a/includes/sanitizers/class-amp-iframe-sanitizer.php b/includes/sanitizers/class-amp-iframe-sanitizer.php
index a2acdd0de76..c3bd35dea30 100644
--- a/includes/sanitizers/class-amp-iframe-sanitizer.php
+++ b/includes/sanitizers/class-amp-iframe-sanitizer.php
@@ -80,7 +80,8 @@ public function sanitize() {
$this->did_convert_elements = true;
- $new_attributes = $this->set_layout( $new_attributes );
+ $new_attributes = $this->set_layout( $new_attributes );
+ $new_attributes['style'] = 'max-width:100%';
if ( isset( $new_attributes['width'] ) && isset( $new_attributes['height'] ) ) {
$this->add_or_append_attribute( $new_attributes, 'class', 'amp-wp-enforced-sizes' );
}
diff --git a/includes/sanitizers/class-amp-video-sanitizer.php b/includes/sanitizers/class-amp-video-sanitizer.php
index a4a7c2b56cc..08e7762839f 100644
--- a/includes/sanitizers/class-amp-video-sanitizer.php
+++ b/includes/sanitizers/class-amp-video-sanitizer.php
@@ -52,7 +52,7 @@ public function sanitize() {
$new_attributes = $this->set_layout( $new_attributes );
if ( isset( $new_attributes['width'] ) && isset( $new_attributes['height'] ) ) {
- $this->add_or_append_attribute( $new_attributes, 'class', 'amp-wp-enforced-sizes' );
+ $new_attributes['layout'] = 'responsive';
}
$new_node = AMP_DOM_Utils::create_node( $this->dom, 'amp-video', $new_attributes );
diff --git a/tests/test-amp-iframe-sanitizer.php b/tests/test-amp-iframe-sanitizer.php
index 7f02bafc3da..b3fdd23e5d6 100644
--- a/tests/test-amp-iframe-sanitizer.php
+++ b/tests/test-amp-iframe-sanitizer.php
@@ -10,57 +10,57 @@ public function get_data() {
'simple_iframe' => array(
'',
- '
contents
', - 'contents
contents