Commit d20c5b94 authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Correct validation popup hiding code

When the validation popup is hidden, this unexpected code path occurs:
- HideValidationMessage() is called continuously, and keeps restarting
the timer used to call Reset()
- As a result, Reset() is never reached

The fix: do not restart the timer if a hide is in progress.

This fix is blocking an accessibility fix, which needs an accurate signal
when the validation message is no longer visible.

Bug: None
Change-Id: I0d69abf006a881dd7cc147dfe49ada50217b8c4a
Reviewed-on: https://chromium-review.googlesource.com/c/1417890Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625241}
parent 07503568
......@@ -99,8 +99,12 @@ void ValidationMessageClientImpl::HideValidationMessage(const Element& anchor) {
HideValidationMessageImmediately(anchor);
return;
}
if (!current_anchor_ || !IsValidationMessageVisible(anchor))
if (!current_anchor_ || !IsValidationMessageVisible(anchor) ||
overlay_delegate_->IsHiding()) {
// Do not continue if already hiding, otherwise timer will never complete
// and Reset() is never called.
return;
}
DCHECK(overlay_);
overlay_delegate_->StartToHide();
timer_ = std::make_unique<TaskRunnerTimer<ValidationMessageClientImpl>>(
......
......@@ -38,6 +38,7 @@ class ValidationMessageOverlayDelegate : public FrameOverlay::Delegate {
GraphicsContext&,
const IntSize& view_size) const override;
void StartToHide();
bool IsHiding() const;
private:
ValidationMessageOverlayDelegate(Page&,
......@@ -52,7 +53,6 @@ class ValidationMessageOverlayDelegate : public FrameOverlay::Delegate {
void WriteDocument(SharedBuffer*);
Element& GetElementById(const AtomicString&) const;
void AdjustBubblePosition(const IntSize& view_size);
bool IsHiding() const;
// An internal Page and a ChromeClient for it.
Persistent<Page> 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