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

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

Issue 338993003: Cleanup various WebView/WebFrame APIs to properly handle remote frames. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Throw in a call to relaxAdoptionRequirement 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 if (WebFrame::opener() && !opener && m_client) 648 if (WebFrame::opener() && !opener && m_client)
649 m_client->didDisownOpener(this); 649 m_client->didDisownOpener(this);
650 650
651 WebFrame::setOpener(opener); 651 WebFrame::setOpener(opener);
652 652
653 ASSERT(m_frame); 653 ASSERT(m_frame);
654 if (m_frame && m_frame->document()) 654 if (m_frame && m_frame->document())
655 m_frame->document()->initSecurityContext(); 655 m_frame->document()->initSecurityContext();
656 } 656 }
657 657
658 // FIXME: These methods should move into WebFrame once FrameTree is no longer
659 // dependent on LocalFrame.
660 void WebLocalFrameImpl::appendChild(WebFrame* child)
661 {
662 WebFrame::appendChild(child);
663 frame()->tree().invalidateScopedChildCount();
664 }
665
666 void WebLocalFrameImpl::removeChild(WebFrame* child)
667 {
668 WebFrame::removeChild(child);
669 frame()->tree().invalidateScopedChildCount();
670 }
671
672 WebFrame* WebLocalFrameImpl::traversePrevious(bool wrap) const
673 {
674 if (!frame())
675 return 0;
676 // FIXME: This should move to WebFrame and become local/remote agnostic.
677 Frame* prevFrame = frame()->tree().traversePreviousWithWrap(wrap);
678 if (!prevFrame || !prevFrame->isLocalFrame())
679 return 0;
680 return fromFrame(toLocalFrame(prevFrame));
681 }
682
683 WebFrame* WebLocalFrameImpl::traverseNext(bool wrap) const
684 {
685 // FIXME: This should move to WebFrame and become local/remote agnostic.
686 if (!frame())
687 return 0;
688 // FIXME: This should move to WebFrame and become local/remote agnostic.
689 Frame* nextFrame = frame()->tree().traverseNextWithWrap(wrap);
690 if (!nextFrame || !nextFrame->isLocalFrame())
691 return 0;
692 return fromFrame(toLocalFrame(nextFrame));
693 }
694
695 WebFrame* WebLocalFrameImpl::findChildByName(const WebString& name) const
696 {
697 // FIXME: This should move to WebFrame and become local/remote agnostic.
698 if (!frame())
699 return 0;
700 // FIXME: This should move to WebFrame and become local/remote agnostic.
701 Frame* child = frame()->tree().child(name);
702 if (!child || !child->isLocalFrame())
703 return 0;
704 return fromFrame(toLocalFrame(child));
705 }
706
707 WebDocument WebLocalFrameImpl::document() const 658 WebDocument WebLocalFrameImpl::document() const
708 { 659 {
709 if (!frame() || !frame()->document()) 660 if (!frame() || !frame()->document())
710 return WebDocument(); 661 return WebDocument();
711 return WebDocument(frame()->document()); 662 return WebDocument(frame()->document());
712 } 663 }
713 664
714 WebPerformance WebLocalFrameImpl::performance() const 665 WebPerformance WebLocalFrameImpl::performance() const
715 { 666 {
716 if (!frame()) 667 if (!frame())
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 frame()->view()->setInputEventsTransformForEmulation(m_inputEventsOffsetForE mulation, m_inputEventsScaleFactorForEmulation); 1680 frame()->view()->setInputEventsTransformForEmulation(m_inputEventsOffsetForE mulation, m_inputEventsScaleFactorForEmulation);
1730 1681
1731 if (isMainFrame) 1682 if (isMainFrame)
1732 webView->suppressInvalidations(false); 1683 webView->suppressInvalidations(false);
1733 } 1684 }
1734 1685
1735 WebLocalFrameImpl* WebLocalFrameImpl::fromFrame(LocalFrame* frame) 1686 WebLocalFrameImpl* WebLocalFrameImpl::fromFrame(LocalFrame* frame)
1736 { 1687 {
1737 if (!frame) 1688 if (!frame)
1738 return 0; 1689 return 0;
1739 FrameLoaderClient* client = frame->loader().client(); 1690 return fromFrame(*frame);
1691 }
1692
1693 WebLocalFrameImpl* WebLocalFrameImpl::fromFrame(LocalFrame& frame)
1694 {
1695 FrameLoaderClient* client = frame.loader().client();
1740 if (!client || !client->isFrameLoaderClientImpl()) 1696 if (!client || !client->isFrameLoaderClientImpl())
1741 return 0; 1697 return 0;
1742 return toFrameLoaderClientImpl(client)->webFrame(); 1698 return toFrameLoaderClientImpl(client)->webFrame();
1743 } 1699 }
1744 1700
1745 WebLocalFrameImpl* WebLocalFrameImpl::fromFrameOwnerElement(Element* element) 1701 WebLocalFrameImpl* WebLocalFrameImpl::fromFrameOwnerElement(Element* element)
1746 { 1702 {
1747 // FIXME: Why do we check specifically for <iframe> and <frame> here? Why ca n't we get the WebLocalFrameImpl from an <object> element, for example. 1703 // FIXME: Why do we check specifically for <iframe> and <frame> here? Why ca n't we get the WebLocalFrameImpl from an <object> element, for example.
1748 if (!isHTMLFrameElementBase(element)) 1704 if (!isHTMLFrameElementBase(element))
1749 return 0; 1705 return 0;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 { 1905 {
1950 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host , owner); 1906 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host , owner);
1951 setWebCoreFrame(frame); 1907 setWebCoreFrame(frame);
1952 frame->tree().setName(name, fallbackName); 1908 frame->tree().setName(name, fallbackName);
1953 // May dispatch JS events; frame may be detached after this. 1909 // May dispatch JS events; frame may be detached after this.
1954 frame->init(); 1910 frame->init();
1955 return frame; 1911 return frame;
1956 } 1912 }
1957 1913
1958 } // namespace blink 1914 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698