OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 3898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3909 page()->frameHost().visualViewport().mainFrameDidChangeSize(); | 3909 page()->frameHost().visualViewport().mainFrameDidChangeSize(); |
3910 | 3910 |
3911 // Make sure link highlight from previous page is cleared. | 3911 // Make sure link highlight from previous page is cleared. |
3912 m_linkHighlights.clear(); | 3912 m_linkHighlights.clear(); |
3913 endActiveFlingAnimation(); | 3913 endActiveFlingAnimation(); |
3914 m_userGestureObserved = false; | 3914 m_userGestureObserved = false; |
3915 } | 3915 } |
3916 | 3916 |
3917 void WebViewImpl::willInsertBody(WebLocalFrameImpl* webframe) | 3917 void WebViewImpl::willInsertBody(WebLocalFrameImpl* webframe) |
3918 { | 3918 { |
3919 resumeTreeViewCommitsIfNeeded(webframe); | 3919 if (webframe != mainFrameImpl()) |
| 3920 return; |
| 3921 |
| 3922 if (!m_page->mainFrame()->isLocalFrame()) |
| 3923 return; |
| 3924 |
| 3925 // If we get to the <body> tag and we have no pending stylesheet and import
load, we |
| 3926 // can be fairly confident we'll have something sensible to paint soon and |
| 3927 // can turn off deferred commits. |
| 3928 if (m_page->deprecatedLocalMainFrame()->document()->isRenderingReady()) |
| 3929 resumeTreeViewCommits(); |
3920 } | 3930 } |
3921 | 3931 |
3922 void WebViewImpl::didFinishDocumentLoad(WebLocalFrameImpl* webframe) | 3932 void WebViewImpl::didFinishDocumentLoad(WebLocalFrameImpl* webframe) |
3923 { | 3933 { |
3924 resumeTreeViewCommitsIfNeeded(webframe); | 3934 if (webframe != mainFrameImpl()) |
| 3935 return; |
| 3936 // If we finished parsing and there's no sheets to load start painting. |
| 3937 if (webframe->frame()->document()->isRenderingReady()) |
| 3938 resumeTreeViewCommits(); |
3925 } | 3939 } |
3926 | 3940 |
3927 void WebViewImpl::didRemoveAllPendingStylesheet(WebLocalFrameImpl* webframe) | 3941 void WebViewImpl::didRemoveAllPendingStylesheet(WebLocalFrameImpl* webframe) |
3928 { | 3942 { |
3929 resumeTreeViewCommitsIfNeeded(webframe); | 3943 if (webframe != mainFrameImpl()) |
| 3944 return; |
| 3945 |
| 3946 // If we have no more stylesheets to load and we're past the body tag, |
| 3947 // we should have something to paint and should start as soon as possible. |
| 3948 if (m_page->deprecatedLocalMainFrame()->document()->body()) |
| 3949 resumeTreeViewCommits(); |
3930 } | 3950 } |
3931 | 3951 |
3932 void WebViewImpl::resumeTreeViewCommitsIfNeeded(WebLocalFrameImpl* webframe) | 3952 void WebViewImpl::resumeTreeViewCommits() |
3933 { | 3953 { |
3934 if (webframe != mainFrameImpl()) | 3954 if (m_layerTreeView) |
3935 return; | 3955 m_layerTreeView->setDeferCommits(false); |
3936 if (!webframe->frame()->document()->shouldProcessFrameLifecycle()) | |
3937 return; | |
3938 if (!m_layerTreeView) | |
3939 return; | |
3940 m_layerTreeView->setDeferCommits(false); | |
3941 } | 3956 } |
3942 | 3957 |
3943 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) | 3958 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) |
3944 { | 3959 { |
3945 FrameView* view = webframe->frame()->view(); | 3960 FrameView* view = webframe->frame()->view(); |
3946 if (webframe == mainFrame()) | 3961 if (webframe == mainFrame()) |
3947 view->resize(mainFrameSize()); | 3962 view->resize(mainFrameSize()); |
3948 else | 3963 else |
3949 view->resize(webframe->frameView()->size()); | 3964 view->resize(webframe->frameView()->size()); |
3950 } | 3965 } |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4455 if (m_pageColorOverlay) | 4470 if (m_pageColorOverlay) |
4456 m_pageColorOverlay->update(); | 4471 m_pageColorOverlay->update(); |
4457 if (m_inspectorOverlay) { | 4472 if (m_inspectorOverlay) { |
4458 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay(); | 4473 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay(); |
4459 if (inspectorPageOverlay) | 4474 if (inspectorPageOverlay) |
4460 inspectorPageOverlay->update(); | 4475 inspectorPageOverlay->update(); |
4461 } | 4476 } |
4462 } | 4477 } |
4463 | 4478 |
4464 } // namespace blink | 4479 } // namespace blink |
OLD | NEW |