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

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

Issue 336553003: Change Page::m_mainFrame to be a Frame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/WebPageSerializer.cpp ('k') | Source/web/tests/MHTMLTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 m_inspectorSettingsMap = adoptPtr(new SettingsMap); 436 m_inspectorSettingsMap = adoptPtr(new SettingsMap);
437 } 437 }
438 438
439 WebViewImpl::~WebViewImpl() 439 WebViewImpl::~WebViewImpl()
440 { 440 {
441 ASSERT(!m_page); 441 ASSERT(!m_page);
442 } 442 }
443 443
444 WebLocalFrameImpl* WebViewImpl::mainFrameImpl() 444 WebLocalFrameImpl* WebViewImpl::mainFrameImpl()
445 { 445 {
446 return m_page ? WebLocalFrameImpl::fromFrame(m_page->mainFrame()) : 0; 446 return m_page && m_page->mainFrame()->isLocalFrame() ? WebLocalFrameImpl::fr omFrame(m_page->deprecatedLocalMainFrame()) : 0;
447 } 447 }
448 448
449 bool WebViewImpl::tabKeyCyclesThroughElements() const 449 bool WebViewImpl::tabKeyCyclesThroughElements() const
450 { 450 {
451 ASSERT(m_page); 451 ASSERT(m_page);
452 return m_page->tabKeyCyclesThroughElements(); 452 return m_page->tabKeyCyclesThroughElements();
453 } 453 }
454 454
455 void WebViewImpl::setTabKeyCyclesThroughElements(bool value) 455 void WebViewImpl::setTabKeyCyclesThroughElements(bool value)
456 { 456 {
(...skipping 21 matching lines...) Expand all
478 ASSERT(!m_selectPopup); 478 ASSERT(!m_selectPopup);
479 ASSERT(!m_pagePopup); 479 ASSERT(!m_pagePopup);
480 } 480 }
481 481
482 m_lastMouseDownPoint = WebPoint(event.x, event.y); 482 m_lastMouseDownPoint = WebPoint(event.x, event.y);
483 483
484 // Take capture on a mouse down on a plugin so we can send it mouse events. 484 // Take capture on a mouse down on a plugin so we can send it mouse events.
485 // If the hit node is a plugin but a scrollbar is over it don't start mouse 485 // If the hit node is a plugin but a scrollbar is over it don't start mouse
486 // capture because it will interfere with the scrollbar receiving events. 486 // capture because it will interfere with the scrollbar receiving events.
487 IntPoint point(event.x, event.y); 487 IntPoint point(event.x, event.y);
488 if (event.button == WebMouseEvent::ButtonLeft && !m_page->mainFrame()->view( )->scrollbarAtPoint(point)) { 488 if (event.button == WebMouseEvent::ButtonLeft && m_page->mainFrame()->isLoca lFrame() && !m_page->deprecatedLocalMainFrame()->view()->scrollbarAtPoint(point) ) {
489 point = m_page->mainFrame()->view()->windowToContents(point); 489 point = m_page->deprecatedLocalMainFrame()->view()->windowToContents(poi nt);
490 HitTestResult result(m_page->mainFrame()->eventHandler().hitTestResultAt Point(point)); 490 HitTestResult result(m_page->deprecatedLocalMainFrame()->eventHandler(). hitTestResultAtPoint(point));
491 Node* hitNode = result.innerNonSharedNode(); 491 Node* hitNode = result.innerNonSharedNode();
492 492
493 if (!result.scrollbar() && hitNode && hitNode->renderer() && hitNode->re nderer()->isEmbeddedObject()) { 493 if (!result.scrollbar() && hitNode && hitNode->renderer() && hitNode->re nderer()->isEmbeddedObject()) {
494 m_mouseCaptureNode = hitNode; 494 m_mouseCaptureNode = hitNode;
495 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); 495 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this);
496 } 496 }
497 } 497 }
498 498
499 PageWidgetEventHandler::handleMouseDown(mainFrame, event); 499 PageWidgetEventHandler::handleMouseDown(mainFrame, event);
500 500
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 syntheticWheel.deltaY = delta.height; 590 syntheticWheel.deltaY = delta.height;
591 syntheticWheel.wheelTicksX = delta.width / tickDivisor; 591 syntheticWheel.wheelTicksX = delta.width / tickDivisor;
592 syntheticWheel.wheelTicksY = delta.height / tickDivisor; 592 syntheticWheel.wheelTicksY = delta.height / tickDivisor;
593 syntheticWheel.hasPreciseScrollingDeltas = true; 593 syntheticWheel.hasPreciseScrollingDeltas = true;
594 syntheticWheel.x = m_positionOnFlingStart.x; 594 syntheticWheel.x = m_positionOnFlingStart.x;
595 syntheticWheel.y = m_positionOnFlingStart.y; 595 syntheticWheel.y = m_positionOnFlingStart.y;
596 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; 596 syntheticWheel.globalX = m_globalPositionOnFlingStart.x;
597 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; 597 syntheticWheel.globalY = m_globalPositionOnFlingStart.y;
598 syntheticWheel.modifiers = m_flingModifier; 598 syntheticWheel.modifiers = m_flingModifier;
599 599
600 if (m_page && m_page->mainFrame() && m_page->mainFrame()->view()) 600 if (m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame() && m_page->deprecatedLocalMainFrame()->view())
601 return handleMouseWheel(*m_page->mainFrame(), syntheticWheel); 601 return handleMouseWheel(*m_page->deprecatedLocalMainFrame(), synthet icWheel);
602 } else { 602 } else {
603 WebGestureEvent syntheticGestureEvent; 603 WebGestureEvent syntheticGestureEvent;
604 604
605 syntheticGestureEvent.type = WebInputEvent::GestureScrollUpdateWithoutPr opagation; 605 syntheticGestureEvent.type = WebInputEvent::GestureScrollUpdateWithoutPr opagation;
606 syntheticGestureEvent.data.scrollUpdate.deltaX = delta.width; 606 syntheticGestureEvent.data.scrollUpdate.deltaX = delta.width;
607 syntheticGestureEvent.data.scrollUpdate.deltaY = delta.height; 607 syntheticGestureEvent.data.scrollUpdate.deltaY = delta.height;
608 syntheticGestureEvent.x = m_positionOnFlingStart.x; 608 syntheticGestureEvent.x = m_positionOnFlingStart.x;
609 syntheticGestureEvent.y = m_positionOnFlingStart.y; 609 syntheticGestureEvent.y = m_positionOnFlingStart.y;
610 syntheticGestureEvent.globalX = m_globalPositionOnFlingStart.x; 610 syntheticGestureEvent.globalX = m_globalPositionOnFlingStart.x;
611 syntheticGestureEvent.globalY = m_globalPositionOnFlingStart.y; 611 syntheticGestureEvent.globalY = m_globalPositionOnFlingStart.y;
612 syntheticGestureEvent.modifiers = m_flingModifier; 612 syntheticGestureEvent.modifiers = m_flingModifier;
613 syntheticGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; 613 syntheticGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
614 614
615 if (m_page && m_page->mainFrame() && m_page->mainFrame()->view()) 615 if (m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame() && m_page->deprecatedLocalMainFrame()->view())
616 return handleGestureEvent(syntheticGestureEvent); 616 return handleGestureEvent(syntheticGestureEvent);
617 } 617 }
618 return false; 618 return false;
619 } 619 }
620 620
621 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) 621 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event)
622 { 622 {
623 bool eventSwallowed = false; 623 bool eventSwallowed = false;
624 bool eventCancelled = false; // for disambiguation 624 bool eventCancelled = false; // for disambiguation
625 625
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 if (!node || !node->renderer()) 1164 if (!node || !node->renderer())
1165 return false; 1165 return false;
1166 1166
1167 ECursor cursor = node->renderer()->style()->cursor(); 1167 ECursor cursor = node->renderer()->style()->cursor();
1168 return cursor == CURSOR_POINTER 1168 return cursor == CURSOR_POINTER
1169 || (cursor == CURSOR_AUTO && frame->eventHandler().useHandCursor(node, n ode->isLink())); 1169 || (cursor == CURSOR_AUTO && frame->eventHandler().useHandCursor(node, n ode->isLink()));
1170 } 1170 }
1171 1171
1172 Node* WebViewImpl::bestTapNode(const PlatformGestureEvent& tapEvent) 1172 Node* WebViewImpl::bestTapNode(const PlatformGestureEvent& tapEvent)
1173 { 1173 {
1174 if (!m_page || !m_page->mainFrame()) 1174 if (!m_page || !m_page->mainFrame() || !m_page->mainFrame()->isLocalFrame())
1175 return 0; 1175 return 0;
1176 1176
1177 Node* bestTouchNode = 0; 1177 Node* bestTouchNode = 0;
1178 1178
1179 IntPoint touchEventLocation(tapEvent.position()); 1179 IntPoint touchEventLocation(tapEvent.position());
1180 m_page->mainFrame()->eventHandler().adjustGesturePosition(tapEvent, touchEve ntLocation); 1180 m_page->deprecatedLocalMainFrame()->eventHandler().adjustGesturePosition(tap Event, touchEventLocation);
1181 1181
1182 IntPoint hitTestPoint = m_page->mainFrame()->view()->windowToContents(touchE ventLocation); 1182 IntPoint hitTestPoint = m_page->deprecatedLocalMainFrame()->view()->windowTo Contents(touchEventLocation);
1183 HitTestResult result = m_page->mainFrame()->eventHandler().hitTestResultAtPo int(hitTestPoint, HitTestRequest::TouchEvent | HitTestRequest::ConfusingAndOften MisusedDisallowShadowContent); 1183 HitTestResult result = m_page->deprecatedLocalMainFrame()->eventHandler().hi tTestResultAtPoint(hitTestPoint, HitTestRequest::TouchEvent | HitTestRequest::Co nfusingAndOftenMisusedDisallowShadowContent);
1184 bestTouchNode = result.targetNode(); 1184 bestTouchNode = result.targetNode();
1185 1185
1186 // We might hit something like an image map that has no renderer on it 1186 // We might hit something like an image map that has no renderer on it
1187 // Walk up the tree until we have a node with an attached renderer 1187 // Walk up the tree until we have a node with an attached renderer
1188 while (bestTouchNode && !bestTouchNode->renderer()) 1188 while (bestTouchNode && !bestTouchNode->renderer())
1189 bestTouchNode = bestTouchNode->parentNode(); 1189 bestTouchNode = bestTouchNode->parentNode();
1190 1190
1191 // Check if we're in the subtree of a node with a hand cursor 1191 // Check if we're in the subtree of a node with a hand cursor
1192 // this is the heuristic we use to determine if we show a highlight on tap 1192 // this is the heuristic we use to determine if we show a highlight on tap
1193 while (bestTouchNode && !invokesHandCursor(bestTouchNode, m_page->mainFrame( ))) 1193 while (bestTouchNode && !invokesHandCursor(bestTouchNode, m_page->deprecated LocalMainFrame()))
1194 bestTouchNode = bestTouchNode->parentNode(); 1194 bestTouchNode = bestTouchNode->parentNode();
1195 1195
1196 if (!bestTouchNode) 1196 if (!bestTouchNode)
1197 return 0; 1197 return 0;
1198 1198
1199 // We should pick the largest enclosing node with hand cursor set. 1199 // We should pick the largest enclosing node with hand cursor set.
1200 while (bestTouchNode->parentNode() && invokesHandCursor(bestTouchNode->paren tNode(), m_page->mainFrame())) 1200 while (bestTouchNode->parentNode() && invokesHandCursor(bestTouchNode->paren tNode(), toLocalFrame(m_page->mainFrame())))
1201 bestTouchNode = bestTouchNode->parentNode(); 1201 bestTouchNode = bestTouchNode->parentNode();
1202 1202
1203 return bestTouchNode; 1203 return bestTouchNode;
1204 } 1204 }
1205 1205
1206 void WebViewImpl::enableTapHighlightAtPoint(const PlatformGestureEvent& tapEvent ) 1206 void WebViewImpl::enableTapHighlightAtPoint(const PlatformGestureEvent& tapEvent )
1207 { 1207 {
1208 Node* touchNode = bestTapNode(tapEvent); 1208 Node* touchNode = bestTapNode(tapEvent);
1209 1209
1210 WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes; 1210 WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes;
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 return static_cast<WebViewImpl*>(page->chrome().client().webView()); 1533 return static_cast<WebViewImpl*>(page->chrome().client().webView());
1534 } 1534 }
1535 1535
1536 // WebWidget ------------------------------------------------------------------ 1536 // WebWidget ------------------------------------------------------------------
1537 1537
1538 void WebViewImpl::close() 1538 void WebViewImpl::close()
1539 { 1539 {
1540 if (m_page) { 1540 if (m_page) {
1541 // Initiate shutdown for the entire frameset. This will cause a lot of 1541 // Initiate shutdown for the entire frameset. This will cause a lot of
1542 // notifications to be sent. 1542 // notifications to be sent.
1543 if (m_page->mainFrame()) 1543 // FIXME: This is redundant with willBeDestroyed()... is this really
1544 m_page->mainFrame()->loader().frameDetached(); 1544 // needed?
1545 if (m_page->mainFrame()->isLocalFrame())
1546 m_page->deprecatedLocalMainFrame()->loader().frameDetached();
1545 1547
1546 m_page->willBeDestroyed(); 1548 m_page->willBeDestroyed();
1547 m_page.clear(); 1549 m_page.clear();
1548 } 1550 }
1549 1551
1550 // Should happen after m_page.clear(). 1552 // Should happen after m_page.clear().
1551 if (m_devToolsAgent) 1553 if (m_devToolsAgent)
1552 m_devToolsAgent.clear(); 1554 m_devToolsAgent.clear();
1553 1555
1554 // Reset the delegate to prevent notifications being sent as we're being 1556 // Reset the delegate to prevent notifications being sent as we're being
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 } 1742 }
1741 1743
1742 #if OS(ANDROID) 1744 #if OS(ANDROID)
1743 void WebViewImpl::paintCompositedDeprecated(WebCanvas* canvas, const WebRect& re ct) 1745 void WebViewImpl::paintCompositedDeprecated(WebCanvas* canvas, const WebRect& re ct)
1744 { 1746 {
1745 // Note: This method exists on OS(ANDROID) and will hopefully be 1747 // Note: This method exists on OS(ANDROID) and will hopefully be
1746 // removed once the link disambiguation feature renders using 1748 // removed once the link disambiguation feature renders using
1747 // the compositor. 1749 // the compositor.
1748 ASSERT(isAcceleratedCompositingActive()); 1750 ASSERT(isAcceleratedCompositingActive());
1749 1751
1750 FrameView* view = page()->mainFrame()->view(); 1752 FrameView* view = page()->deprecatedLocalMainFrame()->view();
1751 PaintBehavior oldPaintBehavior = view->paintBehavior(); 1753 PaintBehavior oldPaintBehavior = view->paintBehavior();
1752 view->setPaintBehavior(oldPaintBehavior | PaintBehaviorFlattenCompositingLay ers); 1754 view->setPaintBehavior(oldPaintBehavior | PaintBehaviorFlattenCompositingLay ers);
1753 1755
1754 PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTran sparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque); 1756 PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTran sparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque);
1755 1757
1756 view->setPaintBehavior(oldPaintBehavior); 1758 view->setPaintBehavior(oldPaintBehavior);
1757 } 1759 }
1758 #endif 1760 #endif
1759 1761
1760 void WebViewImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCallback * callback) 1762 void WebViewImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCallback * callback)
1761 { 1763 {
1762 ASSERT(isAcceleratedCompositingActive()); 1764 ASSERT(isAcceleratedCompositingActive());
1763 m_layerTreeView->compositeAndReadbackAsync(callback); 1765 m_layerTreeView->compositeAndReadbackAsync(callback);
1764 } 1766 }
1765 1767
1766 bool WebViewImpl::isTrackingRepaints() const 1768 bool WebViewImpl::isTrackingRepaints() const
1767 { 1769 {
1768 if (!page()) 1770 if (!page())
1769 return false; 1771 return false;
1770 FrameView* view = page()->mainFrame()->view(); 1772 if (!page()->mainFrame()->isLocalFrame())
1773 return false;
1774 FrameView* view = page()->deprecatedLocalMainFrame()->view();
1771 return view->isTrackingPaintInvalidations(); 1775 return view->isTrackingPaintInvalidations();
1772 } 1776 }
1773 1777
1774 void WebViewImpl::themeChanged() 1778 void WebViewImpl::themeChanged()
1775 { 1779 {
1776 if (!page()) 1780 if (!page())
1777 return; 1781 return;
1778 FrameView* view = page()->mainFrame()->view(); 1782 if (!page()->mainFrame()->isLocalFrame())
1783 return;
1784 FrameView* view = page()->deprecatedLocalMainFrame()->view();
1779 1785
1780 WebRect damagedRect(0, 0, m_size.width, m_size.height); 1786 WebRect damagedRect(0, 0, m_size.width, m_size.height);
1781 view->invalidateRect(damagedRect); 1787 view->invalidateRect(damagedRect);
1782 } 1788 }
1783 1789
1784 void WebViewImpl::enterFullScreenForElement(WebCore::Element* element) 1790 void WebViewImpl::enterFullScreenForElement(WebCore::Element* element)
1785 { 1791 {
1786 m_fullscreenController->enterFullScreenForElement(element); 1792 m_fullscreenController->enterFullScreenForElement(element);
1787 } 1793 }
1788 1794
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 } 1966 }
1961 } 1967 }
1962 m_imeAcceptEvents = true; 1968 m_imeAcceptEvents = true;
1963 } else { 1969 } else {
1964 hidePopups(); 1970 hidePopups();
1965 1971
1966 // Clear focus on the currently focused frame if any. 1972 // Clear focus on the currently focused frame if any.
1967 if (!m_page) 1973 if (!m_page)
1968 return; 1974 return;
1969 1975
1970 LocalFrame* frame = m_page->mainFrame(); 1976 LocalFrame* frame = m_page->mainFrame() && m_page->mainFrame()->isLocalF rame()
1977 ? m_page->deprecatedLocalMainFrame() : 0;
1971 if (!frame) 1978 if (!frame)
1972 return; 1979 return;
1973 1980
1974 RefPtr<Frame> focusedFrame = m_page->focusController().focusedFrame(); 1981 RefPtr<Frame> focusedFrame = m_page->focusController().focusedFrame();
1975 if (focusedFrame && focusedFrame->isLocalFrame()) { 1982 if (focusedFrame && focusedFrame->isLocalFrame()) {
1976 // Finish an ongoing composition to delete the composition node. 1983 // Finish an ongoing composition to delete the composition node.
1977 if (toLocalFrame(focusedFrame.get())->inputMethodController().hasCom position()) { 1984 if (toLocalFrame(focusedFrame.get())->inputMethodController().hasCom position()) {
1978 if (m_autofillClient) 1985 if (m_autofillClient)
1979 m_autofillClient->setIgnoreTextChanges(true); 1986 m_autofillClient->setIgnoreTextChanges(true);
1980 1987
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 } 2354 }
2348 2355
2349 WebColor WebViewImpl::backgroundColor() const 2356 WebColor WebViewImpl::backgroundColor() const
2350 { 2357 {
2351 if (isTransparent()) 2358 if (isTransparent())
2352 return Color::transparent; 2359 return Color::transparent;
2353 if (!m_page) 2360 if (!m_page)
2354 return m_baseBackgroundColor; 2361 return m_baseBackgroundColor;
2355 if (!m_page->mainFrame()) 2362 if (!m_page->mainFrame())
2356 return m_baseBackgroundColor; 2363 return m_baseBackgroundColor;
2357 FrameView* view = m_page->mainFrame()->view(); 2364 if (!m_page->mainFrame()->isLocalFrame())
2365 return m_baseBackgroundColor;
2366 FrameView* view = m_page->deprecatedLocalMainFrame()->view();
2358 return view->documentBackgroundColor().rgb(); 2367 return view->documentBackgroundColor().rgb();
2359 } 2368 }
2360 2369
2361 bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length) 2370 bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length)
2362 { 2371 {
2363 const LocalFrame* focused = toLocalFrame(focusedWebCoreFrame()); 2372 const LocalFrame* focused = toLocalFrame(focusedWebCoreFrame());
2364 if (!focused) 2373 if (!focused)
2365 return false; 2374 return false;
2366 2375
2367 PlainTextRange selectionOffsets = focused->inputMethodController().getSelect ionOffsets(); 2376 PlainTextRange selectionOffsets = focused->inputMethodController().getSelect ionOffsets();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 WebSettings* WebViewImpl::settings() 2463 WebSettings* WebViewImpl::settings()
2455 { 2464 {
2456 return settingsImpl(); 2465 return settingsImpl();
2457 } 2466 }
2458 2467
2459 WebString WebViewImpl::pageEncoding() const 2468 WebString WebViewImpl::pageEncoding() const
2460 { 2469 {
2461 if (!m_page) 2470 if (!m_page)
2462 return WebString(); 2471 return WebString();
2463 2472
2464 // FIXME: Is this check needed? 2473 if (!m_page->mainFrame()->isLocalFrame())
2465 if (!m_page->mainFrame()->document()->loader())
2466 return WebString(); 2474 return WebString();
2467 2475
2468 return m_page->mainFrame()->document()->encodingName(); 2476 // FIXME: Is this check needed?
2477 if (!m_page->deprecatedLocalMainFrame()->document()->loader())
2478 return WebString();
2479
2480 return m_page->deprecatedLocalMainFrame()->document()->encodingName();
2469 } 2481 }
2470 2482
2471 void WebViewImpl::setPageEncoding(const WebString& encodingName) 2483 void WebViewImpl::setPageEncoding(const WebString& encodingName)
2472 { 2484 {
2473 if (!m_page) 2485 if (!m_page)
2474 return; 2486 return;
2475 2487
2488 if (!m_page->mainFrame()->isLocalFrame())
2489 return;
2490
2476 // Only change override encoding, don't change default encoding. 2491 // Only change override encoding, don't change default encoding.
2477 // Note that the new encoding must be 0 if it isn't supposed to be set. 2492 // Note that the new encoding must be 0 if it isn't supposed to be set.
2478 AtomicString newEncodingName; 2493 AtomicString newEncodingName;
2479 if (!encodingName.isEmpty()) 2494 if (!encodingName.isEmpty())
2480 newEncodingName = encodingName; 2495 newEncodingName = encodingName;
2481 m_page->mainFrame()->loader().reload(NormalReload, KURL(), newEncodingName); 2496 m_page->deprecatedLocalMainFrame()->loader().reload(NormalReload, KURL(), ne wEncodingName);
2482 } 2497 }
2483 2498
2484 WebFrame* WebViewImpl::mainFrame() 2499 WebFrame* WebViewImpl::mainFrame()
2485 { 2500 {
2501 // FIXME: This should be updated so it can return both WebLocalFrames and
2502 // WebRemoteFrames. Right now, it only returns WebLocalFrames.
2486 return mainFrameImpl(); 2503 return mainFrameImpl();
2487 } 2504 }
2488 2505
2489 WebFrame* WebViewImpl::findFrameByName( 2506 WebFrame* WebViewImpl::findFrameByName(
2490 const WebString& name, WebFrame* relativeToFrame) 2507 const WebString& name, WebFrame* relativeToFrame)
2491 { 2508 {
2492 // FIXME: Either this should only deal with WebLocalFrames or it should move to WebFrame. 2509 // FIXME: Either this should only deal with WebLocalFrames or it should move to WebFrame.
2493 if (!relativeToFrame) 2510 if (!relativeToFrame)
2494 relativeToFrame = mainFrame(); 2511 relativeToFrame = mainFrame();
2495 Frame* frame = toWebLocalFrameImpl(relativeToFrame)->frame(); 2512 Frame* frame = toWebLocalFrameImpl(relativeToFrame)->frame();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2552 // If a text field has focus, we need to make sure the selection controller 2569 // If a text field has focus, we need to make sure the selection controller
2553 // knows to remove selection from it. Otherwise, the text field is still 2570 // knows to remove selection from it. Otherwise, the text field is still
2554 // processing keyboard events even though focus has been moved to the page a nd 2571 // processing keyboard events even though focus has been moved to the page a nd
2555 // keystrokes get eaten as a result. 2572 // keystrokes get eaten as a result.
2556 if (oldFocusedElement->isContentEditable() || oldFocusedElement->isTextFormC ontrol()) 2573 if (oldFocusedElement->isContentEditable() || oldFocusedElement->isTextFormC ontrol())
2557 localFrame->selection().clear(); 2574 localFrame->selection().clear();
2558 } 2575 }
2559 2576
2560 void WebViewImpl::scrollFocusedNodeIntoRect(const WebRect& rect) 2577 void WebViewImpl::scrollFocusedNodeIntoRect(const WebRect& rect)
2561 { 2578 {
2562 LocalFrame* frame = page()->mainFrame(); 2579 LocalFrame* frame = page()->mainFrame() && page()->mainFrame()->isLocalFrame ()
2580 ? page()->deprecatedLocalMainFrame() : 0;
2563 Element* element = focusedElement(); 2581 Element* element = focusedElement();
2564 if (!frame || !frame->view() || !element) 2582 if (!frame || !frame->view() || !element)
2565 return; 2583 return;
2566 2584
2567 if (!m_webSettings->autoZoomFocusedNodeToLegibleScale()) { 2585 if (!m_webSettings->autoZoomFocusedNodeToLegibleScale()) {
2568 frame->view()->scrollElementToRect(element, IntRect(rect.x, rect.y, rect .width, rect.height)); 2586 frame->view()->scrollElementToRect(element, IntRect(rect.x, rect.y, rect .width, rect.height));
2569 return; 2587 return;
2570 } 2588 }
2571 2589
2572 float scale; 2590 float scale;
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2882 constraints.maximumScale = m_pageScaleConstraintsSet.defaultConstraints( ).maximumScale; 2900 constraints.maximumScale = m_pageScaleConstraintsSet.defaultConstraints( ).maximumScale;
2883 } else { 2901 } else {
2884 constraints.minimumScale = -1; 2902 constraints.minimumScale = -1;
2885 constraints.maximumScale = -1; 2903 constraints.maximumScale = -1;
2886 } 2904 }
2887 setUserAgentPageScaleConstraints(constraints); 2905 setUserAgentPageScaleConstraints(constraints);
2888 } 2906 }
2889 2907
2890 void WebViewImpl::refreshPageScaleFactorAfterLayout() 2908 void WebViewImpl::refreshPageScaleFactorAfterLayout()
2891 { 2909 {
2892 if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()- >view()) 2910 if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()- >isLocalFrame() || !page()->deprecatedLocalMainFrame()->view())
2893 return; 2911 return;
2894 FrameView* view = page()->mainFrame()->view(); 2912 FrameView* view = page()->deprecatedLocalMainFrame()->view();
2895 2913
2896 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v iewportDescription()); 2914 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v iewportDescription());
2897 m_pageScaleConstraintsSet.computeFinalConstraints(); 2915 m_pageScaleConstraintsSet.computeFinalConstraints();
2898 2916
2899 if (settings()->shrinksViewportContentToFit() && !m_fixedLayoutSizeLock) { 2917 if (settings()->shrinksViewportContentToFit() && !m_fixedLayoutSizeLock) {
2900 int verticalScrollbarWidth = 0; 2918 int verticalScrollbarWidth = 0;
2901 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar()) 2919 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar())
2902 verticalScrollbarWidth = view->verticalScrollbar()->width(); 2920 verticalScrollbarWidth = view->verticalScrollbar()->width();
2903 m_pageScaleConstraintsSet.adjustFinalConstraintsToContentsSize(contentsS ize(), verticalScrollbarWidth); 2921 m_pageScaleConstraintsSet.adjustFinalConstraintsToContentsSize(contentsS ize(), verticalScrollbarWidth);
2904 } 2922 }
(...skipping 11 matching lines...) Expand all
2916 updateLayerTreeViewport(); 2934 updateLayerTreeViewport();
2917 2935
2918 // Relayout immediately to avoid violating the rule that needsLayout() 2936 // Relayout immediately to avoid violating the rule that needsLayout()
2919 // isn't set at the end of a layout. 2937 // isn't set at the end of a layout.
2920 if (view->needsLayout()) 2938 if (view->needsLayout())
2921 view->layout(); 2939 view->layout();
2922 } 2940 }
2923 2941
2924 void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription & description) 2942 void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription & description)
2925 { 2943 {
2926 if (!settings()->viewportEnabled() || !page() || (!m_size.width && !m_size.h eight)) 2944 if (!settings()->viewportEnabled() || !page() || (!m_size.width && !m_size.h eight) || !page()->mainFrame()->isLocalFrame())
2927 return; 2945 return;
2928 2946
2929 Document* document = page()->mainFrame()->document(); 2947 Document* document = page()->deprecatedLocalMainFrame()->document();
2930 2948
2931 if (settingsImpl()->useExpandedHeuristicsForGpuRasterization()) { 2949 if (settingsImpl()->useExpandedHeuristicsForGpuRasterization()) {
2932 m_matchesHeuristicsForGpuRasterization = description.maxWidth == Length( DeviceWidth) 2950 m_matchesHeuristicsForGpuRasterization = description.maxWidth == Length( DeviceWidth)
2933 && description.minZoom == 1.0 2951 && description.minZoom == 1.0
2934 && description.minZoomIsExplicit; 2952 && description.minZoomIsExplicit;
2935 } else { 2953 } else {
2936 m_matchesHeuristicsForGpuRasterization = description.maxWidth == Length( DeviceWidth) 2954 m_matchesHeuristicsForGpuRasterization = description.maxWidth == Length( DeviceWidth)
2937 && description.minZoom == 1.0 2955 && description.minZoom == 1.0
2938 && description.minZoomIsExplicit 2956 && description.minZoomIsExplicit
2939 && description.zoom == 1.0 2957 && description.zoom == 1.0
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2973 m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, defaultMinWidth.intValue(), deviceScaleFactor(), settingsImpl()->supportDepreca tedTargetDensityDPI(), page()->settings().wideViewportQuirkEnabled(), page()->se ttings().useWideViewport(), page()->settings().loadWithOverviewMode(), settingsI mpl()->viewportMetaNonUserScalableQuirk()); 2991 m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, defaultMinWidth.intValue(), deviceScaleFactor(), settingsImpl()->supportDepreca tedTargetDensityDPI(), page()->settings().wideViewportQuirkEnabled(), page()->se ttings().useWideViewport(), page()->settings().loadWithOverviewMode(), settingsI mpl()->viewportMetaNonUserScalableQuirk());
2974 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale; 2992 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
2975 if (oldInitialScale != newInitialScale && newInitialScale != -1) { 2993 if (oldInitialScale != newInitialScale && newInitialScale != -1) {
2976 m_pageScaleConstraintsSet.setNeedsReset(true); 2994 m_pageScaleConstraintsSet.setNeedsReset(true);
2977 if (mainFrameImpl() && mainFrameImpl()->frameView()) 2995 if (mainFrameImpl() && mainFrameImpl()->frameView())
2978 mainFrameImpl()->frameView()->setNeedsLayout(); 2996 mainFrameImpl()->frameView()->setNeedsLayout();
2979 } 2997 }
2980 2998
2981 updateMainFrameLayoutSize(); 2999 updateMainFrameLayoutSize();
2982 3000
2983 if (LocalFrame* frame = page()->mainFrame()) { 3001 if (LocalFrame* frame = page()->deprecatedLocalMainFrame()) {
2984 if (FastTextAutosizer* textAutosizer = frame->document()->fastTextAutosi zer()) 3002 if (FastTextAutosizer* textAutosizer = frame->document()->fastTextAutosi zer())
2985 textAutosizer->updatePageInfoInAllFrames(); 3003 textAutosizer->updatePageInfoInAllFrames();
2986 } 3004 }
2987 } 3005 }
2988 3006
2989 void WebViewImpl::updateMainFrameLayoutSize() 3007 void WebViewImpl::updateMainFrameLayoutSize()
2990 { 3008 {
2991 if (m_fixedLayoutSizeLock || m_shouldAutoResize || !mainFrameImpl()) 3009 if (m_fixedLayoutSizeLock || m_shouldAutoResize || !mainFrameImpl())
2992 return; 3010 return;
2993 3011
2994 RefPtr<FrameView> view = mainFrameImpl()->frameView(); 3012 RefPtr<FrameView> view = mainFrameImpl()->frameView();
2995 if (!view) 3013 if (!view)
2996 return; 3014 return;
2997 3015
2998 WebSize layoutSize = m_size; 3016 WebSize layoutSize = m_size;
2999 3017
3000 if (settings()->viewportEnabled()) { 3018 if (settings()->viewportEnabled()) {
3001 layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstra ints().layoutSize); 3019 layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstra ints().layoutSize);
3002 3020
3003 bool textAutosizingEnabled = page()->settings().textAutosizingEnabled(); 3021 bool textAutosizingEnabled = page()->settings().textAutosizingEnabled();
3004 if (textAutosizingEnabled && layoutSize.width != view->layoutSize().widt h()) { 3022 if (textAutosizingEnabled && layoutSize.width != view->layoutSize().widt h()) {
3005 if (TextAutosizer* textAutosizer = page()->mainFrame()->document()-> textAutosizer()) 3023 if (TextAutosizer* textAutosizer = page()->deprecatedLocalMainFrame( )->document()->textAutosizer())
3006 textAutosizer->recalculateMultipliers(); 3024 textAutosizer->recalculateMultipliers();
3007 } 3025 }
3008 } 3026 }
3009 3027
3010 view->setLayoutSize(layoutSize); 3028 view->setLayoutSize(layoutSize);
3011 } 3029 }
3012 3030
3013 IntSize WebViewImpl::contentsSize() const 3031 IntSize WebViewImpl::contentsSize() const
3014 { 3032 {
3015 RenderView* root = page()->mainFrame()->contentRenderer(); 3033 if (!page()->mainFrame()->isLocalFrame())
3034 return IntSize();
3035 RenderView* root = page()->deprecatedLocalMainFrame()->contentRenderer();
3016 if (!root) 3036 if (!root)
3017 return IntSize(); 3037 return IntSize();
3018 return root->documentRect().size(); 3038 return root->documentRect().size();
3019 } 3039 }
3020 3040
3021 WebSize WebViewImpl::contentsPreferredMinimumSize() 3041 WebSize WebViewImpl::contentsPreferredMinimumSize()
3022 { 3042 {
3023 Document* document = m_page->mainFrame()->document(); 3043 Document* document = m_page->mainFrame()->isLocalFrame() ? m_page->deprecate dLocalMainFrame()->document() : 0;
3024 if (!document || !document->renderView() || !document->documentElement()) 3044 if (!document || !document->renderView() || !document->documentElement())
3025 return WebSize(); 3045 return WebSize();
3026 3046
3027 layout(); 3047 layout();
3028 FontCachePurgePreventer fontCachePurgePreventer; // Required by minPreferred LogicalWidth(). 3048 FontCachePurgePreventer fontCachePurgePreventer; // Required by minPreferred LogicalWidth().
3029 IntSize preferredMinimumSize(document->renderView()->minPreferredLogicalWidt h(), document->documentElement()->scrollHeight()); 3049 IntSize preferredMinimumSize(document->renderView()->minPreferredLogicalWidt h(), document->documentElement()->scrollHeight());
3030 preferredMinimumSize.scale(zoomLevelToZoomFactor(zoomLevel())); 3050 preferredMinimumSize.scale(zoomLevelToZoomFactor(zoomLevel()));
3031 return preferredMinimumSize; 3051 return preferredMinimumSize;
3032 } 3052 }
3033 3053
3034 float WebViewImpl::minimumPageScaleFactor() const 3054 float WebViewImpl::minimumPageScaleFactor() const
3035 { 3055 {
3036 return m_pageScaleConstraintsSet.finalConstraints().minimumScale; 3056 return m_pageScaleConstraintsSet.finalConstraints().minimumScale;
3037 } 3057 }
3038 3058
3039 float WebViewImpl::maximumPageScaleFactor() const 3059 float WebViewImpl::maximumPageScaleFactor() const
3040 { 3060 {
3041 return m_pageScaleConstraintsSet.finalConstraints().maximumScale; 3061 return m_pageScaleConstraintsSet.finalConstraints().maximumScale;
3042 } 3062 }
3043 3063
3044 void WebViewImpl::resetScrollAndScaleState() 3064 void WebViewImpl::resetScrollAndScaleState()
3045 { 3065 {
3046 // TODO: This is done by the pinchViewport().reset() call below and can be r emoved when 3066 // TODO: This is done by the pinchViewport().reset() call below and can be r emoved when
3047 // the new pinch path is the only one. 3067 // the new pinch path is the only one.
3048 setPageScaleFactor(1); 3068 setPageScaleFactor(1);
3049 updateMainFrameScrollPosition(IntPoint(), true); 3069 updateMainFrameScrollPosition(IntPoint(), true);
3050 page()->frameHost().pinchViewport().reset(); 3070 page()->frameHost().pinchViewport().reset();
3051 3071
3072 if (!page()->mainFrame()->isLocalFrame())
3073 return;
3074
3052 // Clear out the values for the current history item. This will prevent the history item from clobbering the 3075 // Clear out the values for the current history item. This will prevent the history item from clobbering the
3053 // value determined during page scale initialization, which may be less than 1. 3076 // value determined during page scale initialization, which may be less than 1.
3054 page()->mainFrame()->loader().clearScrollPositionAndViewState(); 3077 page()->deprecatedLocalMainFrame()->loader().clearScrollPositionAndViewState ();
3055 m_pageScaleConstraintsSet.setNeedsReset(true); 3078 m_pageScaleConstraintsSet.setNeedsReset(true);
3056 3079
3057 // Clobber saved scales and scroll offsets. 3080 // Clobber saved scales and scroll offsets.
3058 if (FrameView* view = page()->mainFrame()->document()->view()) 3081 if (FrameView* view = page()->deprecatedLocalMainFrame()->document()->view() )
3059 view->cacheCurrentScrollPosition(); 3082 view->cacheCurrentScrollPosition();
3060 } 3083 }
3061 3084
3062 void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) 3085 void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize)
3063 { 3086 {
3064 if (!page()) 3087 if (!page() || !page()->mainFrame()->isLocalFrame())
3065 return; 3088 return;
3066 3089
3067 LocalFrame* frame = page()->mainFrame(); 3090 LocalFrame* frame = page()->deprecatedLocalMainFrame();
3068 if (!frame) 3091 if (!frame)
3069 return; 3092 return;
3070 3093
3071 RefPtr<FrameView> view = frame->view(); 3094 RefPtr<FrameView> view = frame->view();
3072 if (!view) 3095 if (!view)
3073 return; 3096 return;
3074 3097
3075 m_fixedLayoutSizeLock = layoutSize.width || layoutSize.height; 3098 m_fixedLayoutSizeLock = layoutSize.width || layoutSize.height;
3076 3099
3077 if (m_fixedLayoutSizeLock) 3100 if (m_fixedLayoutSizeLock)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 // There isn't actually an image at these coordinates. Might be because 3178 // There isn't actually an image at these coordinates. Might be because
3156 // the window scrolled while the context menu was open or because the pa ge 3179 // the window scrolled while the context menu was open or because the pa ge
3157 // changed itself between when we thought there was an image here and wh en 3180 // changed itself between when we thought there was an image here and wh en
3158 // we actually tried to retreive the image. 3181 // we actually tried to retreive the image.
3159 // 3182 //
3160 // FIXME: implement a cache of the most recent HitTestResult to avoid ha ving 3183 // FIXME: implement a cache of the most recent HitTestResult to avoid ha ving
3161 // to do two hit tests. 3184 // to do two hit tests.
3162 return; 3185 return;
3163 } 3186 }
3164 3187
3165 m_page->mainFrame()->editor().copyImage(result); 3188 m_page->deprecatedLocalMainFrame()->editor().copyImage(result);
3166 } 3189 }
3167 3190
3168 void WebViewImpl::saveImageAt(const WebPoint& point) 3191 void WebViewImpl::saveImageAt(const WebPoint& point)
3169 { 3192 {
3170 if (!m_page) 3193 if (!m_page)
3171 return; 3194 return;
3172 3195
3173 KURL url = hitTestResultForWindowPos(point).absoluteImageURL(); 3196 KURL url = hitTestResultForWindowPos(point).absoluteImageURL();
3174 3197
3175 if (url.isEmpty()) 3198 if (url.isEmpty())
3176 return; 3199 return;
3177 3200
3178 ResourceRequest request(url); 3201 ResourceRequest request(url);
3179 m_page->mainFrame()->loader().client()->loadURLExternally( 3202 m_page->deprecatedLocalMainFrame()->loader().client()->loadURLExternally(
3180 request, NavigationPolicyDownloadTo, WebString()); 3203 request, NavigationPolicyDownloadTo, WebString());
3181 } 3204 }
3182 3205
3183 void WebViewImpl::dragSourceEndedAt( 3206 void WebViewImpl::dragSourceEndedAt(
3184 const WebPoint& clientPoint, 3207 const WebPoint& clientPoint,
3185 const WebPoint& screenPoint, 3208 const WebPoint& screenPoint,
3186 WebDragOperation operation) 3209 WebDragOperation operation)
3187 { 3210 {
3188 PlatformMouseEvent pme(clientPoint, 3211 PlatformMouseEvent pme(clientPoint,
3189 screenPoint, 3212 screenPoint,
3190 LeftButton, PlatformEvent::MouseMoved, 0, false, fals e, false, 3213 LeftButton, PlatformEvent::MouseMoved, 0, false, fals e, false,
3191 false, 0); 3214 false, 0);
3192 m_page->mainFrame()->eventHandler().dragSourceEndedAt(pme, 3215 m_page->deprecatedLocalMainFrame()->eventHandler().dragSourceEndedAt(pme,
3193 static_cast<DragOperation>(operation)); 3216 static_cast<DragOperation>(operation));
3194 } 3217 }
3195 3218
3196 void WebViewImpl::dragSourceSystemDragEnded() 3219 void WebViewImpl::dragSourceSystemDragEnded()
3197 { 3220 {
3198 // It's possible for us to get this callback while not doing a drag if 3221 // It's possible for us to get this callback while not doing a drag if
3199 // it's from a previous page that got unloaded. 3222 // it's from a previous page that got unloaded.
3200 if (m_doingDragAndDrop) { 3223 if (m_doingDragAndDrop) {
3201 m_page->dragController().dragEnded(); 3224 m_page->dragController().dragEnded();
3202 m_doingDragAndDrop = false; 3225 m_doingDragAndDrop = false;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
3365 if (point.x == -1 || point.y == -1) { 3388 if (point.x == -1 || point.y == -1) {
3366 m_page->inspectorController().inspect(0); 3389 m_page->inspectorController().inspect(0);
3367 } else { 3390 } else {
3368 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move | HitT estRequest::ReadOnly | HitTestRequest::AllowChildFrameContent; 3391 HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move | HitT estRequest::ReadOnly | HitTestRequest::AllowChildFrameContent;
3369 HitTestRequest request(hitType); 3392 HitTestRequest request(hitType);
3370 3393
3371 WebMouseEvent dummyEvent; 3394 WebMouseEvent dummyEvent;
3372 dummyEvent.type = WebInputEvent::MouseDown; 3395 dummyEvent.type = WebInputEvent::MouseDown;
3373 dummyEvent.x = point.x; 3396 dummyEvent.x = point.x;
3374 dummyEvent.y = point.y; 3397 dummyEvent.y = point.y;
3375 IntPoint transformedPoint = PlatformMouseEventBuilder(m_page->mainFrame( )->view(), dummyEvent).position(); 3398 IntPoint transformedPoint = PlatformMouseEventBuilder(m_page->deprecated LocalMainFrame()->view(), dummyEvent).position();
3376 HitTestResult result(m_page->mainFrame()->view()->windowToContents(trans formedPoint)); 3399 HitTestResult result(m_page->deprecatedLocalMainFrame()->view()->windowT oContents(transformedPoint));
3377 m_page->mainFrame()->contentRenderer()->hitTest(request, result); 3400 m_page->deprecatedLocalMainFrame()->contentRenderer()->hitTest(request, result);
3378 Node* node = result.innerNode(); 3401 Node* node = result.innerNode();
3379 if (!node && m_page->mainFrame()->document()) 3402 if (!node && m_page->deprecatedLocalMainFrame()->document())
3380 node = m_page->mainFrame()->document()->documentElement(); 3403 node = m_page->deprecatedLocalMainFrame()->document()->documentEleme nt();
3381 m_page->inspectorController().inspect(node); 3404 m_page->inspectorController().inspect(node);
3382 } 3405 }
3383 } 3406 }
3384 3407
3385 WebString WebViewImpl::inspectorSettings() const 3408 WebString WebViewImpl::inspectorSettings() const
3386 { 3409 {
3387 return m_inspectorSettings; 3410 return m_inspectorSettings;
3388 } 3411 }
3389 3412
3390 void WebViewImpl::setInspectorSettings(const WebString& settings) 3413 void WebViewImpl::setInspectorSettings(const WebString& settings)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3503 3526
3504 void WebViewImpl::setBaseBackgroundColor(WebColor color) 3527 void WebViewImpl::setBaseBackgroundColor(WebColor color)
3505 { 3528 {
3506 layout(); 3529 layout();
3507 3530
3508 if (m_baseBackgroundColor == color) 3531 if (m_baseBackgroundColor == color)
3509 return; 3532 return;
3510 3533
3511 m_baseBackgroundColor = color; 3534 m_baseBackgroundColor = color;
3512 3535
3513 if (m_page->mainFrame()) 3536 if (m_page->mainFrame() && m_page->mainFrame()->isLocalFrame())
3514 m_page->mainFrame()->view()->setBaseBackgroundColor(color); 3537 m_page->deprecatedLocalMainFrame()->view()->setBaseBackgroundColor(color );
3515 3538
3516 updateLayerTreeBackgroundColor(); 3539 updateLayerTreeBackgroundColor();
3517 } 3540 }
3518 3541
3519 void WebViewImpl::setIsActive(bool active) 3542 void WebViewImpl::setIsActive(bool active)
3520 { 3543 {
3521 if (page()) 3544 if (page())
3522 page()->focusController().setActive(active); 3545 page()->focusController().setActive(active);
3523 } 3546 }
3524 3547
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3575 m_linkHighlights.clear(); 3598 m_linkHighlights.clear();
3576 endActiveFlingAnimation(); 3599 endActiveFlingAnimation();
3577 m_userGestureObserved = false; 3600 m_userGestureObserved = false;
3578 } 3601 }
3579 3602
3580 void WebViewImpl::willInsertBody(WebLocalFrameImpl* webframe) 3603 void WebViewImpl::willInsertBody(WebLocalFrameImpl* webframe)
3581 { 3604 {
3582 if (webframe != mainFrameImpl()) 3605 if (webframe != mainFrameImpl())
3583 return; 3606 return;
3584 3607
3608 if (!m_page->mainFrame()->isLocalFrame())
3609 return;
3610
3585 // If we get to the <body> tag and we have no pending stylesheet and import load, we 3611 // If we get to the <body> tag and we have no pending stylesheet and import load, we
3586 // can be fairly confident we'll have something sensible to paint soon and 3612 // can be fairly confident we'll have something sensible to paint soon and
3587 // can turn off deferred commits. 3613 // can turn off deferred commits.
3588 if (m_page->mainFrame()->document()->isRenderingReady()) 3614 if (m_page->deprecatedLocalMainFrame()->document()->isRenderingReady())
3589 resumeTreeViewCommits(); 3615 resumeTreeViewCommits();
3590 } 3616 }
3591 3617
3592 void WebViewImpl::resumeTreeViewCommits() 3618 void WebViewImpl::resumeTreeViewCommits()
3593 { 3619 {
3594 if (m_layerTreeViewCommitsDeferred) { 3620 if (m_layerTreeViewCommitsDeferred) {
3595 if (m_layerTreeView) 3621 if (m_layerTreeView)
3596 m_layerTreeView->setDeferCommits(false); 3622 m_layerTreeView->setDeferCommits(false);
3597 m_layerTreeViewCommitsDeferred = false; 3623 m_layerTreeViewCommitsDeferred = false;
3598 } 3624 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3685 { 3711 {
3686 if (m_pageOverlays && m_pageOverlays->remove(overlay) && m_pageOverlays->emp ty()) 3712 if (m_pageOverlays && m_pageOverlays->remove(overlay) && m_pageOverlays->emp ty())
3687 m_pageOverlays = nullptr; 3713 m_pageOverlays = nullptr;
3688 } 3714 }
3689 3715
3690 void WebViewImpl::setOverlayLayer(WebCore::GraphicsLayer* layer) 3716 void WebViewImpl::setOverlayLayer(WebCore::GraphicsLayer* layer)
3691 { 3717 {
3692 if (!m_rootGraphicsLayer) 3718 if (!m_rootGraphicsLayer)
3693 return; 3719 return;
3694 3720
3721 if (!m_page->mainFrame()->isLocalFrame())
3722 return;
3723
3695 if (pinchVirtualViewportEnabled()) { 3724 if (pinchVirtualViewportEnabled()) {
3696 m_page->mainFrame()->view()->renderView()->compositor()->setOverlayLayer (layer); 3725 m_page->deprecatedLocalMainFrame()->view()->renderView()->compositor()-> setOverlayLayer(layer);
3697 return; 3726 return;
3698 } 3727 }
3699 3728
3700 // FIXME(bokan): This path goes away after virtual viewport pinch is enabled everywhere. 3729 // FIXME(bokan): This path goes away after virtual viewport pinch is enabled everywhere.
3701 if (!m_rootTransformLayer) 3730 if (!m_rootTransformLayer)
3702 m_rootTransformLayer = m_page->mainFrame()->view()->renderView()->compos itor()->ensureRootTransformLayer(); 3731 m_rootTransformLayer = m_page->deprecatedLocalMainFrame()->view()->rende rView()->compositor()->ensureRootTransformLayer();
3703 3732
3704 if (m_rootTransformLayer) { 3733 if (m_rootTransformLayer) {
3705 if (layer->parent() != m_rootTransformLayer) 3734 if (layer->parent() != m_rootTransformLayer)
3706 m_rootTransformLayer->addChild(layer); 3735 m_rootTransformLayer->addChild(layer);
3707 } 3736 }
3708 } 3737 }
3709 3738
3710 Element* WebViewImpl::focusedElement() const 3739 Element* WebViewImpl::focusedElement() const
3711 { 3740 {
3712 Frame* frame = m_page->focusController().focusedFrame(); 3741 Frame* frame = m_page->focusController().focusedFrame();
3713 if (!frame || !frame->isLocalFrame()) 3742 if (!frame || !frame->isLocalFrame())
3714 return 0; 3743 return 0;
3715 3744
3716 Document* document = toLocalFrame(frame)->document(); 3745 Document* document = toLocalFrame(frame)->document();
3717 if (!document) 3746 if (!document)
3718 return 0; 3747 return 0;
3719 3748
3720 return document->focusedElement(); 3749 return document->focusedElement();
3721 } 3750 }
3722 3751
3723 HitTestResult WebViewImpl::hitTestResultForWindowPos(const IntPoint& pos) 3752 HitTestResult WebViewImpl::hitTestResultForWindowPos(const IntPoint& pos)
3724 { 3753 {
3725 IntPoint docPoint(m_page->mainFrame()->view()->windowToContents(pos)); 3754 if (!m_page->mainFrame()->isLocalFrame())
3726 return m_page->mainFrame()->eventHandler().hitTestResultAtPoint(docPoint, Hi tTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ConfusingAndOf tenMisusedDisallowShadowContent); 3755 return HitTestResult();
3756 IntPoint docPoint(m_page->deprecatedLocalMainFrame()->view()->windowToConten ts(pos));
3757 return m_page->deprecatedLocalMainFrame()->eventHandler().hitTestResultAtPoi nt(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest: :ConfusingAndOftenMisusedDisallowShadowContent);
3727 } 3758 }
3728 3759
3729 void WebViewImpl::setTabsToLinks(bool enable) 3760 void WebViewImpl::setTabsToLinks(bool enable)
3730 { 3761 {
3731 m_tabsToLinks = enable; 3762 m_tabsToLinks = enable;
3732 } 3763 }
3733 3764
3734 bool WebViewImpl::tabsToLinks() const 3765 bool WebViewImpl::tabsToLinks() const
3735 { 3766 {
3736 return m_tabsToLinks; 3767 return m_tabsToLinks;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3814 3845
3815 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const 3846 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const
3816 { 3847 {
3817 return m_graphicsLayerFactory.get(); 3848 return m_graphicsLayerFactory.get();
3818 } 3849 }
3819 3850
3820 WebCore::RenderLayerCompositor* WebViewImpl::compositor() const 3851 WebCore::RenderLayerCompositor* WebViewImpl::compositor() const
3821 { 3852 {
3822 if (!page() 3853 if (!page()
3823 || !page()->mainFrame() 3854 || !page()->mainFrame()
3824 || !page()->mainFrame()->document() 3855 || !page()->mainFrame()->isLocalFrame()
3825 || !page()->mainFrame()->document()->renderView()) 3856 || !page()->deprecatedLocalMainFrame()->document()
3857 || !page()->deprecatedLocalMainFrame()->document()->renderView())
3826 return 0; 3858 return 0;
3827 return page()->mainFrame()->document()->renderView()->compositor(); 3859 return page()->deprecatedLocalMainFrame()->document()->renderView()->composi tor();
3828 } 3860 }
3829 3861
3830 void WebViewImpl::registerForAnimations(WebLayer* layer) 3862 void WebViewImpl::registerForAnimations(WebLayer* layer)
3831 { 3863 {
3832 if (m_layerTreeView) 3864 if (m_layerTreeView)
3833 m_layerTreeView->registerForAnimations(layer); 3865 m_layerTreeView->registerForAnimations(layer);
3834 } 3866 }
3835 3867
3836 WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() 3868 WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer()
3837 { 3869 {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
3908 // FIXME: It appears that only unittests, <webview> and android webv iew 3940 // FIXME: It appears that only unittests, <webview> and android webv iew
3909 // printing can hit this code. We should make them not hit this code and 3941 // printing can hit this code. We should make them not hit this code and
3910 // then delete this else clause and allowsBrokenNullLayerTreeView. 3942 // then delete this else clause and allowsBrokenNullLayerTreeView.
3911 // crbug.com/322276 and crbug.com/364716. 3943 // crbug.com/322276 and crbug.com/364716.
3912 ASSERT(m_client->allowsBrokenNullLayerTreeView()); 3944 ASSERT(m_client->allowsBrokenNullLayerTreeView());
3913 m_isAcceleratedCompositingActive = false; 3945 m_isAcceleratedCompositingActive = false;
3914 m_page->settings().setAcceleratedCompositingEnabled(false); 3946 m_page->settings().setAcceleratedCompositingEnabled(false);
3915 m_page->updateAcceleratedCompositingSettings(); 3947 m_page->updateAcceleratedCompositingSettings();
3916 } 3948 }
3917 } 3949 }
3918 if (page()) 3950 if (page() && page()->mainFrame()->isLocalFrame())
3919 page()->mainFrame()->view()->setClipsRepaints(!m_isAcceleratedCompositin gActive); 3951 page()->deprecatedLocalMainFrame()->view()->setClipsRepaints(!m_isAccele ratedCompositingActive);
3920 } 3952 }
3921 3953
3922 void WebViewImpl::updateMainFrameScrollPosition(const IntPoint& scrollPosition, bool programmaticScroll) 3954 void WebViewImpl::updateMainFrameScrollPosition(const IntPoint& scrollPosition, bool programmaticScroll)
3923 { 3955 {
3924 FrameView* frameView = page()->mainFrame()->view(); 3956 if (!page()->mainFrame()->isLocalFrame())
3957 return;
3958
3959 FrameView* frameView = page()->deprecatedLocalMainFrame()->view();
3925 if (!frameView) 3960 if (!frameView)
3926 return; 3961 return;
3927 3962
3928 if (frameView->scrollPosition() == scrollPosition) 3963 if (frameView->scrollPosition() == scrollPosition)
3929 return; 3964 return;
3930 3965
3931 bool oldProgrammaticScroll = frameView->inProgrammaticScroll(); 3966 bool oldProgrammaticScroll = frameView->inProgrammaticScroll();
3932 frameView->setInProgrammaticScroll(programmaticScroll); 3967 frameView->setInProgrammaticScroll(programmaticScroll);
3933 frameView->notifyScrollPositionChanged(scrollPosition); 3968 frameView->notifyScrollPositionChanged(scrollPosition);
3934 frameView->setInProgrammaticScroll(oldProgrammaticScroll); 3969 frameView->setInProgrammaticScroll(oldProgrammaticScroll);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
3996 4031
3997 void WebViewImpl::updateRootLayerTransform() 4032 void WebViewImpl::updateRootLayerTransform()
3998 { 4033 {
3999 // If we don't have a root graphics layer, we won't bother trying to find 4034 // If we don't have a root graphics layer, we won't bother trying to find
4000 // or update the transform layer. 4035 // or update the transform layer.
4001 if (!m_rootGraphicsLayer) 4036 if (!m_rootGraphicsLayer)
4002 return; 4037 return;
4003 4038
4004 // FIXME(bokan): m_rootTransformLayer is always set here in pinch virtual vi ewport. This can go away once 4039 // FIXME(bokan): m_rootTransformLayer is always set here in pinch virtual vi ewport. This can go away once
4005 // that's default everywhere. 4040 // that's default everywhere.
4006 if (!m_rootTransformLayer) 4041 if (!m_rootTransformLayer && m_page->mainFrame()->isLocalFrame())
4007 m_rootTransformLayer = m_page->mainFrame()->view()->renderView()->compos itor()->ensureRootTransformLayer(); 4042 m_rootTransformLayer = m_page->deprecatedLocalMainFrame()->view()->rende rView()->compositor()->ensureRootTransformLayer();
4008 4043
4009 if (m_rootTransformLayer) { 4044 if (m_rootTransformLayer) {
4010 WebCore::TransformationMatrix transform; 4045 WebCore::TransformationMatrix transform;
4011 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); 4046 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height);
4012 transform = transform.scale(m_rootLayerScale); 4047 transform = transform.scale(m_rootLayerScale);
4013 m_rootTransformLayer->setTransform(transform); 4048 m_rootTransformLayer->setTransform(transform);
4014 } 4049 }
4015 } 4050 }
4016 4051
4017 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) 4052 bool WebViewImpl::detectContentOnTouch(const WebPoint& position)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
4108 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4143 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4109 4144
4110 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4145 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4111 return false; 4146 return false;
4112 4147
4113 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4148 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4114 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4149 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4115 } 4150 }
4116 4151
4117 } // namespace blink 4152 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebPageSerializer.cpp ('k') | Source/web/tests/MHTMLTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698