From: wangjing Date: Fri, 24 Mar 2023 03:34:05 +0000 (+0800) Subject: [M108 Migration] Check scroll area pointer before use X-Git-Tag: submit/tizen/20230328.160023~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97d979a7d28607aea454cfcd4b86e2c2ede4faee;p=platform%2Fframework%2Fweb%2Fchromium-efl.git [M108 Migration] Check scroll area pointer before use -Check the pointer is not null before using, otherwise this causes the render process crashes. -Add some macro. reference: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/274002/ Change-Id: I617b8c7ee002e9b3e185aa27c17d19c9c90bb4e5 Signed-off-by: wangjing --- diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h index 3f8f71a22dc0..74df9242fb45 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h @@ -43,7 +43,9 @@ #include "third_party/blink/public/platform/cross_variant_mojo_util.h" #include "third_party/blink/public/platform/scheduler/web_agent_group_scheduler.h" #include "third_party/blink/public/platform/web_common.h" +#if BUILDFLAG(IS_TIZEN_TV) #include "third_party/blink/renderer/core/scroll/scroll_types.h" +#endif #include "third_party/skia/include/core/SkColor.h" #include "ui/display/mojom/screen_orientation.mojom-shared.h" diff --git a/third_party/blink/renderer/core/input/scroll_manager.cc b/third_party/blink/renderer/core/input/scroll_manager.cc index 850c18180bec..6aaf27be259c 100644 --- a/third_party/blink/renderer/core/input/scroll_manager.cc +++ b/third_party/blink/renderer/core/input/scroll_manager.cc @@ -318,8 +318,12 @@ bool ScrollManager::CanScroll(const ScrollState& scroll_state, bool ScrollManager::LogicalScroll(mojom::blink::ScrollDirection direction, ui::ScrollGranularity granularity, Node* start_node, - Node* mouse_press_node, - float data) { + Node* mouse_press_node +#if BUILDFLAG(IS_TIZEN_TV) + , + float data +#endif + ) { Node* node = start_node; if (!node) @@ -361,6 +365,13 @@ bool ScrollManager::LogicalScroll(mojom::blink::ScrollDirection direction, ScrollableArea* scrollable_area = ScrollableArea::GetForScrolling(box); DCHECK(scrollable_area); +#if BUILDFLAG(IS_TIZEN_TV) + if (!scrollable_area) { + LOG(ERROR) << " Scrollable area is NULL"; + return false; + } +#endif + ScrollOffset delta = ToScrollDelta(physical_direction, ScrollableArea::DirectionBasedScrollDelta(granularity)); @@ -405,10 +416,18 @@ bool ScrollManager::LogicalScroll(mojom::blink::ScrollDirection direction, area->OnScrollFinished(); }, WrapWeakPersistent(scrollable_area))); +#if BUILDFLAG(IS_TIZEN_TV) ScrollResult result = scrollable_area->UserScroll( granularity, ToScrollDelta(physical_direction, data), std::move(callback)); +#else + ScrollResult result = scrollable_area->UserScroll( + granularity, + ToScrollDelta(physical_direction, + ScrollableArea::DirectionBasedScrollDelta(granularity)), + std::move(callback)); +#endif if (result.DidScroll()) return true; diff --git a/third_party/blink/renderer/core/input/scroll_manager.h b/third_party/blink/renderer/core/input/scroll_manager.h index 576d519a1384..6d092a697536 100644 --- a/third_party/blink/renderer/core/input/scroll_manager.h +++ b/third_party/blink/renderer/core/input/scroll_manager.h @@ -71,8 +71,12 @@ class CORE_EXPORT ScrollManager : public GarbageCollected, bool LogicalScroll(mojom::blink::ScrollDirection, ui::ScrollGranularity, Node* start_node, - Node* mouse_press_node, - float data = 1.0); + Node* mouse_press_node +#if BUILDFLAG(IS_TIZEN_TV) + , + float data = 1.0 +#endif + ); // Performs a logical scroll that chains, crossing frames, starting from // the given node or a reasonable default (focus/last clicked).