⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 domwindow.cpp

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 CPP
📖 第 1 页 / 共 3 页
字号:
DOMSelection* DOMWindow::getSelection(){    if (!m_selection)        m_selection = DOMSelection::create(m_frame);    return m_selection.get();}Element* DOMWindow::frameElement() const{    if (!m_frame)        return 0;    return m_frame->ownerElement();}void DOMWindow::focus(){    if (!m_frame)        return;    m_frame->focusWindow();}void DOMWindow::blur(){    if (!m_frame)        return;    m_frame->unfocusWindow();}void DOMWindow::close(){    if (!m_frame)        return;    Page* page = m_frame->page();    if (!page)        return;    if (m_frame != page->mainFrame())        return;    Settings* settings = m_frame->settings();    bool allowScriptsToCloseWindows =        settings && settings->allowScriptsToCloseWindows();    if (m_frame->loader()->openedByDOM()        || m_frame->loader()->getHistoryLength() <= 1        || allowScriptsToCloseWindows)        m_frame->scheduleClose();}void DOMWindow::print(){    if (!m_frame)        return;    Page* page = m_frame->page();    if (!page)        return;    page->chrome()->print(m_frame);}void DOMWindow::stop(){    if (!m_frame)        return;    // We must check whether the load is complete asynchronously, because we might still be parsing    // the document until the callstack unwinds.    m_frame->loader()->stopForUserCancel(true);}void DOMWindow::alert(const String& message){    if (!m_frame)        return;    m_frame->document()->updateRendering();    Page* page = m_frame->page();    if (!page)        return;    page->chrome()->runJavaScriptAlert(m_frame, message);}bool DOMWindow::confirm(const String& message){    if (!m_frame)        return false;    m_frame->document()->updateRendering();    Page* page = m_frame->page();    if (!page)        return false;    return page->chrome()->runJavaScriptConfirm(m_frame, message);}String DOMWindow::prompt(const String& message, const String& defaultValue){    if (!m_frame)        return String();    m_frame->document()->updateRendering();    Page* page = m_frame->page();    if (!page)        return String();    String returnValue;    if (page->chrome()->runJavaScriptPrompt(m_frame, message, defaultValue, returnValue))        return returnValue;    return String();}bool DOMWindow::find(const String& string, bool caseSensitive, bool backwards, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/) const{    if (!m_frame)        return false;    // FIXME (13016): Support wholeWord, searchInFrames and showDialog    return m_frame->findString(string, !backwards, caseSensitive, wrap, false);}bool DOMWindow::offscreenBuffering() const{    return true;}int DOMWindow::outerHeight() const{    if (!m_frame)        return 0;    Page* page = m_frame->page();    if (!page)        return 0;    return static_cast<int>(page->chrome()->windowRect().height());}int DOMWindow::outerWidth() const{    if (!m_frame)        return 0;    Page* page = m_frame->page();    if (!page)        return 0;    return static_cast<int>(page->chrome()->windowRect().width());}int DOMWindow::innerHeight() const{    if (!m_frame)        return 0;    FrameView* view = m_frame->view();    if (!view)        return 0;        return static_cast<int>(view->height() / m_frame->pageZoomFactor());}int DOMWindow::innerWidth() const{    if (!m_frame)        return 0;    FrameView* view = m_frame->view();    if (!view)        return 0;    return static_cast<int>(view->width() / m_frame->pageZoomFactor());}int DOMWindow::screenX() const{    if (!m_frame)        return 0;    Page* page = m_frame->page();    if (!page)        return 0;    return static_cast<int>(page->chrome()->windowRect().x());}int DOMWindow::screenY() const{    if (!m_frame)        return 0;    Page* page = m_frame->page();    if (!page)        return 0;    return static_cast<int>(page->chrome()->windowRect().y());}int DOMWindow::scrollX() const{    if (!m_frame)        return 0;    FrameView* view = m_frame->view();    if (!view)        return 0;    m_frame->document()->updateLayoutIgnorePendingStylesheets();    return static_cast<int>(view->scrollX() / m_frame->pageZoomFactor());}int DOMWindow::scrollY() const{    if (!m_frame)        return 0;    FrameView* view = m_frame->view();    if (!view)        return 0;    m_frame->document()->updateLayoutIgnorePendingStylesheets();    return static_cast<int>(view->scrollY() / m_frame->pageZoomFactor());}bool DOMWindow::closed() const{    return !m_frame;}unsigned DOMWindow::length() const{    if (!m_frame)        return 0;    return m_frame->tree()->childCount();}String DOMWindow::name() const{    if (!m_frame)        return String();    return m_frame->tree()->name();}void DOMWindow::setName(const String& string){    if (!m_frame)        return;    m_frame->tree()->setName(string);}String DOMWindow::status() const{    if (!m_frame)        return String();    return m_frame->jsStatusBarText();}void DOMWindow::setStatus(const String& string) {     if (!m_frame)         return;     m_frame->setJSStatusBarText(string); }     String DOMWindow::defaultStatus() const{    if (!m_frame)        return String();    return m_frame->jsDefaultStatusBarText();} void DOMWindow::setDefaultStatus(const String& string) {     if (!m_frame)         return;     m_frame->setJSDefaultStatusBarText(string);}DOMWindow* DOMWindow::self() const{    if (!m_frame)        return 0;    return m_frame->domWindow();}DOMWindow* DOMWindow::opener() const{    if (!m_frame)        return 0;    Frame* opener = m_frame->loader()->opener();    if (!opener)        return 0;    return opener->domWindow();}DOMWindow* DOMWindow::parent() const{    if (!m_frame)        return 0;    Frame* parent = m_frame->tree()->parent(true);    if (parent)        return parent->domWindow();    return m_frame->domWindow();}DOMWindow* DOMWindow::top() const{    if (!m_frame)        return 0;    Page* page = m_frame->page();    if (!page)        return 0;    return m_frame->tree()->top(true)->domWindow();}Document* DOMWindow::document() const{    if (!m_frame)        return 0;    ASSERT(m_frame->document());    return m_frame->document();}PassRefPtr<CSSStyleDeclaration> DOMWindow::getComputedStyle(Element* elt, const String&) const{    if (!elt)        return 0;    // FIXME: This needs take pseudo elements into account.    return computedStyle(elt);}PassRefPtr<CSSRuleList> DOMWindow::getMatchedCSSRules(Element* elt, const String& pseudoElt, bool authorOnly) const{    if (!m_frame)        return 0;    Document* doc = m_frame->document();    if (!pseudoElt.isEmpty())        return doc->styleSelector()->pseudoStyleRulesForElement(elt, pseudoElt, authorOnly);    return doc->styleSelector()->styleRulesForElement(elt, authorOnly);}PassRefPtr<WebKitPoint> DOMWindow::webkitConvertPointFromNodeToPage(Node* node, const WebKitPoint* p) const{    if (!node || !p)        return 0;            FloatPoint pagePoint(p->x(), p->y());    pagePoint = node->convertToPage(pagePoint);    return WebKitPoint::create(pagePoint.x(), pagePoint.y());}PassRefPtr<WebKitPoint> DOMWindow::webkitConvertPointFromPageToNode(Node* node, const WebKitPoint* p) const{    if (!node || !p)        return 0;            FloatPoint nodePoint(p->x(), p->y());    nodePoint = node->convertFromPage(nodePoint);    return WebKitPoint::create(nodePoint.x(), nodePoint.y());}double DOMWindow::devicePixelRatio() const{    if (!m_frame)        return 0.0;    Page* page = m_frame->page();    if (!page)        return 0.0;    return page->chrome()->scaleFactor();}#if ENABLE(DATABASE)PassRefPtr<Database> DOMWindow::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, ExceptionCode& ec){    if (!m_frame)        return 0;    Document* doc = m_frame->document();    Settings* settings = m_frame->settings();    if (!settings || !settings->databasesEnabled())        return 0;    return Database::openDatabase(doc, name, version, displayName, estimatedSize, ec);}#endifvoid DOMWindow::scrollBy(int x, int y) const

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -