Set the right device scale factor when creating the web page
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 May 2012 22:01:07 +0000 (22:01 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 May 2012 22:01:07 +0000 (22:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=85667
<rdar://problem/11376611>

Reviewed by Oliver Hunt.

* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:contextRef:pageGroupRef:]):
Set the scale factor before initializing the page, to ensure that the WebPageCreationParameters struct gets the right scale factor.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setIntrinsicDeviceScaleFactor):
This can now be called with a null drawing area. Also, remove the isValid() check since we still want to update the scale factor even if the web process has crashed.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
Set the device scale factor from the creation parameters.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 5328c7d..9f38ffc 100644 (file)
@@ -1,3 +1,23 @@
+2012-05-04  Anders Carlsson  <andersca@apple.com>
+
+        Set the right device scale factor when creating the web page
+        https://bugs.webkit.org/show_bug.cgi?id=85667
+        <rdar://problem/11376611>
+
+        Reviewed by Oliver Hunt.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView initWithFrame:contextRef:pageGroupRef:]):
+        Set the scale factor before initializing the page, to ensure that the WebPageCreationParameters struct gets the right scale factor.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setIntrinsicDeviceScaleFactor):
+        This can now be called with a null drawing area. Also, remove the isValid() check since we still want to update the scale factor even if the web process has crashed.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        Set the device scale factor from the creation parameters.
+
 2012-05-02  Jer Noble  <jer.noble@apple.com>
 
         Taking a visibility:hidden element full screen causes full screen window to disappear.
index 42cef80..8cd3027 100644 (file)
@@ -2910,8 +2910,8 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
 
     _data->_pageClient = PageClientImpl::create(self);
     _data->_page = toImpl(contextRef)->createWebPage(_data->_pageClient.get(), toImpl(pageGroupRef));
-    _data->_page->initializeWebPage();
     _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]);
+    _data->_page->initializeWebPage();
 #if ENABLE(FULLSCREEN_API)
     _data->_page->fullScreenManager()->setWebView(self);
 #endif
index d2ef2d3..043cdb6 100644 (file)
@@ -1317,14 +1317,13 @@ void WebPageProxy::scalePage(double scale, const IntPoint& origin)
 
 void WebPageProxy::setIntrinsicDeviceScaleFactor(float scaleFactor)
 {
-    if (!isValid())
-        return;
-
     if (m_intrinsicDeviceScaleFactor == scaleFactor)
         return;
 
     m_intrinsicDeviceScaleFactor = scaleFactor;
-    m_drawingArea->deviceScaleFactorDidChange();
+
+    if (m_drawingArea)
+        m_drawingArea->deviceScaleFactorDidChange();
 }
 
 void WebPageProxy::windowScreenDidChange(PlatformDisplayID displayID)
index 3883a5c..7f83d01 100644 (file)
@@ -270,6 +270,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
 
     m_pageGroup = WebProcess::shared().webPageGroup(parameters.pageGroupData);
     m_page->setGroupName(m_pageGroup->identifier());
+    m_page->setDeviceScaleFactor(parameters.deviceScaleFactor);
 
     platformInitialize();