PDFPlugin: Update scrollbars if PDFLayerController's display mode changes
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Jan 2013 02:19:23 +0000 (02:19 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Jan 2013 02:19:23 +0000 (02:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108412
<rdar://problem/13002261>

Reviewed by Simon Fraser.

* WebProcess/Plugins/PDF/PDFLayerControllerDetails.h: Add pdfLayerController:didChangeDisplayMode:
* WebProcess/Plugins/PDF/PDFPlugin.h: Add notifyDisplayModeChanged().
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(-[WKPDFLayerControllerDelegate pdfLayerController:didChangeDisplayMode:]): Forward didChangeDisplayMode to notifyDisplayModeChanged.
(WebKit::PDFPlugin::notifyDisplayModeChanged): Update content size and scrollbar size when display mode changes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141359 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/PDF/PDFLayerControllerDetails.h
Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h
Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm

index 292e7ac..61e16df 100644 (file)
@@ -1,3 +1,17 @@
+2013-01-30  Tim Horton  <timothy_horton@apple.com>
+
+        PDFPlugin: Update scrollbars if PDFLayerController's display mode changes
+        https://bugs.webkit.org/show_bug.cgi?id=108412
+        <rdar://problem/13002261>
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/Plugins/PDF/PDFLayerControllerDetails.h: Add pdfLayerController:didChangeDisplayMode:
+        * WebProcess/Plugins/PDF/PDFPlugin.h: Add notifyDisplayModeChanged().
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (-[WKPDFLayerControllerDelegate pdfLayerController:didChangeDisplayMode:]): Forward didChangeDisplayMode to notifyDisplayModeChanged.
+        (WebKit::PDFPlugin::notifyDisplayModeChanged): Update content size and scrollbar size when display mode changes.
+
 2013-01-30  Alexey Proskuryakov  <ap@apple.com>
 
         <rdar://problem/12695827> PPT: Make loading file URLs work with a sandboxed NetworkProcess
index 8cb8d0a..7454af3 100644 (file)
@@ -37,6 +37,7 @@
 - (void)pdfLayerController:(PDFLayerController *)pdfLayerController didChangeActiveAnnotation:(PDFAnnotation *)annotation;
 - (void)pdfLayerController:(PDFLayerController *)pdfLayerController clickedLinkWithURL:(NSURL *)url;
 - (void)pdfLayerController:(PDFLayerController *)pdfLayerController didChangeContentScaleFactor:(CGFloat)scaleFactor;
+- (void)pdfLayerController:(PDFLayerController *)pdfLayerController didChangeDisplayMode:(int)mode;
 
 @end
 
index cc54fd0..02ba9a0 100644 (file)
@@ -70,6 +70,7 @@ public:
     
     using ScrollableArea::notifyScrollPositionChanged;
     void notifyContentScaleFactorChanged(CGFloat scaleFactor);
+    void notifyDisplayModeChanged(int);
 
     void clickedLink(NSURL *);
     void saveToPDF();
index 94a7d00..a952b86 100644 (file)
@@ -187,6 +187,11 @@ static const char* annotationStyle =
     _pdfPlugin->notifyContentScaleFactorChanged(scaleFactor);
 }
 
+- (void)pdfLayerController:(PDFLayerController *)pdfLayerController didChangeDisplayMode:(int)mode
+{
+    _pdfPlugin->notifyDisplayModeChanged(mode);
+}
+
 @end
 
 namespace WebKit {
@@ -751,6 +756,12 @@ void PDFPlugin::notifyContentScaleFactorChanged(CGFloat scaleFactor)
     updateScrollbars();
 }
 
+void PDFPlugin::notifyDisplayModeChanged(int)
+{
+    calculateSizes();
+    updateScrollbars();
+}
+
 void PDFPlugin::saveToPDF()
 {
     // FIXME: We should probably notify the user that they can't save before the document is finished loading.