Commit 901fc23e authored by Mohsen Izadi's avatar Mohsen Izadi Committed by Chromium LUCI CQ

Revert "Reland "Wait until safe time to create web document""

This reverts commit 511c6eb0.

Reason for revert: The original CL had actually fixed the issue and should not have been relanded. Reverting again.

Original change's description:
> Reland "Wait until safe time to create web document"
>
> This reverts commit 1af362f4.
>
> Reason for revert: The rollback did not fix bots, so I am relanding
> the CL.
>
> Original change's description:
> > Revert "Wait until safe time to create web document"
> >
> > This reverts commit 593304b4.
> >
> > Reason for revert: Suspect it caused failures in content_browsertests
> > Accessibility tests.
> >
> > Original change's description:
> > > Wait until safe time to create web document
> > >
> > > TBR=kinuko@chromium.org
> > >
> > > Bug: 1156939
> > > Change-Id: I23443fc4461dc61223fef249bac109a8b7e8183e
> > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2586233
> > > Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
> > > Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
> > > Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
> > > Cr-Commit-Position: refs/heads/master@{#838244}
> >
> > TBR=dmazzoni@chromium.org,aleventhal@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: 1156939
> > Change-Id: Iac0282f6e1a24119a67dacf81c5e1c33ed303d33
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2596292
> > Reviewed-by: Tal Pressman <talp@google.com>
> > Commit-Queue: Tal Pressman <talp@google.com>
> > Cr-Commit-Position: refs/heads/master@{#838585}
>
> TBR=dmazzoni@chromium.org,aleventhal@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com,talp@google.com
>
> # Not skipping CQ checks because this is a reland.
>
> Bug: 1156939
> Change-Id: Ib7571aa00acc5c1202abdbebfb40e2180aba36e5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2598303
> Reviewed-by: Tal Pressman <talp@google.com>
> Commit-Queue: Tal Pressman <talp@google.com>
> Cr-Commit-Position: refs/heads/master@{#838596}

TBR=dmazzoni@chromium.org,aleventhal@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com,talp@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1156939
Change-Id: Idc167071dce6a0fc2ab2db915e6c5899a6426b86
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2600392Reviewed-by: default avatarMohsen Izadi <mohsen@chromium.org>
Commit-Queue: Mohsen Izadi <mohsen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#839195}
parent 7e14f273
...@@ -317,9 +317,12 @@ void RenderAccessibilityImpl::AccessibilityModeChanged(const ui::AXMode& mode) { ...@@ -317,9 +317,12 @@ void RenderAccessibilityImpl::AccessibilityModeChanged(const ui::AXMode& mode) {
// If there are any events in flight, |HandleAXEvent| will refuse to process // If there are any events in flight, |HandleAXEvent| will refuse to process
// our new event. // our new event.
needs_initial_ax_tree_root_ = true; pending_events_.clear();
event_schedule_mode_ = EventScheduleMode::kProcessEventsImmediately; auto root_object = WebAXObject::FromWebDocument(document, false);
ScheduleSendPendingAccessibilityEvents(); ax::mojom::Event event = root_object.IsLoaded()
? ax::mojom::Event::kLoadComplete
: ax::mojom::Event::kLayoutComplete;
HandleAXEvent(ui::AXEvent(root_object.AxID(), event));
} }
} }
...@@ -523,11 +526,11 @@ void RenderAccessibilityImpl::Reset(int32_t reset_token) { ...@@ -523,11 +526,11 @@ void RenderAccessibilityImpl::Reset(int32_t reset_token) {
if (!document.IsNull()) { if (!document.IsNull()) {
// Tree-only mode gets used by the automation extension API which requires a // Tree-only mode gets used by the automation extension API which requires a
// load complete event to invoke listener callbacks. // load complete event to invoke listener callbacks.
// SendPendingAccessibilityEvents() will fire the load complete event auto root_object = WebAXObject::FromWebDocument(document, false);
// if the page is loaded. ax::mojom::Event event = root_object.IsLoaded()
needs_initial_ax_tree_root_ = true; ? ax::mojom::Event::kLoadComplete
event_schedule_mode_ = EventScheduleMode::kProcessEventsImmediately; : ax::mojom::Event::kLayoutComplete;
ScheduleSendPendingAccessibilityEvents(); HandleAXEvent(ui::AXEvent(root_object.AxID(), event));
} }
} }
...@@ -844,18 +847,10 @@ void RenderAccessibilityImpl::SendPendingAccessibilityEvents() { ...@@ -844,18 +847,10 @@ void RenderAccessibilityImpl::SendPendingAccessibilityEvents() {
// complete for the entire document, in order to initialize the browser's // complete for the entire document, in order to initialize the browser's
// cached accessibility tree. // cached accessibility tree.
needs_initial_ax_tree_root_ = false; needs_initial_ax_tree_root_ = false;
auto root_obj = WebAXObject::FromWebDocument(document); auto obj = WebAXObject::FromWebDocument(document);
// Always fire layout complete for a new root object.
pending_events_.insert( pending_events_.insert(
pending_events_.begin(), pending_events_.begin(),
ui::AXEvent(root_obj.AxID(), ax::mojom::Event::kLayoutComplete)); ui::AXEvent(obj.AxID(), ax::mojom::Event::kLayoutComplete));
// If loaded, insert load complete at the top.
if (root_obj.IsLoaded()) {
pending_events_.insert(
pending_events_.begin(),
ui::AXEvent(root_obj.AxID(), ax::mojom::Event::kLoadComplete));
}
} }
if (pending_events_.empty() && dirty_objects_.empty()) { if (pending_events_.empty() && dirty_objects_.empty()) {
...@@ -889,8 +884,8 @@ void RenderAccessibilityImpl::SendPendingAccessibilityEvents() { ...@@ -889,8 +884,8 @@ void RenderAccessibilityImpl::SendPendingAccessibilityEvents() {
// location changes. // location changes.
bool need_to_send_location_changes = false; bool need_to_send_location_changes = false;
// Keep track of load complete messages. When a load completes, it's a good // If there's a load complete message, we need to change the event schedule
// time to inject a stylesheet for image annotation debugging. // mode.
bool had_load_complete_messages = false; bool had_load_complete_messages = false;
ScopedFreezeBlinkAXTreeSource freeze(tree_source_.get()); ScopedFreezeBlinkAXTreeSource freeze(tree_source_.get());
......
...@@ -81,7 +81,9 @@ class WebAXObject { ...@@ -81,7 +81,9 @@ class WebAXObject {
BLINK_EXPORT bool operator>(const WebAXObject& other) const; BLINK_EXPORT bool operator>(const WebAXObject& other) const;
BLINK_EXPORT bool operator>=(const WebAXObject& other) const; BLINK_EXPORT bool operator>=(const WebAXObject& other) const;
BLINK_EXPORT static WebAXObject FromWebNode(const WebNode&); BLINK_EXPORT static WebAXObject FromWebNode(const WebNode&);
BLINK_EXPORT static WebAXObject FromWebDocument(const WebDocument&); BLINK_EXPORT static WebAXObject FromWebDocument(
const WebDocument&,
bool update_layout_if_necessary = true);
BLINK_EXPORT static WebAXObject FromWebDocumentByID(const WebDocument&, int); BLINK_EXPORT static WebAXObject FromWebDocumentByID(const WebDocument&, int);
BLINK_EXPORT static WebAXObject FromWebDocumentFocused( BLINK_EXPORT static WebAXObject FromWebDocumentFocused(
const WebDocument&, const WebDocument&,
......
...@@ -1464,9 +1464,12 @@ WebAXObject WebAXObject::FromWebNode(const WebNode& web_node) { ...@@ -1464,9 +1464,12 @@ WebAXObject WebAXObject::FromWebNode(const WebNode& web_node) {
} }
// static // static
WebAXObject WebAXObject::FromWebDocument(const WebDocument& web_document) { WebAXObject WebAXObject::FromWebDocument(const WebDocument& web_document,
if (!MaybeUpdateLayoutAndCheckValidity(web_document)) bool update_layout_if_necessary) {
if (update_layout_if_necessary &&
!MaybeUpdateLayoutAndCheckValidity(web_document)) {
return WebAXObject(); return WebAXObject();
}
const Document* document = web_document.ConstUnwrap<Document>(); const Document* document = web_document.ConstUnwrap<Document>();
auto* cache = To<AXObjectCacheImpl>(document->ExistingAXObjectCache()); auto* cache = To<AXObjectCacheImpl>(document->ExistingAXObjectCache());
return cache ? WebAXObject(cache->GetOrCreate(document->GetLayoutView())) return cache ? WebAXObject(cache->GetOrCreate(document->GetLayoutView()))
......
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