| OLD | NEW |
| 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 if (WebFrame::opener() && !opener && m_client) | 649 if (WebFrame::opener() && !opener && m_client) |
| 650 m_client->didDisownOpener(this); | 650 m_client->didDisownOpener(this); |
| 651 | 651 |
| 652 WebFrame::setOpener(opener); | 652 WebFrame::setOpener(opener); |
| 653 | 653 |
| 654 ASSERT(m_frame); | 654 ASSERT(m_frame); |
| 655 if (m_frame && m_frame->document()) | 655 if (m_frame && m_frame->document()) |
| 656 m_frame->document()->initSecurityContext(); | 656 m_frame->document()->initSecurityContext(); |
| 657 } | 657 } |
| 658 | 658 |
| 659 // FIXME: These methods should move into WebFrame once FrameTree is no longer | |
| 660 // dependent on LocalFrame. | |
| 661 void WebLocalFrameImpl::appendChild(WebFrame* child) | |
| 662 { | |
| 663 WebFrame::appendChild(child); | |
| 664 frame()->tree().invalidateScopedChildCount(); | |
| 665 } | |
| 666 | |
| 667 void WebLocalFrameImpl::removeChild(WebFrame* child) | |
| 668 { | |
| 669 WebFrame::removeChild(child); | |
| 670 frame()->tree().invalidateScopedChildCount(); | |
| 671 } | |
| 672 | |
| 673 WebFrame* WebLocalFrameImpl::traversePrevious(bool wrap) const | |
| 674 { | |
| 675 if (!frame()) | |
| 676 return 0; | |
| 677 // FIXME: This should move to WebFrame and become local/remote agnostic. | |
| 678 Frame* prevFrame = frame()->tree().traversePreviousWithWrap(wrap); | |
| 679 if (!prevFrame || !prevFrame->isLocalFrame()) | |
| 680 return 0; | |
| 681 return fromFrame(toLocalFrame(prevFrame)); | |
| 682 } | |
| 683 | |
| 684 WebFrame* WebLocalFrameImpl::traverseNext(bool wrap) const | |
| 685 { | |
| 686 // FIXME: This should move to WebFrame and become local/remote agnostic. | |
| 687 if (!frame()) | |
| 688 return 0; | |
| 689 // FIXME: This should move to WebFrame and become local/remote agnostic. | |
| 690 Frame* nextFrame = frame()->tree().traverseNextWithWrap(wrap); | |
| 691 if (!nextFrame || !nextFrame->isLocalFrame()) | |
| 692 return 0; | |
| 693 return fromFrame(toLocalFrame(nextFrame)); | |
| 694 } | |
| 695 | |
| 696 WebFrame* WebLocalFrameImpl::findChildByName(const WebString& name) const | |
| 697 { | |
| 698 // FIXME: This should move to WebFrame and become local/remote agnostic. | |
| 699 if (!frame()) | |
| 700 return 0; | |
| 701 // FIXME: This should move to WebFrame and become local/remote agnostic. | |
| 702 Frame* child = frame()->tree().child(name); | |
| 703 if (!child || !child->isLocalFrame()) | |
| 704 return 0; | |
| 705 return fromFrame(toLocalFrame(child)); | |
| 706 } | |
| 707 | |
| 708 WebDocument WebLocalFrameImpl::document() const | 659 WebDocument WebLocalFrameImpl::document() const |
| 709 { | 660 { |
| 710 if (!frame() || !frame()->document()) | 661 if (!frame() || !frame()->document()) |
| 711 return WebDocument(); | 662 return WebDocument(); |
| 712 return WebDocument(frame()->document()); | 663 return WebDocument(frame()->document()); |
| 713 } | 664 } |
| 714 | 665 |
| 715 WebPerformance WebLocalFrameImpl::performance() const | 666 WebPerformance WebLocalFrameImpl::performance() const |
| 716 { | 667 { |
| 717 if (!frame()) | 668 if (!frame()) |
| (...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 frame()->view()->setInputEventsTransformForEmulation(m_inputEventsOffsetForE
mulation, m_inputEventsScaleFactorForEmulation); | 1681 frame()->view()->setInputEventsTransformForEmulation(m_inputEventsOffsetForE
mulation, m_inputEventsScaleFactorForEmulation); |
| 1731 | 1682 |
| 1732 if (isMainFrame) | 1683 if (isMainFrame) |
| 1733 webView->suppressInvalidations(false); | 1684 webView->suppressInvalidations(false); |
| 1734 } | 1685 } |
| 1735 | 1686 |
| 1736 WebLocalFrameImpl* WebLocalFrameImpl::fromFrame(LocalFrame* frame) | 1687 WebLocalFrameImpl* WebLocalFrameImpl::fromFrame(LocalFrame* frame) |
| 1737 { | 1688 { |
| 1738 if (!frame) | 1689 if (!frame) |
| 1739 return 0; | 1690 return 0; |
| 1740 FrameLoaderClient* client = frame->loader().client(); | 1691 return fromFrame(*frame); |
| 1692 } |
| 1693 |
| 1694 WebLocalFrameImpl* WebLocalFrameImpl::fromFrame(LocalFrame& frame) |
| 1695 { |
| 1696 FrameLoaderClient* client = frame.loader().client(); |
| 1741 if (!client || !client->isFrameLoaderClientImpl()) | 1697 if (!client || !client->isFrameLoaderClientImpl()) |
| 1742 return 0; | 1698 return 0; |
| 1743 return toFrameLoaderClientImpl(client)->webFrame(); | 1699 return toFrameLoaderClientImpl(client)->webFrame(); |
| 1744 } | 1700 } |
| 1745 | 1701 |
| 1746 WebLocalFrameImpl* WebLocalFrameImpl::fromFrameOwnerElement(Element* element) | 1702 WebLocalFrameImpl* WebLocalFrameImpl::fromFrameOwnerElement(Element* element) |
| 1747 { | 1703 { |
| 1748 // 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. | 1704 // 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. |
| 1749 if (!isHTMLFrameElementBase(element)) | 1705 if (!isHTMLFrameElementBase(element)) |
| 1750 return 0; | 1706 return 0; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 { | 1906 { |
| 1951 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host
, owner); | 1907 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host
, owner); |
| 1952 setWebCoreFrame(frame); | 1908 setWebCoreFrame(frame); |
| 1953 frame->tree().setName(name, fallbackName); | 1909 frame->tree().setName(name, fallbackName); |
| 1954 // May dispatch JS events; frame may be detached after this. | 1910 // May dispatch JS events; frame may be detached after this. |
| 1955 frame->init(); | 1911 frame->init(); |
| 1956 return frame; | 1912 return frame; |
| 1957 } | 1913 } |
| 1958 | 1914 |
| 1959 } // namespace blink | 1915 } // namespace blink |
| OLD | NEW |