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

Unified Diff: ios/chrome/browser/reading_list/reading_list_distiller_page.mm

Issue 2695313004: [iOS Reading List] Add distilling WKWebView to the view hierarchy. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/reading_list/reading_list_distiller_page.mm
diff --git a/ios/chrome/browser/reading_list/reading_list_distiller_page.mm b/ios/chrome/browser/reading_list/reading_list_distiller_page.mm
index b456e9023ace45fc1f2090de465c9857b6027584..5e5feeec083b314cc6e856ee03b8e2d2a311ef97 100644
--- a/ios/chrome/browser/reading_list/reading_list_distiller_page.mm
+++ b/ios/chrome/browser/reading_list/reading_list_distiller_page.mm
@@ -72,6 +72,15 @@ void ReadingListDistillerPage::DistillPageImpl(const GURL& url,
FetchFavicon(url);
DistillerPageIOS::DistillPageImpl(url, script);
+
+ // Some pages require that the WKWebView is in the view hierarchy to be
marq (ping after 24h) 2017/02/16 14:28:18 I don't suppose there's any way to determine which
Olivier 2017/02/16 14:43:41 I don't think we can. But we can do it only on sec
wychen 2017/02/16 16:38:59 You mean if it distills nothing, then distill it a
Olivier 2017/02/16 20:02:27 We always try multiple time to distill as some net
wychen 2017/02/17 00:59:55 Makes sense. Thanks!
+ // rendered.
+ // Add the view and move it out of the screen.
+ CGRect frame = [[[UIApplication sharedApplication] keyWindow] frame];
+ frame.origin.x = 2 * std::max(frame.size.width, frame.size.height);
stkhapugin 2017/02/16 12:53:59 2 can be too small for iPad multitasking: if you s
Olivier 2017/02/16 13:04:18 I don't know if it prerendering is still done that
marq (ping after 24h) 2017/02/16 14:28:18 It might be safer to position the offscreen view i
Olivier 2017/02/16 14:43:41 Done.
+ [CurrentWebState()->GetView() setFrame:frame];
marq (ping after 24h) 2017/02/16 14:28:18 DCHECK that the webstate's view doesn't already ha
Olivier 2017/02/16 14:43:41 Done.
+ [[[UIApplication sharedApplication] keyWindow]
+ addSubview:CurrentWebState()->GetView()];
marq (ping after 24h) 2017/02/16 14:28:18 Maybe insert at index 0, so it's behind everything
Olivier 2017/02/16 14:43:40 Done.
}
void ReadingListDistillerPage::FetchFavicon(const GURL& page_url) {
@@ -88,6 +97,7 @@ void ReadingListDistillerPage::OnDistillationDone(const GURL& page_url,
const base::Value* value) {
std::unique_ptr<web::WebState> old_web_state = DetachWebState();
if (old_web_state) {
+ [old_web_state->GetView() removeFromSuperview];
web_state_dispatcher_->ReturnWebState(std::move(old_web_state));
}
DistillerPageIOS::OnDistillationDone(page_url, value);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698