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 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1692 if (!webframe_child) | 1692 if (!webframe_child) |
1693 return nullptr; | 1693 return nullptr; |
1694 | 1694 |
1695 webframe_child->InitializeCoreFrame(*GetFrame()->GetPage(), owner_element, | 1695 webframe_child->InitializeCoreFrame(*GetFrame()->GetPage(), owner_element, |
1696 name); | 1696 name); |
1697 // Initializing the core frame may cause the new child to be detached, since | 1697 // Initializing the core frame may cause the new child to be detached, since |
1698 // it may dispatch a load event in the parent. | 1698 // it may dispatch a load event in the parent. |
1699 if (!webframe_child->Parent()) | 1699 if (!webframe_child->Parent()) |
1700 return nullptr; | 1700 return nullptr; |
1701 | 1701 |
1702 // If we're moving in the back/forward list, we might want to replace the | 1702 FrameLoadRequest new_request = request; |
1703 // content of this child frame with whatever was there at that point. | 1703 FrameLoadType child_load_type = kFrameLoadTypeStandard; |
1704 HistoryItem* child_item = nullptr; | 1704 HistoryItem* child_item = nullptr; |
1705 if (IsBackForwardLoadType( | |
1706 GetFrame()->Loader().GetDocumentLoader()->LoadType()) && | |
1707 !GetFrame()->GetDocument()->LoadEventFinished()) | |
1708 child_item = webframe_child->Client()->HistoryItemForNewChildFrame(); | |
1709 | 1705 |
1710 FrameLoadRequest new_request = request; | 1706 if (!GetFrame()->GetDocument()->LoadEventFinished()) { |
1711 FrameLoadType load_type = kFrameLoadTypeStandard; | 1707 FrameLoadType load_type = |
1712 if (child_item) { | 1708 GetFrame()->Loader().GetDocumentLoader()->LoadType(); |
1713 new_request = FrameLoadRequest( | 1709 switch (load_type) { |
1714 request.OriginDocument(), child_item->GenerateResourceRequest( | 1710 case kFrameLoadTypeStandard: |
1715 WebCachePolicy::kUseProtocolCachePolicy)); | 1711 case kFrameLoadTypeReplaceCurrentItem: |
1716 load_type = kFrameLoadTypeInitialHistoryLoad; | 1712 case kFrameLoadTypeInitialHistoryLoad: |
1713 break; | |
1714 | |
1715 // If we're moving in the back/forward list, we might want to replace the | |
1716 // content of this child frame with whatever was there at that point. | |
1717 case kFrameLoadTypeBackForward: | |
1718 case kFrameLoadTypeInitialInChildFrame: | |
Charlie Reis
2017/05/06 00:08:56
This looks wrong to me. Why is kFrameLoadTypeInit
arthursonzogni
2017/05/09 12:49:05
You are right. I made an error. The two case shoul
| |
1719 child_load_type = kFrameLoadTypeInitialHistoryLoad; | |
1720 child_item = webframe_child->Client()->HistoryItemForNewChildFrame(); | |
1721 new_request = | |
1722 FrameLoadRequest(request.OriginDocument(), | |
1723 child_item->GenerateResourceRequest( | |
1724 WebCachePolicy::kUseProtocolCachePolicy)); | |
1725 break; | |
1726 | |
1727 // If we're in a middle of a reload. The FrameLoadType is propagated to | |
1728 // its children only if it is a ReloadByPassingCache, else it becomes a | |
1729 // standard load. | |
1730 case kFrameLoadTypeReload: | |
1731 break; | |
1732 case kFrameLoadTypeReloadBypassingCache: | |
1733 child_load_type = kFrameLoadTypeReloadBypassingCache; | |
1734 new_request.GetResourceRequest().SetCachePolicy( | |
1735 WebCachePolicy::kBypassingCache); | |
1736 break; | |
1737 } | |
1717 } | 1738 } |
1718 webframe_child->GetFrame()->Loader().Load(new_request, load_type, child_item); | 1739 |
1740 webframe_child->GetFrame()->Loader().Load(new_request, child_load_type, | |
1741 child_item); | |
1719 | 1742 |
1720 // Note a synchronous navigation (about:blank) would have already processed | 1743 // Note a synchronous navigation (about:blank) would have already processed |
1721 // onload, so it is possible for the child frame to have already been | 1744 // onload, so it is possible for the child frame to have already been |
1722 // detached by script in the page. | 1745 // detached by script in the page. |
1723 if (!webframe_child->Parent()) | 1746 if (!webframe_child->Parent()) |
1724 return nullptr; | 1747 return nullptr; |
1725 return webframe_child->GetFrame(); | 1748 return webframe_child->GetFrame(); |
1726 } | 1749 } |
1727 | 1750 |
1728 void WebLocalFrameImpl::DidChangeContentsSize(const IntSize& size) { | 1751 void WebLocalFrameImpl::DidChangeContentsSize(const IntSize& size) { |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2573 TextCheckerClient& WebLocalFrameImpl::GetTextCheckerClient() const { | 2596 TextCheckerClient& WebLocalFrameImpl::GetTextCheckerClient() const { |
2574 return *text_checker_client_; | 2597 return *text_checker_client_; |
2575 } | 2598 } |
2576 | 2599 |
2577 void WebLocalFrameImpl::SetTextCheckClient( | 2600 void WebLocalFrameImpl::SetTextCheckClient( |
2578 WebTextCheckClient* text_check_client) { | 2601 WebTextCheckClient* text_check_client) { |
2579 text_check_client_ = text_check_client; | 2602 text_check_client_ = text_check_client; |
2580 } | 2603 } |
2581 | 2604 |
2582 } // namespace blink | 2605 } // namespace blink |
OLD | NEW |