mirror of
https://pdfium.googlesource.com/pdfium
synced 2026-08-02 05:04:39 +08:00
Previously for some embedders (Chrome Linux) that send both OnChar and OnKeyDown for delete, PDFium was double handling the delete key. The OnChar handling was unexpected and was inserting 0x7F as a character in the text field, which caused weird behavior like inserting a * in password fields but not actually having any text if the user performs select all then copies it. This double handling also inserted two items in the undo queue so when the user presses delete, they would have to press undo twice. In JavaScript code the browser only sends a "keydown" event for the delete key so OnKeyDown seemed like the proper place to handle it in PDFium to match the JavaScript event model. There is a testing/resources/pixel/password.in file which I could have generated a pdf for and set up a test fixture for. However I'm not really sure how I would test the phantom * characters issue. The test making sure PDFium doesn't handle OnChar delete should be enough to cover that issue. Fixed: 454273254 Change-Id: Ibccc44b2f6792428eaf7e02439990cb5f55110c6 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/137190 Auto-Submit: April Kallmeyer <ask@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
32 lines
818 B
C++
32 lines
818 B
C++
// Copyright 2021 The PDFium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef CONSTANTS_ASCII_H_
|
|
#define CONSTANTS_ASCII_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
namespace pdfium {
|
|
namespace ascii {
|
|
|
|
constexpr uint8_t kNul = 0x00;
|
|
constexpr uint8_t kControlA = 0x01;
|
|
constexpr uint8_t kControlB = 0x02;
|
|
constexpr uint8_t kControlC = 0x03;
|
|
constexpr uint8_t kBackspace = 0x08;
|
|
constexpr uint8_t kTab = 0x09;
|
|
constexpr uint8_t kNewline = 0x0a;
|
|
constexpr uint8_t kReturn = 0x0d;
|
|
constexpr uint8_t kControlV = 0x16;
|
|
constexpr uint8_t kControlX = 0x18;
|
|
constexpr uint8_t kControlZ = 0x1a;
|
|
constexpr uint8_t kEscape = 0x1b;
|
|
constexpr uint8_t kSpace = 0x20;
|
|
constexpr uint8_t kDelete = 0x7F;
|
|
|
|
} // namespace ascii
|
|
} // namespace pdfium
|
|
|
|
#endif // CONSTANTS_ASCII_H_
|