Chromium HTML Input 类型password 对应c++
一、密码字段:
密码字段通过标签 <input type="password"> 来定义:
<form>
Password: <input type="password" name="pwd">
</form>
二、password 对应c++定义:
third_party\blink\renderer\core\html\forms\password_input_type.h
third_party\blink\renderer\core\html\forms\password_input_type.cc
namespace blink {
class KeyboardEvent;
class PasswordInputType final : public BaseTextInputType {
public:
explicit PasswordInputType(HTMLInputElement& element)
: BaseTextInputType(Type::kPassword, element) {}
private:
void CountUsage() override;
bool ShouldSaveAndRestoreFormControlState() const override;
FormControlState SaveFormControlState() const override;
void RestoreFormControlState(const FormControlState&) override;
bool ShouldRespectListAttribute() override;
bool NeedsContainer() const override;
void CreateShadowSubtree() override;
void UpdateView() override;
void CapsLockStateMayHaveChanged() override;
bool ShouldDrawCapsLockIndicator() const override;
void UpdatePasswordRevealButton();
void UpdateStrongPasswordLabel();
void DidSetValueByUserEdit() override;
void DidSetValue(const String&, bool value_changed) override;
void ForwardEvent(Event& event) override;
void HandleKeydownEvent(KeyboardEvent&) override;
void HandleBeforeTextInsertedEvent(BeforeTextInsertedEvent&) override;
void HandleBlurEvent() override;
bool SupportsInputModeAttribute() const override;
bool IsAutoDirectionalityFormAssociated() const override;
bool should_draw_caps_lock_indicator_ = false;
bool should_show_reveal_button_ = false;
};
template <>
struct DowncastTraits<PasswordInputType> {
static bool AllowFrom(const InputType& type) {
return type.IsPasswordInputType();
}
};
} // namespace blink
三、堆栈: