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