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 3968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3979 | 3979 |
3980 // Give the visual viewport's scroll layer its initial size. | 3980 // Give the visual viewport's scroll layer its initial size. |
3981 page()->frameHost().visualViewport().mainFrameDidChangeSize(); | 3981 page()->frameHost().visualViewport().mainFrameDidChangeSize(); |
3982 | 3982 |
3983 // Make sure link highlight from previous page is cleared. | 3983 // Make sure link highlight from previous page is cleared. |
3984 m_linkHighlights.clear(); | 3984 m_linkHighlights.clear(); |
3985 endActiveFlingAnimation(); | 3985 endActiveFlingAnimation(); |
3986 m_userGestureObserved = false; | 3986 m_userGestureObserved = false; |
3987 } | 3987 } |
3988 | 3988 |
3989 void WebViewImpl::mainFrameDocumentElementAvailable() | |
3990 { | |
3991 // This check is necessary to avoid provisional frames | |
3992 // (see WebLocalFrame::createProvisional) leaking | |
3993 // their calls into WebViewImpl. | |
3994 // See http://crbug.com/578349 for details. | |
3995 // TODO(dcheng): Remove this when the provisional frames | |
3996 // bite the dust. | |
3997 if (!mainFrameImpl()) | |
3998 return; | |
3999 | |
4000 // For non-HTML documents the willInsertBody notification won't happen | |
4001 // so we resume as soon as we have a document element. Even for XHTML | |
4002 // documents there may never be a <body> (since the parser won't always | |
4003 // insert one), so we resume here too. That does mean XHTML documents make | |
4004 // frames when there's only a <head>, but such documents are pretty rare. | |
4005 if (!mainFrameImpl()->frame()->document()->isHTMLDocument()) | |
4006 resumeTreeViewCommitsIfRenderingReady(); | |
4007 } | |
4008 | |
4009 void WebViewImpl::willInsertMainFrameDocumentBody() | |
4010 { | |
4011 // This check is necessary to avoid provisional frames | |
4012 // (see WebLocalFrame::createProvisional) leaking | |
4013 // their calls into WebViewImpl. | |
4014 // See http://crbug.com/578349 for details. | |
4015 // TODO(dcheng): Remove this when the provisional frames | |
4016 // bite the dust. | |
4017 if (!mainFrameImpl()) | |
4018 return; | |
4019 | |
4020 // If we get to the <body> try to resume commits since we should have conten
t | |
4021 // to paint now. | |
4022 // TODO(esprehn): Is this really optimal? We might start producing frames | |
4023 // for very little content, should we wait for some heuristic like | |
4024 // isVisuallyNonEmpty() ? | |
4025 resumeTreeViewCommitsIfRenderingReady(); | |
4026 } | |
4027 | |
4028 void WebViewImpl::didFinishMainFrameDocumentLoad() | |
4029 { | |
4030 resumeTreeViewCommitsIfRenderingReady(); | |
4031 } | |
4032 | |
4033 void WebViewImpl::didRemoveAllPendingStylesheetsInMainFrameDocument() | |
4034 { | |
4035 Document& document = *mainFrameImpl()->frame()->document(); | |
4036 | |
4037 // For HTML if we have no more stylesheets to load and we're past the body | |
4038 // tag, we should have something to paint so resume. | |
4039 if (document.isHTMLDocument() && !document.body()) | |
4040 return; | |
4041 | |
4042 // For non-HTML there is no body so resume as soon as the sheets are loaded. | |
4043 if (!document.isHTMLDocument() && !document.documentElement()) | |
4044 return; | |
4045 | |
4046 resumeTreeViewCommitsIfRenderingReady(); | |
4047 } | |
4048 | |
4049 void WebViewImpl::resumeTreeViewCommitsIfRenderingReady() | |
4050 { | |
4051 LocalFrame* frame = mainFrameImpl()->frame(); | |
4052 if (!frame->loader().stateMachine()->committedFirstRealDocumentLoad()) | |
4053 return; | |
4054 if (!frame->document()->isRenderingReady()) | |
4055 return; | |
4056 if (m_layerTreeView) { | |
4057 m_layerTreeView->setDeferCommits(false); | |
4058 m_layerTreeView->setNeedsBeginFrame(); | |
4059 } | |
4060 } | |
4061 | |
4062 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) | 3989 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) |
4063 { | 3990 { |
4064 FrameView* view = webframe->frame()->view(); | 3991 FrameView* view = webframe->frame()->view(); |
4065 if (webframe == mainFrame()) | 3992 if (webframe == mainFrame()) |
4066 view->resize(mainFrameSize()); | 3993 view->resize(mainFrameSize()); |
4067 else | 3994 else |
4068 view->resize(webframe->frameView()->size()); | 3995 view->resize(webframe->frameView()->size()); |
4069 } | 3996 } |
4070 | 3997 |
4071 void WebViewImpl::layoutUpdated(WebLocalFrameImpl* webframe) | 3998 void WebViewImpl::layoutUpdated(WebLocalFrameImpl* webframe) |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4570 { | 4497 { |
4571 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4498 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
4572 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4499 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
4573 if (!page()) | 4500 if (!page()) |
4574 return 1; | 4501 return 1; |
4575 | 4502 |
4576 return page()->deviceScaleFactor(); | 4503 return page()->deviceScaleFactor(); |
4577 } | 4504 } |
4578 | 4505 |
4579 } // namespace blink | 4506 } // namespace blink |
OLD | NEW |