diff options
author | levin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 07:49:37 +0000 |
---|---|---|
committer | levin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 07:49:37 +0000 |
commit | 1e0c8e079bbd88d841e6d2459f96f78faee64035 (patch) | |
tree | 846ed7bdc9efa8fc692f83740500621042fd2103 | |
parent | aa63fd306939e4edef29c8f490a4a23386cba034 (diff) | |
download | chromium_src-1e0c8e079bbd88d841e6d2459f96f78faee64035.zip chromium_src-1e0c8e079bbd88d841e6d2459f96f78faee64035.tar.gz chromium_src-1e0c8e079bbd88d841e6d2459f96f78faee64035.tar.bz2 |
Add mayHaveChangedRenderedSize callback.
BUG=44850
TEST=None as it isn't yet called anywhere.
Review URL: http://codereview.chromium.org/7065029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86581 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/renderer/render_view.cc | 10 | ||||
-rw-r--r-- | content/renderer/render_view.h | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index a7c5f8f1..d3d6505 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -2718,6 +2718,16 @@ void RenderView::didChangeContentsSize(WebFrame* frame, const WebSize& size) { CheckPreferredSize(); } +void RenderView::mayHaveChangedRenderedSize(WebFrame* frame) { + if (!send_preferred_size_changes_ || !webview()) + return; + // If we hit this code path, then stop the deprecated timer. + check_preferred_size_timer_.Stop(); + preferred_size_change_timer_.Stop(); + preferred_size_change_timer_.Start(TimeDelta::FromMilliseconds(10), this, + &RenderView::CheckPreferredSize); +} + void RenderView::CheckPreferredSize() { // We don't always want to send the change messages over IPC, only if we've // be put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h index ac79586..05de5c8 100644 --- a/content/renderer/render_view.h +++ b/content/renderer/render_view.h @@ -544,6 +544,7 @@ class RenderView : public RenderWidget, unsigned long long event_id); virtual void didChangeContentsSize(WebKit::WebFrame* frame, const WebKit::WebSize& size); + virtual void mayHaveChangedRenderedSize(WebKit::WebFrame* frame); virtual void didChangeScrollOffset(WebKit::WebFrame* frame); virtual void reportFindInPageMatchCount(int request_id, int count, @@ -1030,6 +1031,10 @@ class RenderView : public RenderWidget, // https://bugs.webkit.org/show_bug.cgi?id=32807. base::RepeatingTimer<RenderView> preferred_size_change_timer_; + // Used to delay determining the preferred size (to avoid intermediate + // states for the sizes). + base::OneShotTimer<RenderView> check_preferred_size_timer_; + #if defined(OS_MACOSX) // Track the fake plugin window handles allocated on the browser side for // the accelerated compositor and (currently) accelerated plugins so that |