[PDF Ink Signatures] Fix nits in PdfInkModuleClient and overrides
- Rename GetPageContentsRect() and overrides to have a "page_index" parameter. This is more consistent with other methods. Do the same for PDFiumEngine::GetPageContentsRect(). - Keep the PdfInkModuleClient overrides sorted. Change-Id: Ib02b8f55fce685c94289c9bad9e76a2cd3b9811c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6284366 Reviewed-by: Alan Screen <awscreen@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/main@{#1422634}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
af9ba2132f
commit
91ce80cddc
@ -49,8 +49,8 @@ class PdfInkModuleClient {
|
||||
|
||||
// Gets the current scaled and rotated rectangle area of the page in CSS
|
||||
// screen coordinates for the 0-based page index. Must be non-empty for any
|
||||
// non-negative index returned from `VisiblePageIndexFromPoint()`.
|
||||
virtual gfx::Rect GetPageContentsRect(int index) = 0;
|
||||
// non-negative page index returned from `VisiblePageIndexFromPoint()`.
|
||||
virtual gfx::Rect GetPageContentsRect(int page_index) = 0;
|
||||
|
||||
// Gets the offset within the rendering viewport to where the page images
|
||||
// will be drawn. Since the offset is a location within the viewport, it
|
||||
|
@ -244,16 +244,21 @@ class FakeClient : public PdfInkModuleClient {
|
||||
~FakeClient() override = default;
|
||||
|
||||
// PdfInkModuleClient:
|
||||
MOCK_METHOD(void,
|
||||
DiscardStroke,
|
||||
(int page_index, InkStrokeId id),
|
||||
(override));
|
||||
|
||||
PageOrientation GetOrientation() const override { return orientation_; }
|
||||
|
||||
gfx::Vector2dF GetViewportOriginOffset() override {
|
||||
return viewport_origin_offset_;
|
||||
}
|
||||
|
||||
gfx::Rect GetPageContentsRect(int index) override {
|
||||
CHECK_GE(index, 0);
|
||||
CHECK_LT(static_cast<size_t>(index), page_layouts_.size());
|
||||
return gfx::ToEnclosedRect(page_layouts_[index]);
|
||||
gfx::Rect GetPageContentsRect(int page_index) override {
|
||||
CHECK_GE(page_index, 0);
|
||||
CHECK_LT(static_cast<size_t>(page_index), page_layouts_.size());
|
||||
return gfx::ToEnclosedRect(page_layouts_[page_index]);
|
||||
}
|
||||
|
||||
float GetZoom() const override { return zoom_; }
|
||||
@ -292,11 +297,6 @@ class FakeClient : public PdfInkModuleClient {
|
||||
(int page_index, InkStrokeId id, bool active),
|
||||
(override));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
DiscardStroke,
|
||||
(int page_index, InkStrokeId id),
|
||||
(override));
|
||||
|
||||
void UpdateThumbnail(int page_index) override {
|
||||
updated_thumbnail_page_indices_.push_back(page_index);
|
||||
}
|
||||
|
@ -276,16 +276,19 @@ class PdfViewWebPlugin::PdfInkModuleClientImpl : public PdfInkModuleClient {
|
||||
~PdfInkModuleClientImpl() override = default;
|
||||
|
||||
// PdfInkModuleClient:
|
||||
void DiscardStroke(int page_index, InkStrokeId id) override {
|
||||
plugin_->engine_->DiscardStroke(page_index, id);
|
||||
}
|
||||
|
||||
PageOrientation GetOrientation() const override {
|
||||
return plugin_->engine_->GetCurrentOrientation();
|
||||
}
|
||||
|
||||
gfx::Rect GetPageContentsRect(int index) override {
|
||||
if (index < 0 || index >= plugin_->engine_->GetNumberOfPages()) {
|
||||
gfx::Rect GetPageContentsRect(int page_index) override {
|
||||
if (page_index < 0 || page_index >= plugin_->engine_->GetNumberOfPages()) {
|
||||
return gfx::Rect();
|
||||
}
|
||||
|
||||
return plugin_->engine_->GetPageContentsRect(index);
|
||||
return plugin_->engine_->GetPageContentsRect(page_index);
|
||||
}
|
||||
|
||||
gfx::Vector2dF GetViewportOriginOffset() override {
|
||||
@ -362,10 +365,6 @@ class PdfViewWebPlugin::PdfInkModuleClientImpl : public PdfInkModuleClient {
|
||||
plugin_->engine_->UpdateStrokeActive(page_index, id, active);
|
||||
}
|
||||
|
||||
void DiscardStroke(int page_index, InkStrokeId id) override {
|
||||
plugin_->engine_->DiscardStroke(page_index, id);
|
||||
}
|
||||
|
||||
void UpdateThumbnail(int page_index) override {
|
||||
plugin_->GenerateAndSendInkThumbnail(
|
||||
page_index,
|
||||
|
@ -2659,8 +2659,8 @@ int PDFiumEngine::GetMostVisiblePage() {
|
||||
return most_visible_page_;
|
||||
}
|
||||
|
||||
gfx::Rect PDFiumEngine::GetPageContentsRect(int index) {
|
||||
return GetScreenRect(pages_[index]->rect());
|
||||
gfx::Rect PDFiumEngine::GetPageContentsRect(int page_index) {
|
||||
return GetScreenRect(pages_[page_index]->rect());
|
||||
}
|
||||
|
||||
void PDFiumEngine::SetGrayscale(bool grayscale) {
|
||||
|
@ -311,7 +311,7 @@ class PDFiumEngine : public DocumentLoader::Client, public IFSDK_PAUSE {
|
||||
PageOrientation GetCurrentOrientation() const;
|
||||
|
||||
// Gets the rectangle of the page excluding any additional areas.
|
||||
virtual gfx::Rect GetPageContentsRect(int index);
|
||||
virtual gfx::Rect GetPageContentsRect(int page_index);
|
||||
|
||||
// Returns a page's rect in screen coordinates, as well as its surrounding
|
||||
// border areas and bottom separator.
|
||||
|
Reference in New Issue
Block a user