[M108 Migration] Check scroll area pointer before use 98/290398/4
authorwangjing <jing124.wang@samsung.com>
Fri, 24 Mar 2023 03:34:05 +0000 (11:34 +0800)
committerBot Blink <blinkbot@samsung.com>
Tue, 28 Mar 2023 02:42:28 +0000 (02:42 +0000)
-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 <jing124.wang@samsung.com>
third_party/blink/public/web/web_view.h
third_party/blink/renderer/core/input/scroll_manager.cc
third_party/blink/renderer/core/input/scroll_manager.h

index 3f8f71a..74df924 100644 (file)
@@ -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"
 #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"
 #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"
 
 #include "third_party/skia/include/core/SkColor.h"
 #include "ui/display/mojom/screen_orientation.mojom-shared.h"
 
index 850c181..6aaf27b 100644 (file)
@@ -318,8 +318,12 @@ bool ScrollManager::CanScroll(const ScrollState& scroll_state,
 bool ScrollManager::LogicalScroll(mojom::blink::ScrollDirection direction,
                                   ui::ScrollGranularity granularity,
                                   Node* start_node,
 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)
   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);
 
     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));
     ScrollOffset delta =
         ToScrollDelta(physical_direction,
                       ScrollableArea::DirectionBasedScrollDelta(granularity));
@@ -405,10 +416,18 @@ bool ScrollManager::LogicalScroll(mojom::blink::ScrollDirection direction,
             area->OnScrollFinished();
         },
         WrapWeakPersistent(scrollable_area)));
             area->OnScrollFinished();
         },
         WrapWeakPersistent(scrollable_area)));
+#if BUILDFLAG(IS_TIZEN_TV)
     ScrollResult result = scrollable_area->UserScroll(
         granularity,
         ToScrollDelta(physical_direction, data),
         std::move(callback));
     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;
 
     if (result.DidScroll())
       return true;
index 576d519..6d092a6 100644 (file)
@@ -71,8 +71,12 @@ class CORE_EXPORT ScrollManager : public GarbageCollected<ScrollManager>,
   bool LogicalScroll(mojom::blink::ScrollDirection,
                      ui::ScrollGranularity,
                      Node* start_node,
   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).
 
   // Performs a logical scroll that chains, crossing frames, starting from
   // the given node or a reasonable default (focus/last clicked).