Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2762553002: Add canUpdateLayout & canHandleGestureEvent to WebViewClient. (Closed)
Patch Set: Fix merge issues. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 syntheticGestureEvent.data.scrollUpdate.inertialPhase = 688 syntheticGestureEvent.data.scrollUpdate.inertialPhase =
689 WebGestureEvent::MomentumPhase; 689 WebGestureEvent::MomentumPhase;
690 690
691 return handleGestureEvent(syntheticGestureEvent) != 691 return handleGestureEvent(syntheticGestureEvent) !=
692 WebInputEventResult::NotHandled; 692 WebInputEventResult::NotHandled;
693 } 693 }
694 } 694 }
695 695
696 WebInputEventResult WebViewImpl::handleGestureEvent( 696 WebInputEventResult WebViewImpl::handleGestureEvent(
697 const WebGestureEvent& event) { 697 const WebGestureEvent& event) {
698 if (!m_client) 698 if (!m_client || !m_client->canHandleGestureEvent()) {
699 return WebInputEventResult::NotHandled; 699 return WebInputEventResult::NotHandled;
700 }
700 701
701 WebInputEventResult eventResult = WebInputEventResult::NotHandled; 702 WebInputEventResult eventResult = WebInputEventResult::NotHandled;
702 bool eventCancelled = false; // for disambiguation 703 bool eventCancelled = false; // for disambiguation
703 704
704 // Special handling for slow-path fling gestures. 705 // Special handling for slow-path fling gestures.
705 switch (event.type()) { 706 switch (event.type()) {
706 case WebInputEvent::GestureFlingStart: { 707 case WebInputEvent::GestureFlingStart: {
707 if (mainFrameImpl() 708 if (mainFrameImpl()
708 ->frame() 709 ->frame()
709 ->eventHandler() 710 ->eventHandler()
(...skipping 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after
3640 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) { 3641 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) {
3641 FrameView* view = webframe->frame()->view(); 3642 FrameView* view = webframe->frame()->view();
3642 if (webframe == mainFrame()) 3643 if (webframe == mainFrame())
3643 m_resizeViewportAnchor->resizeFrameView(mainFrameSize()); 3644 m_resizeViewportAnchor->resizeFrameView(mainFrameSize());
3644 else 3645 else
3645 view->resize(webframe->frameView()->size()); 3646 view->resize(webframe->frameView()->size());
3646 } 3647 }
3647 3648
3648 void WebViewImpl::layoutUpdated(WebLocalFrameImpl* webframe) { 3649 void WebViewImpl::layoutUpdated(WebLocalFrameImpl* webframe) {
3649 LocalFrame* frame = webframe->frame(); 3650 LocalFrame* frame = webframe->frame();
3650 if (!m_client || !frame->isMainFrame()) 3651 if (!m_client || !m_client->canUpdateLayout() || !frame->isMainFrame())
3651 return; 3652 return;
3652 3653
3653 if (m_shouldAutoResize) { 3654 if (m_shouldAutoResize) {
3654 WebSize frameSize = frame->view()->frameRect().size(); 3655 WebSize frameSize = frame->view()->frameRect().size();
3655 if (frameSize != m_size) { 3656 if (frameSize != m_size) {
3656 m_size = frameSize; 3657 m_size = frameSize;
3657 3658
3658 page()->visualViewport().setSize(m_size); 3659 page()->visualViewport().setSize(m_size);
3659 pageScaleConstraintsSet().didChangeInitialContainingBlockSize(m_size); 3660 pageScaleConstraintsSet().didChangeInitialContainingBlockSize(m_size);
3660 frame->view()->setInitialViewportSize(m_size); 3661 frame->view()->setInitialViewportSize(m_size);
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
4177 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4178 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4178 return nullptr; 4179 return nullptr;
4179 return focusedFrame; 4180 return focusedFrame;
4180 } 4181 }
4181 4182
4182 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4183 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4183 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4184 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4184 } 4185 }
4185 4186
4186 } // namespace blink 4187 } // namespace blink
OLDNEW
« no previous file with comments | « content/shell/test_runner/web_view_test_client.cc ('k') | third_party/WebKit/Source/web/tests/FrameTestHelpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698