diff --git a/plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php b/plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php index 4791b845cf..8d35084e19 100644 --- a/plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php +++ b/plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php @@ -44,6 +44,18 @@ public function __invoke( OD_Tag_Visitor_Context $context ): bool { return false; } + $minimum_height = $context->url_metrics_group_collection->get_element_minimum_height( $processor->get_xpath() ); + if ( is_int( $minimum_height ) ) { + $style = $processor->get_attribute( 'style' ); + if ( is_string( $style ) ) { + $style = rtrim( trim( $style ), ';' ) . '; '; + } else { + $style = ''; + } + $style .= sprintf( 'min-height: %dpx;', $minimum_height ); + $processor->set_attribute( 'style', $style ); + } + $max_intersection_ratio = $context->url_metrics_group_collection->get_element_max_intersection_ratio( $processor->get_xpath() ); if ( $max_intersection_ratio > 0 ) { diff --git a/plugins/embed-optimizer/tests/test-optimization-detective.php b/plugins/embed-optimizer/tests/test-optimization-detective.php index cad101ad71..47e8e53237 100644 --- a/plugins/embed-optimizer/tests/test-optimization-detective.php +++ b/plugins/embed-optimizer/tests/test-optimization-detective.php @@ -74,7 +74,7 @@ public function data_provider_test_od_optimize_template_output_buffer(): array { -
+
@@ -118,7 +118,7 @@ public function data_provider_test_od_optimize_template_output_buffer(): array { ... -
+
@@ -165,7 +165,7 @@ public function data_provider_test_od_optimize_template_output_buffer(): array { -
+
@@ -211,7 +211,7 @@ public function data_provider_test_od_optimize_template_output_buffer(): array { ... -
+
@@ -263,7 +263,7 @@ public function data_provider_test_od_optimize_template_output_buffer(): array { -
+
@@ -311,7 +311,7 @@ public function data_provider_test_od_optimize_template_output_buffer(): array { ... -
+
@@ -360,7 +360,7 @@ public function data_provider_test_od_optimize_template_output_buffer(): array { ... -
+
@@ -447,12 +447,12 @@ function ( OD_Tag_Visitor_Context $context ): bool { ... -
+
-
+

So I heard you like FIGURE?

@@ -474,12 +474,12 @@ function ( OD_Tag_Visitor_Context $context ): bool { -
+
-
+

So I heard you like FIGURE?

@@ -654,12 +654,12 @@ static function ( array $element ): array { 'isLCPCandidate' => true, 'intersectionRatio' => 1, 'intersectionRect' => array( - 'width' => 100, - 'height' => 100, + 'width' => 500, + 'height' => 500, ), 'boundingClientRect' => array( - 'width' => 100, - 'height' => 100, + 'width' => 500, + 'height' => 500, ), ), $element