Home | History | Annotate | Download | only in web

Lines Matching refs:frame

36 // WebView (for the toplevel frame only)
64 // Calling it will bring about the release and finalization of the frame object,
70 // The main frame is never destroyed and is re-used. The FrameLoader is re-used
71 // and a reference to the main frame is kept by the Page.
73 // When frame content is replaced, all subframes are destroyed. This happens
78 // LocalFrame, and also notifies the embedder via WebFrameClient that the frame is
114 #include "core/frame/Console.h"
115 #include "core/frame/LocalDOMWindow.h"
116 #include "core/frame/FrameHost.h"
117 #include "core/frame/FrameView.h"
118 #include "core/frame/Settings.h"
220 static void frameContentAsPlainText(size_t maxChars, LocalFrame* frame, StringBuilder& output)
222 Document* document = frame->document();
226 if (!frame->view())
251 const FrameTree& frameTree = frame->tree();
252 for (Frame* curChild = frameTree.firstChild(); curChild; curChild = curChild->tree().nextSibling()) {
265 // Make sure the frame separator won't fill up the buffer, and give up if
280 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame* frame)
282 if (!frame)
284 if (!frame->document() || !frame->document()->isPluginDocument())
286 PluginDocument* pluginDocument = toPluginDocument(frame->document());
290 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromNode(LocalFrame* frame, const WebNode& node)
292 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame);
303 ChromePrintContext(LocalFrame* frame)
304 : PrintContext(frame)
328 frame()->view()->updateLayoutAndStyleForPainting();
334 if (!frame()->document() || !frame()->view() || !frame()->document()->renderView())
337 frame()->view()->updateLayoutAndStyleForPainting();
378 // Spools the printed page, a subrect of frame(). Skip the scale step.
394 frame()->view()->paintContents(&context, pageRect);
395 outputLinkAndLinkedDestinations(context, frame()->document(), pageRect);
406 // the frame hosts a plugin that supports custom printing. In this case, we
410 ChromePluginPrintContext(LocalFrame* frame, WebPluginContainerImpl* plugin, const WebPrintParams& printParams)
411 : ChromePrintContext(frame), m_plugin(plugin), m_printParams(printParams)
444 // Spools the printed page, a subrect of frame(). Skip the scale step.
523 return frame()->tree().uniqueName();
528 return frame()->tree().name();
533 frame()->tree().setName(name);
540 if (frame()->loader().state() == FrameStateComplete)
541 return frame()->document()->iconURLs(iconTypesMask);
549 client()->initializeChildFrame(frame()->view()->frameRect(), frame()->view()->visibleContentScaleFactor());
554 if (!frame())
557 frame()->setRemotePlatformLayer(webLayer);
609 if (RenderPart* renderer = frame()->ownerRenderer()) {
628 return frame() && frame()->view() && frame()->view()->horizontalScrollbar();
633 return frame() && frame()->view() && frame()->view()->verticalScrollbar();
656 if (!frame() || !frame()->document())
658 return WebDocument(frame()->document());
663 if (!frame())
665 return WebPerformance(&frame()->domWindow()->performance());
670 if (!frame())
672 return frame()->loader().shouldClose();
677 if (!frame())
679 frame()->loader().closeURL();
684 if (!frame())
686 return frame()->script().windowScriptNPObject();
696 if (!frame() || !frame()->script().canExecuteScripts(NotAboutToExecuteScript))
698 frame()->script().bindToWindowObject(frame(), String(name), object);
703 ASSERT(frame());
705 v8::HandleScope handleScope(toIsolate(frame()));
706 frame()->script().executeScriptInMainWorld(ScriptSourceCode(source.code, source.url, position));
711 ASSERT(frame());
721 v8::HandleScope handleScope(toIsolate(frame()));
722 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensionGroup, 0);
727 ASSERT(frame());
733 ASSERT(frame());
739 ASSERT(frame());
745 ASSERT(frame());
766 frame()->document()->addConsoleMessage(ConsoleMessage::create(OtherMessageSource, webCoreMessageLevel, message.text));
771 if (!frame())
773 if (!frame()->settings()->scriptEnabled())
780 ASSERT(frame());
781 return frame()->loader().mixedContentChecker()->canFrameInsecureContent(frame()->document()->securityOrigin(), url);
786 ASSERT(frame());
789 return frame()->script().executeScriptInMainWorldAndReturnValue(ScriptSourceCode(source.code, source.url, position));
794 ASSERT(frame());
807 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensionGroup, &scriptResults);
810 v8Results[i] = v8::Local<v8::Value>::New(toIsolate(frame()), scriptResults[i]);
813 v8::HandleScope handleScope(toIsolate(frame()));
814 frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensionGroup, 0);
820 ASSERT(frame());
821 return frame()->script().callFunction(function, receiver, argc, argv);
826 return toV8Context(frame(), DOMWrapperWorld::mainWorld());
831 ASSERT(frame());
832 frame()->loader().reload(ignoreCache ? EndToEndReload : NormalReload);
837 ASSERT(frame());
838 frame()->loader().reload(ignoreCache ? EndToEndReload : NormalReload, overrideUrl);
843 ASSERT(frame());
852 frame()->loader().load(FrameLoadRequest(0, resourceRequest));
857 ASSERT(frame());
860 frame()->loader().loadHistoryItem(historyItem.get(), static_cast<HistoryLoadType>(loadType), static_cast<ResourceRequestCachePolicy>(cachePolicy));
865 ASSERT(frame());
874 if (replace && !unreachableURL.isEmpty() && frame()->loader().provisionalDocumentLoader())
875 request = frame()->loader().provisionalDocumentLoader()->originalRequest();
881 frame()->loader().load(frameRequest);
886 ASSERT(frame());
892 if (!frame())
896 frame()->loader().stopAllLoaders();
901 ASSERT(frame());
904 DocumentLoader* documentLoader = frame()->loader().provisionalDocumentLoader();
906 documentLoader = frame()->loader().policyDocumentLoader();
913 ASSERT(frame());
914 return DataSourceForDocLoader(frame()->loader().documentLoader());
919 if (frame())
920 frame()->setInViewSourceMode(enable);
925 if (!frame())
927 return frame()->inViewSourceMode();
932 String referrer = referrerURL.isEmpty() ? frame()->document()->outgoingReferrer() : String(referrerURL.spec().utf16());
933 referrer = SecurityPolicy::generateReferrerHeader(frame()->document()->referrerPolicy(), request.url(), referrer);
936 request.setHTTPReferrer(referrer, static_cast<WebReferrerPolicy>(frame()->document()->referrerPolicy()));
942 frame()->loader().client()->dispatchWillSendRequest(0, 0, request.toMutableResourceRequest(), response);
952 return frame()->domWindow()->pendingUnloadEventListeners();
959 frame()->editor().replaceSelectionWithText(text, selectReplacement, smartReplace);
964 if (frame()->inputMethodController().hasComposition())
965 frame()->inputMethodController().confirmComposition(text);
967 frame()->editor().insertText(text, 0);
973 frame()->inputMethodController().setComposition(text, decorations, location, length);
978 frame()->inputMethodController().cancelComposition();
983 return frame()->inputMethodController().hasComposition();
988 return frame()->inputMethodController().compositionRange();
996 Element* editable = frame()->selection().rootEditableElementOrDocumentElement();
1001 IntRect intRect = frame()->editor().firstRectForRange(range.get());
1003 rect = frame()->view()->contentsToWindow(rect);
1009 if (!frame())
1012 IntPoint point = frame()->view()->windowToContents(webPoint);
1013 HitTestResult result = frame()->eventHandler().hitTestResultAtPoint(point, HitTestRequest::ReadOnly | HitTestRequest::Active);
1014 RefPtrWillBeRawPtr<Range> range = frame()->rangeForPoint(result.roundedPointInInnerNodeFrame());
1017 Element* editable = frame()->selection().rootEditableElementOrDocumentElement();
1024 ASSERT(frame());
1040 WebPluginContainerImpl* pluginContainer = pluginContainerFromNode(frame(), node);
1044 return frame()->editor().executeCommand(command);
1049 ASSERT(frame());
1051 WebPluginContainerImpl* pluginContainer = pluginContainerFromNode(frame(), node);
1055 return frame()->editor().executeCommand(name, value);
1060 ASSERT(frame());
1061 return frame()->editor().command(name).isEnabled();
1068 frame()->spellChecker().toggleContinuousSpellChecking();
1073 return frame()->spellChecker().isContinuousSpellCheckingEnabled();
1080 frame()->spellChecker().requestTextChecking(*webElement.constUnwrap<Element>());
1086 if (pluginContainerFromFrame(frame()))
1088 frame()->spellChecker().replaceMisspelledRange(text);
1093 frame()->spellChecker().removeSpellingMarkers();
1098 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame());
1102 // frame()->selection()->isNone() never returns true.
1103 return frame()->selection().start() != frame()->selection().end();
1108 return frame()->selection().toNormalizedRange();
1113 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame());
1117 RefPtrWillBeRawPtr<Range> range = frame()->selection().toNormalizedRange();
1131 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame());
1135 RefPtrWillBeRawPtr<Range> range = frame()->selection().toNormalizedRange();
1142 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosition position)
1148 frame->selection().setSelection(selection, granularity);
1153 FrameSelection& selection = frame()->selection();
1156 selectWordAroundPosition(frame(), selection.selection().visibleStart());
1168 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered);
1176 frame()->selection().setSelection(newSelection, CharacterGranularity);
1181 Element* editable = frame()->selection().rootEditableElement();
1186 frame()->selection().moveTo(position, UserTriggered);
1191 return frame()->inputMethodController().setEditableSelectionOffsets(PlainTextRange(start, end));
1196 if (!frame()->editor().canEdit())
1199 InputMethodController& inputMethodController = frame()->inputMethodController();
1216 frame()->inputMethodController().extendSelectionAndDelete(before, after);
1221 frame()->selection().setCaretVisible(visible);
1228 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport();
1234 HitTestResult result(frame()->view()->windowToContents(roundedIntPoint(unscaledPoint)));
1235 frame()->document()->renderView()->layer()->hitTest(request, result);
1238 return frame()->selection().selection().visiblePositionRespectingEditingBoundary(result.localPoint(), node);
1244 WebPluginContainerImpl* container = WebLocalFrameImpl::pluginContainerFromNode(frame(), WebNode(frame()->document()->focusedElement()));
1252 ASSERT(!frame()->document()->isFrameSet());
1257 pluginContainer = pluginContainerFromFrame(frame());
1264 m_printContext = adoptPtrWillBeNoop(new ChromePluginPrintContext(frame(), pluginContainer, printParams));
1266 m_printContext = adoptPtrWillBeNoop(new ChromePrintContext(frame()));
1287 ASSERT(m_printContext && page >= 0 && frame() && frame()->document());
1306 WebPluginContainerImpl* pluginContainer = node.isNull() ? pluginContainerFromFrame(frame()) : toWebPluginContainerImpl(node.pluginContainer());
1316 WebPluginContainerImpl* pluginContainer = node.isNull() ? pluginContainerFromFrame(frame()) : toWebPluginContainerImpl(node.pluginContainer());
1326 return frame()->document()->styleForPage(pageIndex)->pageSizeType() != PAGE_SIZE_AUTO;
1331 return frame()->document()->isPageBoxVisible(pageIndex);
1337 frame()->document()->pageSizeAndMarginsInPixels(pageIndex, size, marginTop, marginRight, marginBottom, marginLeft);
1344 return m_printContext->pageProperty(frame(), propertyName.utf8().data(), pageIndex);
1387 frame()->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, nullptr);
1433 if (!frame())
1436 frameContentAsPlainText(maxChars, frame(), text);
1442 if (!frame())
1444 return createMarkup(frame()->document());
1457 return externalRepresentation(frame(), behavior);
1477 return hasSelection() ? WebRect(IntRect(frame()->selection().bounds())) : WebRect();
1482 if (!frame())
1484 return frame()->spellChecker().selectionStartHasSpellingMarkerFor(from, length);
1489 if (!frame())
1492 return WebString(frame()->layerTreeAsText(showDebugInfo ? LayerTreeIncludesDebugInfo : LayerTreeNormal));
1504 WebLocalFrameImpl* frame = new WebLocalFrameImpl(client);
1506 return frame;
1508 return adoptRef(frame).leakRef();
1546 void WebLocalFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<LocalFrame> frame)
1548 m_frame = frame;
1550 // FIXME: we shouldn't add overhead to every frame by registering these objects when they're not used.
1571 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host, owner);
1572 setCoreFrame(frame);
1573 frame->tree().setName(name, fallbackName);
1575 // during init(). Note that this may dispatch JS events; the frame may be
1577 frame->init();
1578 return frame;
1592 RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(frame()->host(), ownerElement, request.frameName(), ownerElement->getAttribute(ownerElement->subResourceAttributeName()));
1593 // Initializing the core frame may cause the new child to be detached, since
1599 // of this child frame with whatever was there at that point.
1601 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->document()->loadEventFinished())
1610 // onload, so it is possible for the child frame to have already been
1619 // This is only possible on the main frame.
1630 ASSERT(frame()); // If frame() doesn't exist, we probably didn't init properly.
1633 bool isLocalRoot = frame()->isLocalRoot();
1637 frame()->createView(webView->size(), webView->baseBackgroundColor(), webView->isTransparent());
1639 frame()->view()->enableAutoSizeMode(webView->minAutoSize(), webView->maxAutoSize());
1641 frame()->view()->setInputEventsTransformForEmulation(m_inputEventsOffsetForEmulation, m_inputEventsScaleFactorForEmulation);
1647 WebLocalFrameImpl* WebLocalFrameImpl::fromFrame(LocalFrame* frame)
1649 if (!frame)
1651 return fromFrame(*frame);
1654 WebLocalFrameImpl* WebLocalFrameImpl::fromFrame(LocalFrame& frame)
1656 FrameLoaderClient* client = frame.loader().client();
1664 // FIXME: Why do we check specifically for <iframe> and <frame> here? Why can't we get the WebLocalFrameImpl from an <object> element, for example.
1672 if (!frame())
1674 return WebViewImpl::fromPage(frame()->page());
1697 VisibleSelection selection(frame()->selection().selection());
1702 frame()->document()->updateLayoutIgnorePendingStylesheets();
1720 frame()->selection().setSelection(VisibleSelection(activeMatch));
1721 frame()->document()->setFocusedElement(element);
1735 frame()->document()->setFocusedElement(element);
1745 frame()->selection().setSelection(VisibleSelection(activeMatch));
1746 frame()->document()->setFocusedElement(nullptr);
1771 frame()->view()->setCanHaveScrollbars(canHaveScrollbars);
1778 if (frame()->view())
1779 frame()->view()->setInputEventsTransformForEmulation(m_inputEventsOffsetForEmulation, m_inputEventsScaleFactorForEmulation);
1792 if (!frame()->document() || !frame()->page())
1795 RefPtrWillBeRawPtr<Document> ownerDocument(frame()->document());
1798 if (SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(frame()->document()->url().protocol()))
1803 v8::HandleScope handleScope(toIsolate(frame()));
1804 v8::Local<v8::Value> result = frame()->script().executeScriptInMainWorldAndReturnValue(ScriptSourceCode(script));
1808 if (!frame()->navigationScheduler().locationChangePending())
1809 frame()->loader().replaceDocumentWhileExecutingJavaScriptURL(scriptResult, ownerDocument.get());
1814 ASSERT(frame());
1822 if (!frame() || !frame()->document())
1824 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || !frame()->document()->loadEventFinished();
1829 if (!frame() || !frame()->document())
1831 return frame()->document()->fetcher()->requestCount();
1836 RefPtrWillBeRawPtr<Element> styleElement = frame()->document()->createElement(HTMLNames::linkTag, false);
1842 frame()->document()->head()->appendChild(styleElement.release(), IGNORE_EXCEPTION);
1848 frame()->loader().forceSandboxFlags(SandboxAll);
1854 if (!frame())
1858 if (ScreenOrientationController::from(*frame()))
1859 ScreenOrientationController::from(*frame())->notifyOrientationChanged();
1862 if (RuntimeEnabledFeatures::orientationEventEnabled() && frame()->domWindow())
1863 frame()->domWindow()->dispatchEvent(Event::create(EventTypeNames::orientationchange));
1882 // There is a possibility that the frame being detached was the only
1916 ASSERT(frame() && frame()->view());
1917 FrameView* view = frame()->view();
1926 ASSERT(frame() && frame()->view());
1927 FrameView* view = frame()->view();