Simplify the PDF edit mode transition.
Remove the boolean parameter from PDFiumEngine::SetEditMode() and OutOfProcessInstance::IsEditModeChanged(), as the state of the PDF can only transition from unedited to edited. Rename both methods to EnteredEditMode(). Change-Id: Iab87048d96f7b0c0b308653bc19af6dd0e1276f9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2231096 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Rebekah Potter <rbpotter@chromium.org> Cr-Commit-Position: refs/heads/master@{#777569}
This commit is contained in:
@ -1942,8 +1942,8 @@ void OutOfProcessInstance::IsSelectingChanged(bool is_selecting) {
|
||||
PostMessage(message);
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::IsEditModeChanged(bool is_edit_mode) {
|
||||
edit_mode_ = is_edit_mode;
|
||||
void OutOfProcessInstance::EnteredEditMode() {
|
||||
edit_mode_ = true;
|
||||
pp::PDF::SetPluginCanSave(this, CanSaveEdits());
|
||||
if (CanSaveEdits()) {
|
||||
pp::VarDictionary message;
|
||||
|
@ -144,7 +144,7 @@ class OutOfProcessInstance : public pp::Instance,
|
||||
uint32_t GetBackgroundColor() override;
|
||||
void IsSelectingChanged(bool is_selecting) override;
|
||||
void SelectionChanged(const pp::Rect& left, const pp::Rect& right) override;
|
||||
void IsEditModeChanged(bool is_edit_mode) override;
|
||||
void EnteredEditMode() override;
|
||||
float GetToolbarHeightInScreenCoords() override;
|
||||
void DocumentFocusChanged(bool document_has_focus) override;
|
||||
|
||||
|
@ -261,8 +261,8 @@ class PDFEngine {
|
||||
virtual void SelectionChanged(const pp::Rect& left, const pp::Rect& right) {
|
||||
}
|
||||
|
||||
// Sets edit mode state.
|
||||
virtual void IsEditModeChanged(bool is_edit_mode) {}
|
||||
// Notifies the client that the PDF has been edited.
|
||||
virtual void EnteredEditMode() {}
|
||||
|
||||
// Gets the height of the top toolbar in screen coordinates. This is
|
||||
// independent of whether it is hidden or not at the moment.
|
||||
|
@ -3591,12 +3591,12 @@ void PDFiumEngine::SetSelecting(bool selecting) {
|
||||
client_->IsSelectingChanged(selecting);
|
||||
}
|
||||
|
||||
void PDFiumEngine::SetEditMode(bool edit_mode) {
|
||||
if (edit_mode_ == edit_mode)
|
||||
void PDFiumEngine::EnteredEditMode() {
|
||||
if (edit_mode_)
|
||||
return;
|
||||
|
||||
edit_mode_ = edit_mode;
|
||||
client_->IsEditModeChanged(edit_mode_);
|
||||
edit_mode_ = true;
|
||||
client_->EnteredEditMode();
|
||||
}
|
||||
|
||||
void PDFiumEngine::SetInFormTextArea(bool in_form_text_area) {
|
||||
|
@ -567,7 +567,7 @@ class PDFiumEngine : public PDFEngine,
|
||||
const pp::Point& global_point);
|
||||
|
||||
// Set if the document has any local edits.
|
||||
void SetEditMode(bool edit_mode);
|
||||
void EnteredEditMode();
|
||||
|
||||
// Navigates to a link destination depending on the type of destination.
|
||||
// Returns false if |area| is not a link.
|
||||
|
@ -194,7 +194,7 @@ FPDF_SYSTEMTIME PDFiumFormFiller::Form_GetLocalTime(FPDF_FORMFILLINFO* param) {
|
||||
// static
|
||||
void PDFiumFormFiller::Form_OnChange(FPDF_FORMFILLINFO* param) {
|
||||
PDFiumEngine* engine = GetEngine(param);
|
||||
engine->SetEditMode(true);
|
||||
engine->EnteredEditMode();
|
||||
}
|
||||
|
||||
// static
|
||||
|
Reference in New Issue
Block a user