browser(webkit): layout before returning DOM.getContentQuads (#970)

Otherwise we can get stale quads. Causes failures of "ElementHandle.boundingBox should work with page scale" test.

6835789cf2
This commit is contained in:
Joel Einbinder 2020-02-12 18:43:56 -08:00 committed by GitHub
parent b188f397cf
commit b7f48f4603
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View file

@ -1 +1 @@
1148 1149

View file

@ -2062,7 +2062,7 @@ index b67e89b80b4e7a8586cac81ade5d58a1bcb0d431..c468bc0981d1fb13272b28095f9f7584
{ {
FAST_RETURN_IF_NO_FRONTENDS(false); FAST_RETURN_IF_NO_FRONTENDS(false);
diff --git a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp diff --git a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
index 0f46a3033aef4007f6eb837a6105f05a0c59067f..bfcafe332af75e0def0d9487eceef7c9384dc3d1 100644 index 0f46a3033aef4007f6eb837a6105f05a0c59067f..38140e53555b86af72b3c9707d4c6bd48350a1e7 100644
--- a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp --- a/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
+++ b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp +++ b/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
@@ -61,12 +61,16 @@ @@ -61,12 +61,16 @@
@ -2155,7 +2155,7 @@ index 0f46a3033aef4007f6eb837a6105f05a0c59067f..bfcafe332af75e0def0d9487eceef7c9
if (!node) if (!node)
return; return;
@@ -1486,18 +1499,143 @@ void InspectorDOMAgent::setInspectedNode(ErrorString& errorString, int nodeId) @@ -1486,18 +1499,147 @@ void InspectorDOMAgent::setInspectedNode(ErrorString& errorString, int nodeId)
m_suppressEventListenerChangedEvent = false; m_suppressEventListenerChangedEvent = false;
} }
@ -2275,6 +2275,10 @@ index 0f46a3033aef4007f6eb837a6105f05a0c59067f..bfcafe332af75e0def0d9487eceef7c9
+ errorString = "Node doesn't have renderer"_s; + errorString = "Node doesn't have renderer"_s;
+ return; + return;
+ } + }
+
+ // Ensure quads are up to date.
+ renderer->document().updateLayoutIgnorePendingStylesheets();
+
+ Frame* containingFrame = renderer->document().frame(); + Frame* containingFrame = renderer->document().frame();
+ FrameView* containingView = containingFrame ? containingFrame->view() : nullptr; + FrameView* containingView = containingFrame ? containingFrame->view() : nullptr;
+ if (!containingView) { + if (!containingView) {
@ -2305,7 +2309,7 @@ index 0f46a3033aef4007f6eb837a6105f05a0c59067f..bfcafe332af75e0def0d9487eceef7c9
} }
void InspectorDOMAgent::getAttributes(ErrorString& errorString, int nodeId, RefPtr<JSON::ArrayOf<String>>& result) void InspectorDOMAgent::getAttributes(ErrorString& errorString, int nodeId, RefPtr<JSON::ArrayOf<String>>& result)
@@ -2662,7 +2800,7 @@ void InspectorDOMAgent::pushNodeByPathToFrontend(ErrorString& errorString, const @@ -2662,7 +2804,7 @@ void InspectorDOMAgent::pushNodeByPathToFrontend(ErrorString& errorString, const
errorString = "Missing node for given path"_s; errorString = "Missing node for given path"_s;
} }
@ -2314,7 +2318,7 @@ index 0f46a3033aef4007f6eb837a6105f05a0c59067f..bfcafe332af75e0def0d9487eceef7c9
{ {
Document* document = &node->document(); Document* document = &node->document();
if (auto* templateHost = document->templateDocumentHost()) if (auto* templateHost = document->templateDocumentHost())
@@ -2671,12 +2809,16 @@ RefPtr<Inspector::Protocol::Runtime::RemoteObject> InspectorDOMAgent::resolveNod @@ -2671,12 +2813,16 @@ RefPtr<Inspector::Protocol::Runtime::RemoteObject> InspectorDOMAgent::resolveNod
if (!frame) if (!frame)
return nullptr; return nullptr;
@ -2334,7 +2338,7 @@ index 0f46a3033aef4007f6eb837a6105f05a0c59067f..bfcafe332af75e0def0d9487eceef7c9
} }
Node* InspectorDOMAgent::scriptValueAsNode(JSC::JSValue value) Node* InspectorDOMAgent::scriptValueAsNode(JSC::JSValue value)
@@ -2697,4 +2839,46 @@ void InspectorDOMAgent::setAllowEditingUserAgentShadowTrees(ErrorString&, bool a @@ -2697,4 +2843,46 @@ void InspectorDOMAgent::setAllowEditingUserAgentShadowTrees(ErrorString&, bool a
m_allowEditingUserAgentShadowTrees = allow; m_allowEditingUserAgentShadowTrees = allow;
} }