Commit f1bc7958 authored by schenney's avatar schenney Committed by Commit bot

Set needsLayout on WebViewPlugin's container when initialized

A race condition is suspected in which the first setNeedsLayout call happens between a layout and a paint for a webview plugin. This change ensures that setNeedsLayout... is called on the plugin's container at initialization, which occurs during the correct document lifecycle position.

TBR=bauerb@chromium.org,tommycli@chromium.org
BUG=493375

Review URL: https://codereview.chromium.org/1244113003

Cr-Commit-Position: refs/heads/master@{#339763}
parent 513ce3cd
......@@ -112,6 +112,15 @@ WebPluginContainer* WebViewPlugin::container() const { return container_; }
bool WebViewPlugin::initialize(WebPluginContainer* container) {
container_ = container;
if (container_) {
// We must call layout again here to ensure that the container is laid
// out before we next try to paint it, which is a requirement of the
// document life cycle in Blink. In most cases, needsLayout is set by
// scheduleAnimation, but due to timers controlling widget update,
// scheduleAnimation may be invoked before this initialize call (which
// comes through the widget update process). It doesn't hurt to mark
// for layout again, and it does help us in the race-condition situation.
container_->setNeedsLayout();
old_title_ = container_->element().getAttribute("title");
// Propagate device scale to inner webview to load the correct resource
......
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