diff options
author | Aaron Leventhal <aleventhal@google.com> | 2020-03-23 14:27:08 +0000 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2020-04-24 14:32:36 +0000 |
commit | f3fbe32fb256da3d0a8f92e61ebdca639d417e23 (patch) | |
tree | bcaceb24b48ca3d3867673ff2cc4252d29b0a5e0 | |
parent | 6d98471a3e1e1802d89fc1e0fbddb0d5305ecd65 (diff) | |
download | qtwebengine-chromium-f3fbe32fb256da3d0a8f92e61ebdca639d417e23.tar.gz |
[Backport] Security bug 1025740 1/2
Do not cause lifecycle change during AX serialization
Calling Document::UpdateStyleAndLayoutTree() can cause keyframe
animations to update, and send the document life cycle to an earlier,
unsafe stage. There is no need to call this before getting the computed
style, as layout is already clean.
Bug: 1025740
Change-Id: I422d5b78721085b0dcf72e3d710e037bcd153506
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
3 files changed, 4 insertions, 23 deletions
diff --git a/chromium/content/renderer/accessibility/blink_ax_tree_source.cc b/chromium/content/renderer/accessibility/blink_ax_tree_source.cc index 7b1b8aa77e9..ed974c80302 100644 --- a/chromium/content/renderer/accessibility/blink_ax_tree_source.cc +++ b/chromium/content/renderer/accessibility/blink_ax_tree_source.cc @@ -818,9 +818,10 @@ void BlinkAXTreeSource::SerializeNode(WebAXObject src, dst->SetDefaultActionVerb(src.Action()); } - if (src.HasComputedStyle()) { + blink::WebString display_style = src.ComputedStyleDisplay(); + if (!display_style.IsEmpty()) { TruncateAndAddStringAttribute(dst, ax::mojom::StringAttribute::kDisplay, - src.ComputedStyleDisplay().Utf8()); + display_style.Utf8()); } if (src.Language().length()) { diff --git a/chromium/third_party/blink/public/web/web_ax_object.h b/chromium/third_party/blink/public/web/web_ax_object.h index 9b318787af7..7baf1db9fe0 100644 --- a/chromium/third_party/blink/public/web/web_ax_object.h +++ b/chromium/third_party/blink/public/web/web_ax_object.h @@ -268,7 +268,6 @@ class WebAXObject { BLINK_EXPORT WebNode GetNode() const; BLINK_EXPORT WebDocument GetDocument() const; - BLINK_EXPORT bool HasComputedStyle() const; BLINK_EXPORT WebString ComputedStyleDisplay() const; BLINK_EXPORT bool AccessibilityIsIgnored() const; BLINK_EXPORT bool AccessibilityIsIncludedInTree() const; diff --git a/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc b/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc index 8e4a75ab03b..ea9d1160d9a 100644 --- a/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc +++ b/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc @@ -1206,28 +1206,11 @@ WebDocument WebAXObject::GetDocument() const { return WebDocument(document); } -bool WebAXObject::HasComputedStyle() const { - if (IsDetached()) - return false; - - Document* document = private_->GetDocument(); - if (document) - document->UpdateStyleAndLayoutTree(); - - Node* node = private_->GetNode(); - if (!node || node->IsDocumentNode()) - return false; - - return node->GetComputedStyle(); -} - WebString WebAXObject::ComputedStyleDisplay() const { if (IsDetached()) return WebString(); - Document* document = private_->GetDocument(); - if (document) - document->UpdateStyleAndLayoutTree(); + DCHECK(IsLayoutClean(private_->GetDocument())); Node* node = private_->GetNode(); if (!node || node->IsDocumentNode()) @@ -1571,9 +1554,7 @@ void WebAXObject::GetRelativeBounds(WebAXObject& offset_container, if (IsDetached()) return; -#if DCHECK_IS_ON() DCHECK(IsLayoutClean(private_->GetDocument())); -#endif AXObject* container = nullptr; FloatRect bounds; |