Commit 568ef6c3 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Change the computation of the PDF insets

This CL changes how the computation of the content insets of the scroll
view displaying the PDF is done on iOS 11.

Bug: 903635
Change-Id: I5dc8d69b4fbf0a6e68db1481f1991c9bdbc0b43b
Reviewed-on: https://chromium-review.googlesource.com/c/1341988
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609510}
parent 93244ca3
...@@ -3671,9 +3671,15 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint ...@@ -3671,9 +3671,15 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint
- (CGFloat)overscrollActionsControllerHeaderInset: - (CGFloat)overscrollActionsControllerHeaderInset:
(OverscrollActionsController*)controller { (OverscrollActionsController*)controller {
if (controller == [[[self tabModel] currentTab] overscrollActionsController]) if (controller ==
return self.headerHeight; [[[self tabModel] currentTab] overscrollActionsController]) {
else if (!base::ios::IsRunningOnIOS12OrLater() &&
self.currentWebState->GetContentsMimeType() == "application/pdf") {
return self.headerHeight - self.view.safeAreaInsets.top;
} else {
return self.headerHeight;
}
} else
return 0; return 0;
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#import "ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_web_view_resizer.h"
#include "base/ios/ios_util.h"
#include "ios/chrome/browser/chrome_url_constants.h" #include "ios/chrome/browser/chrome_url_constants.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_model.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_model.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h"
...@@ -112,6 +113,9 @@ ...@@ -112,6 +113,9 @@
CRWWebViewScrollViewProxy* scrollViewProxy = webViewProxy.scrollViewProxy; CRWWebViewScrollViewProxy* scrollViewProxy = webViewProxy.scrollViewProxy;
if (self.webState->GetContentsMimeType() == "application/pdf") { if (self.webState->GetContentsMimeType() == "application/pdf") {
if (!base::ios::IsRunningOnIOS12OrLater()) {
insets.top -= webView.safeAreaInsets.top;
}
scrollViewProxy.contentInset = insets; scrollViewProxy.contentInset = insets;
if (!CGRectEqualToRect(webView.frame, webView.superview.bounds)) { if (!CGRectEqualToRect(webView.frame, webView.superview.bounds)) {
webView.frame = webView.superview.bounds; webView.frame = webView.superview.bounds;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment