Title: [96979] trunk/Source/WebKit2
- Revision
- 96979
- Author
- [email protected]
- Date
- 2011-10-07 13:43:41 -0700 (Fri, 07 Oct 2011)
Log Message
[Mac] Scrollbars in embedded PDFs should update when system preferences change
https://bugs.webkit.org/show_bug.cgi?id=69654
Reviewed by Simon Fraser.
* WebProcess/Plugins/PDF/BuiltInPDFView.h: Added an scrollbarStyleChanged() override.
ScrollAnimatorMac sets scrollbar frame to a bogus (0, 0, thickness, thickness) one when style
changes, and expects clients to move them back in place.
* WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
(WebKit::BuiltInPDFView::isOnActivePage): Fixed a typo that prevented ScrollAnimatorMac from
updating style of PDF view scrollbars.
(WebKit::BuiltInPDFView::scrollbarStyleChanged): Reposition scrollbars and content after
style change. The behavior is not perfect in edge cases, but roughly matches ScrollView.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (96978 => 96979)
--- trunk/Source/WebKit2/ChangeLog 2011-10-07 20:27:01 UTC (rev 96978)
+++ trunk/Source/WebKit2/ChangeLog 2011-10-07 20:43:41 UTC (rev 96979)
@@ -1,3 +1,20 @@
+2011-10-07 Alexey Proskuryakov <[email protected]>
+
+ [Mac] Scrollbars in embedded PDFs should update when system preferences change
+ https://bugs.webkit.org/show_bug.cgi?id=69654
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/Plugins/PDF/BuiltInPDFView.h: Added an scrollbarStyleChanged() override.
+ ScrollAnimatorMac sets scrollbar frame to a bogus (0, 0, thickness, thickness) one when style
+ changes, and expects clients to move them back in place.
+
+ * WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
+ (WebKit::BuiltInPDFView::isOnActivePage): Fixed a typo that prevented ScrollAnimatorMac from
+ updating style of PDF view scrollbars.
+ (WebKit::BuiltInPDFView::scrollbarStyleChanged): Reposition scrollbars and content after
+ style change. The behavior is not perfect in edge cases, but roughly matches ScrollView.
+
2011-10-07 Sheriff Bot <[email protected]>
Unreviewed, rolling out r96938.
Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp (96978 => 96979)
--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp 2011-10-07 20:27:01 UTC (rev 96978)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp 2011-10-07 20:43:41 UTC (rev 96979)
@@ -579,7 +579,19 @@
bool BuiltInPDFView::isOnActivePage() const
{
- return pluginView()->frame()->document()->inPageCache();
+ return !pluginView()->frame()->document()->inPageCache();
}
+void BuiltInPDFView::scrollbarStyleChanged()
+{
+ // If the PDF was scrolled all the way to bottom right and scrollbars change to overlay style, we don't want to display white rectangles where scrollbars were.
+ IntPoint newScrollOffset = IntPoint(m_scrollOffset).shrunkTo(maximumScrollPosition());
+ setScrollOffset(newScrollOffset);
+
+ // As size of the content area changes, scrollbars may need to appear or to disappear.
+ updateScrollbars();
+
+ scrollAnimator()->contentsResized();
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h (96978 => 96979)
--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h 2011-10-07 20:27:01 UTC (rev 96978)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h 2011-10-07 20:43:41 UTC (rev 96979)
@@ -127,6 +127,7 @@
virtual bool isOnActivePage() const;
virtual void disconnectFromPage() { m_page = 0; }
virtual bool shouldSuspendScrollAnimations() const { return false; } // If we return true, ScrollAnimatorMac will keep cycling a timer forever, waiting for a good time to animate.
+ virtual void scrollbarStyleChanged();
// In window coordinates.
WebCore::IntRect m_frameRect;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes