From dbc2a8a17324b44edbca9c5492d37954f43d7d8f Mon Sep 17 00:00:00 2001 From: Gajendra N Date: Tue, 21 Mar 2023 14:26:25 +0530 Subject: [PATCH] [M108 Migration][Loading Performance] Apply to prevent incremental image rendering Do not request image rendering when image resource is loading for page loading performance. This patch is written referring to tizen 2.4 webkit's code. Reference: https://review.tizen.org/gerrit/268835 Change-Id: Ifc46153667dc5af8d782c890335d32ae9ae44035 Signed-off-by: Gajendra N --- third_party/blink/renderer/core/layout/layout_image.cc | 14 ++++++++++++++ .../core/loader/resource/image_resource_content.cc | 6 ++++++ .../renderer/core/loader/resource/image_resource_content.h | 4 ++++ 3 files changed, 24 insertions(+) diff --git a/third_party/blink/renderer/core/layout/layout_image.cc b/third_party/blink/renderer/core/layout/layout_image.cc index a5828c0..a663397 100644 --- a/third_party/blink/renderer/core/layout/layout_image.cc +++ b/third_party/blink/renderer/core/layout/layout_image.cc @@ -52,6 +52,10 @@ #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "ui/gfx/geometry/size_conversions.h" +#if BUILDFLAG(IS_TIZEN) +#include "third_party/blink/renderer/core/paint/paint_info.h" +#endif + namespace blink { LayoutImage::LayoutImage(Element* element) @@ -222,6 +226,16 @@ void LayoutImage::PaintReplaced(const PaintInfo& paint_info, void LayoutImage::Paint(const PaintInfo& paint_info) const { NOT_DESTROYED(); +#if BUILDFLAG(IS_TIZEN) + // Do not request image rendering when image resource is loading + // for page loading performance. + if (paint_info.phase == PaintPhase::kForeground && + !Style()->HasBoxDecorations() && image_resource_ && + image_resource_->CachedImage() && + image_resource_->CachedImage()->IsLoading()) { + return; + } +#endif ImagePainter(*this).Paint(paint_info); } diff --git a/third_party/blink/renderer/core/loader/resource/image_resource_content.cc b/third_party/blink/renderer/core/loader/resource/image_resource_content.cc index aa6087b..c1b61f0 100644 --- a/third_party/blink/renderer/core/loader/resource/image_resource_content.cc +++ b/third_party/blink/renderer/core/loader/resource/image_resource_content.cc @@ -456,6 +456,12 @@ ImageResourceContent::UpdateImageResult ImageResourceContent::UpdateImage( DCHECK(all_data_received || size_available_ != Image::kSizeAvailableAndLoadingAsynchronously); +#if BUILDFLAG(IS_TIZEN) + if (!notified_) + notified_ = true; + else if (!all_data_received) + return UpdateImageResult::kNoDecodeError; +#endif // Notifies the observers. // It would be nice to only redraw the decoded band of the image, but with the // current design (decoding delayed until painting) that seems hard. diff --git a/third_party/blink/renderer/core/loader/resource/image_resource_content.h b/third_party/blink/renderer/core/loader/resource/image_resource_content.h index 834a0dc..c9ae5e5 100644 --- a/third_party/blink/renderer/core/loader/resource/image_resource_content.h +++ b/third_party/blink/renderer/core/loader/resource/image_resource_content.h @@ -268,6 +268,10 @@ class CORE_EXPORT ImageResourceContent final scoped_refptr image_; +#if BUILDFLAG(IS_TIZEN) + bool notified_ = false; +#endif + HeapHashCountedSet> observers_; HeapHashCountedSet> finished_observers_; -- 2.7.4