Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[dart:ui] Add view ID to PointerData.toString #51352

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ui/pointer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ class PointerData {
final double rotation;

@override
String toString() => 'PointerData(x: $physicalX, y: $physicalY)';
String toString() => 'PointerData(viewId: $viewId, x: $physicalX, y: $physicalY)';

/// Returns a complete textual description of the information in this object.
String toStringFull() {
Expand Down
10 changes: 5 additions & 5 deletions lib/ui/window/platform_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,13 +481,13 @@ class PlatformConfiguration final {
void ReportTimings(std::vector<int64_t> timings);

//----------------------------------------------------------------------------
/// @brief Retrieves the Window with the given ID managed by the
/// `PlatformConfiguration`.
/// @brief Retrieves the viewport metrics with the given ID managed by
/// the `PlatformConfiguration`.
///
/// @param[in] window_id The id of the window to find and return.
/// @param[in] view_id The id of the view's viewport metrics to return.
///
/// @return a pointer to the Window. Returns nullptr if the ID is not
/// found.
/// @return a pointer to the ViewportMetrics. Returns nullptr if the ID is
/// not found.
///
const ViewportMetrics* GetMetrics(int view_id);

Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/lib/pointer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class PointerData {
final double rotation;

@override
String toString() => 'PointerData(x: $physicalX, y: $physicalY)';
String toString() => 'PointerData(viewId: $viewId, x: $physicalX, y: $physicalY)';
String toStringFull() {
return '$runtimeType('
'embedderId: $embedderId, '
Expand Down
3 changes: 2 additions & 1 deletion shell/platform/embedder/tests/embedder_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2700,7 +2700,7 @@ TEST_F(EmbedderTest, CanSendPointer) {
CREATE_NATIVE_ENTRY([&message_latch](Dart_NativeArguments args) {
auto message = tonic::DartConverter<std::string>::FromDart(
Dart_GetNativeArgument(args, 0));
ASSERT_EQ("PointerData(x: 123.0, y: 456.0)", message);
ASSERT_EQ("PointerData(viewId: 0, x: 123.0, y: 456.0)", message);
message_latch.Signal();
}));

Expand All @@ -2715,6 +2715,7 @@ TEST_F(EmbedderTest, CanSendPointer) {
pointer_event.x = 123;
pointer_event.y = 456;
pointer_event.timestamp = static_cast<size_t>(1234567890);
pointer_event.view_id = 0;

FlutterEngineResult result =
FlutterEngineSendPointerEvent(engine.get(), &pointer_event, 1);
Expand Down