Commit 75024de8 authored by Hui Yingst's avatar Hui Yingst Committed by Chromium LUCI CQ

Migrate OutOfProcessInstance scrolling members types.

This CL changes `scroll_offset_at_last_raster_`, `scroll_offset_`, and
BoundScrollOffsetToDocument() from pp::FloatPoint/pp::Point to
gfx::PointF/gfx::Point, so that they can be migrated to
PdfViewPluginBase later.

Bug: 1101101
Change-Id: Iaa845e45b7d6a1d735fb44de3f7194df43b0f32f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2626926
Commit-Queue: Hui Yingst <nigi@chromium.org>
Reviewed-by: default avatarDaniel Hosseinian <dhoss@chromium.org>
Reviewed-by: default avatarK. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844198}
parent 4897c7e7
......@@ -68,6 +68,7 @@
#include "ppapi/cpp/var_array_buffer.h"
#include "ppapi/cpp/var_dictionary.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
......@@ -854,7 +855,7 @@ void OutOfProcessInstance::DidChangeView(const pp::View& view) {
}
if (!stop_scrolling_) {
scroll_offset_ = view.GetScrollOffset();
scroll_offset_ = PointFromPPPoint(view.GetScrollOffset());
UpdateScroll();
}
}
......@@ -866,7 +867,7 @@ void OutOfProcessInstance::UpdateScroll() {
// are 0-based (i.e. they do not correspond to the viewport's coordinates in
// JS), so we need to subtract the toolbar height to convert them into
// viewport coordinates.
pp::FloatPoint scroll_offset_float(
gfx::PointF scroll_offset_float(
scroll_offset_.x(),
scroll_offset_.y() - top_toolbar_height_in_viewport_coords());
scroll_offset_float = BoundScrollOffsetToDocument(scroll_offset_float);
......@@ -1971,7 +1972,7 @@ void OutOfProcessInstance::HandleUpdateScrollMessage(
int x = dict.Get(pp::Var(kJSUpdateScrollX)).AsInt();
int y = dict.Get(pp::Var(kJSUpdateScrollY)).AsInt();
scroll_offset_ = pp::Point(x, y);
scroll_offset_ = gfx::Point(x, y);
UpdateScroll();
}
......@@ -2000,7 +2001,7 @@ void OutOfProcessInstance::HandleViewportMessage(
double new_zoom = dict.Get(pp::Var(kJSZoom)).AsDouble();
double zoom_ratio = new_zoom / zoom();
pp::FloatPoint scroll_offset(dict.Get(pp::Var(kJSXOffset)).AsDouble(),
gfx::PointF scroll_offset(dict.Get(pp::Var(kJSXOffset)).AsDouble(),
dict.Get(pp::Var(kJSYOffset)).AsDouble());
if (pinch_phase == PINCH_START) {
......@@ -2492,8 +2493,8 @@ void OutOfProcessInstance::UserMetricsRecordAction(const std::string& action) {
pp::PDF::UserMetricsRecordAction(this, pp::Var(action));
}
pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument(
const pp::FloatPoint& scroll_offset) {
gfx::PointF OutOfProcessInstance::BoundScrollOffsetToDocument(
const gfx::PointF& scroll_offset) {
float max_x = std::max(
document_size().width() * float{zoom()} - plugin_dip_size().width(),
0.0f);
......@@ -2503,7 +2504,7 @@ pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument(
document_size().height() * float{zoom()} - plugin_dip_size().height(),
min_y);
float y = base::ClampToRange(scroll_offset.y(), min_y, max_y);
return pp::FloatPoint(x, y);
return gfx::PointF(x, y);
}
bool OutOfProcessInstance::SendInputEventToEngine(const pp::InputEvent& event) {
......
......@@ -26,6 +26,8 @@
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/private/find_private.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect.h"
namespace gfx {
......@@ -291,8 +293,7 @@ class OutOfProcessInstance : public PdfViewPluginBase,
void SendThumbnail(const std::string& message_id, Thumbnail thumbnail);
// Bound the given scroll offset to the document.
pp::FloatPoint BoundScrollOffsetToDocument(
const pp::FloatPoint& scroll_offset);
gfx::PointF BoundScrollOffsetToDocument(const gfx::PointF& scroll_offset);
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
......@@ -344,7 +345,7 @@ class OutOfProcessInstance : public PdfViewPluginBase,
PP_CursorType_Dev cursor_ = PP_CURSORTYPE_POINTER;
// The scroll offset in CSS pixels.
pp::Point scroll_offset_;
gfx::Point scroll_offset_;
// Enumeration of pinch states.
// This should match PinchPhase enum in
......@@ -361,7 +362,7 @@ class OutOfProcessInstance : public PdfViewPluginBase,
bool needs_reraster_ = true;
// The scroll position for the last raster, before any transformations are
// applied.
pp::FloatPoint scroll_offset_at_last_raster_;
gfx::PointF scroll_offset_at_last_raster_;
// True if last bitmap was smaller than screen.
bool last_bitmap_smaller_ = false;
// True if the plugin is full-page.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment