Title: [163980] trunk/Source
Revision
163980
Author
[email protected]
Date
2014-02-12 13:37:26 -0800 (Wed, 12 Feb 2014)

Log Message

[WK2][iOS] Add back the special viewport for the old xhtml mobile doctype
https://bugs.webkit.org/show_bug.cgi?id=128639

Patch by Benjamin Poulain <[email protected]> on 2014-02-12
Reviewed by Andreas Kling.

Source/WebCore: 

* WebCore.exp.in:
* dom/Document.cpp:
(WebCore::Document::childrenChanged):
Document::setDocType() has been removed and the doctype update code with it.
Add a call to didReceiveDocType() to ensure the viewport is updated when the doctype is parsed.

* loader/EmptyClients.h:
* page/Chrome.cpp:
(WebCore::Chrome::didReceiveDocType):
* page/ChromeClient.h:
* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::xhtmlMobileParameters):
* page/ViewportConfiguration.h:

Source/WebKit/ios: 

* WebCoreSupport/WebChromeClientIOS.h:
* WebCoreSupport/WebChromeClientIOS.mm:
(WebChromeClientIOS::didReceiveMobileDocType):

Source/WebKit2: 

* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::didReceiveMobileDocType):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::didReceiveMobileDocType):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (163979 => 163980)


--- trunk/Source/WebCore/ChangeLog	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebCore/ChangeLog	2014-02-12 21:37:26 UTC (rev 163980)
@@ -1,3 +1,24 @@
+2014-02-12  Benjamin Poulain  <[email protected]>
+
+        [WK2][iOS] Add back the special viewport for the old xhtml mobile doctype
+        https://bugs.webkit.org/show_bug.cgi?id=128639
+
+        Reviewed by Andreas Kling.
+
+        * WebCore.exp.in:
+        * dom/Document.cpp:
+        (WebCore::Document::childrenChanged):
+        Document::setDocType() has been removed and the doctype update code with it.
+        Add a call to didReceiveDocType() to ensure the viewport is updated when the doctype is parsed.
+
+        * loader/EmptyClients.h:
+        * page/Chrome.cpp:
+        (WebCore::Chrome::didReceiveDocType):
+        * page/ChromeClient.h:
+        * page/ViewportConfiguration.cpp:
+        (WebCore::ViewportConfiguration::xhtmlMobileParameters):
+        * page/ViewportConfiguration.h:
+
 2014-02-12  Alexey Proskuryakov  <[email protected]>
 
         Mountain Lion build fix.

Modified: trunk/Source/WebCore/WebCore.exp.in (163979 => 163980)


--- trunk/Source/WebCore/WebCore.exp.in	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-02-12 21:37:26 UTC (rev 163980)
@@ -856,6 +856,7 @@
 __ZN7WebCore21ViewportConfiguration17webpageParametersEv
 __ZN7WebCore21ViewportConfiguration20setMinimumLayoutSizeERKNS_7IntSizeE
 __ZN7WebCore21ViewportConfiguration20setViewportArgumentsERKNS_17ViewportArgumentsE
+__ZN7WebCore21ViewportConfiguration21xhtmlMobileParametersEv
 __ZN7WebCore21ViewportConfiguration22textDocumentParametersEv
 __ZN7WebCore21ViewportConfiguration23imageDocumentParametersEv
 __ZN7WebCore21ViewportConfiguration23setDefaultConfigurationERKNS0_10ParametersE

Modified: trunk/Source/WebCore/dom/Document.cpp (163979 => 163980)


--- trunk/Source/WebCore/dom/Document.cpp	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebCore/dom/Document.cpp	2014-02-12 21:37:26 UTC (rev 163980)
@@ -797,6 +797,13 @@
 {
     ContainerNode::childrenChanged(change);
 
+#if PLATFORM(IOS)
+    // FIXME: Chrome::didReceiveDocType() used to be called only when the doctype changed. We need to check the
+    // impact of calling this systematically. If the overhead is negligible, we need to rename didReceiveDocType,
+    // otherwise, we need to detect the doc type changes before updating the viewport.
+    page()->chrome().didReceiveDocType(frame());
+#endif
+
     Element* newDocumentElement = childrenOfType<Element>(*this).first();
     if (newDocumentElement == m_documentElement)
         return;

Modified: trunk/Source/WebCore/loader/EmptyClients.h (163979 => 163980)


--- trunk/Source/WebCore/loader/EmptyClients.h	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2014-02-12 21:37:26 UTC (rev 163980)
@@ -191,7 +191,7 @@
 #if ENABLE(TOUCH_EVENTS)
     virtual void didPreventDefaultForEvent() override { }
 #endif
-    virtual void didReceiveMobileDocType() override { }
+    virtual void didReceiveMobileDocType(bool) override { }
     virtual void setNeedsScrollNotifications(Frame*, bool) override { }
     virtual void observedContentChange(Frame*) override { }
     virtual void clearContentChangeObservers(Frame*) override { }

Modified: trunk/Source/WebCore/page/Chrome.cpp (163979 => 163980)


--- trunk/Source/WebCore/page/Chrome.cpp	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebCore/page/Chrome.cpp	2014-02-12 21:37:26 UTC (rev 163980)
@@ -605,15 +605,10 @@
     if (!frame->isMainFrame())
         return;
 
-    DocumentType* documentType = frame->document()->doctype();
-    if (!documentType) {
-        // FIXME: We should notify the client when <!DOCTYPE> is removed so that
-        // it can adjust the viewport accordingly. See <rdar://problem/15417894>.
-        return;
-    }
-
-    if (documentType->publicId().contains("xhtml mobile", false))
-        m_client.didReceiveMobileDocType();
+    bool hasMobileDocType = false;
+    if (DocumentType* documentType = frame->document()->doctype())
+        hasMobileDocType = documentType->publicId().contains("xhtml mobile", false);
+    m_client.didReceiveMobileDocType(hasMobileDocType);
 }
 #endif
 

Modified: trunk/Source/WebCore/page/ChromeClient.h (163979 => 163980)


--- trunk/Source/WebCore/page/ChromeClient.h	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebCore/page/ChromeClient.h	2014-02-12 21:37:26 UTC (rev 163980)
@@ -226,7 +226,7 @@
 #endif
 
 #if PLATFORM(IOS)
-    virtual void didReceiveMobileDocType() = 0;
+    virtual void didReceiveMobileDocType(bool) = 0;
     virtual void setNeedsScrollNotifications(Frame*, bool) = 0;
     virtual void observedContentChange(Frame*) = 0;
     virtual void clearContentChangeObservers(Frame*) = 0;

Modified: trunk/Source/WebCore/page/ViewportConfiguration.cpp (163979 => 163980)


--- trunk/Source/WebCore/page/ViewportConfiguration.cpp	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebCore/page/ViewportConfiguration.cpp	2014-02-12 21:37:26 UTC (rev 163980)
@@ -180,6 +180,13 @@
     return parameters;
 }
 
+ViewportConfiguration::Parameters ViewportConfiguration::xhtmlMobileParameters()
+{
+    Parameters parameters = webpageParameters();
+    parameters.width = 320;
+    return parameters;
+}
+
 static inline bool viewportArgumentValueIsValid(float value)
 {
     return value > 0;

Modified: trunk/Source/WebCore/page/ViewportConfiguration.h (163979 => 163980)


--- trunk/Source/WebCore/page/ViewportConfiguration.h	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebCore/page/ViewportConfiguration.h	2014-02-12 21:37:26 UTC (rev 163980)
@@ -85,6 +85,7 @@
     static Parameters webpageParameters();
     static Parameters textDocumentParameters();
     static Parameters imageDocumentParameters();
+    static Parameters xhtmlMobileParameters();
 
 private:
     void updateConfiguration();

Modified: trunk/Source/WebKit/ios/ChangeLog (163979 => 163980)


--- trunk/Source/WebKit/ios/ChangeLog	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebKit/ios/ChangeLog	2014-02-12 21:37:26 UTC (rev 163980)
@@ -1,3 +1,14 @@
+2014-02-12  Benjamin Poulain  <[email protected]>
+
+        [WK2][iOS] Add back the special viewport for the old xhtml mobile doctype
+        https://bugs.webkit.org/show_bug.cgi?id=128639
+
+        Reviewed by Andreas Kling.
+
+        * WebCoreSupport/WebChromeClientIOS.h:
+        * WebCoreSupport/WebChromeClientIOS.mm:
+        (WebChromeClientIOS::didReceiveMobileDocType):
+
 2014-02-08  Ryosuke Niwa  <[email protected]>
 
         Build fix after r163739.

Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h (163979 => 163980)


--- trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h	2014-02-12 21:37:26 UTC (rev 163980)
@@ -48,7 +48,7 @@
 #if ENABLE(TOUCH_EVENTS)
     virtual void didPreventDefaultForEvent() override;
 #endif
-    virtual void didReceiveMobileDocType() override;
+    virtual void didReceiveMobileDocType(bool) override;
     virtual void setNeedsScrollNotifications(WebCore::Frame*, bool) override;
     virtual void observedContentChange(WebCore::Frame*) override;
     virtual void clearContentChangeObservers(WebCore::Frame*) override;

Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm (163979 => 163980)


--- trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm	2014-02-12 21:37:26 UTC (rev 163980)
@@ -131,9 +131,10 @@
 }
 #endif
 
-void WebChromeClientIOS::didReceiveMobileDocType()
+void WebChromeClientIOS::didReceiveMobileDocType(bool isMobileDoctype)
 {
-    [[webView() _UIKitDelegateForwarder] webViewDidReceiveMobileDocType:webView() ];
+    if (isMobileDoctype)
+        [[webView() _UIKitDelegateForwarder] webViewDidReceiveMobileDocType:webView()];
 }
 
 void WebChromeClientIOS::setNeedsScrollNotifications(WebCore::Frame* frame, bool flag)

Modified: trunk/Source/WebKit2/ChangeLog (163979 => 163980)


--- trunk/Source/WebKit2/ChangeLog	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-12 21:37:26 UTC (rev 163980)
@@ -1,3 +1,17 @@
+2014-02-12  Benjamin Poulain  <[email protected]>
+
+        [WK2][iOS] Add back the special viewport for the old xhtml mobile doctype
+        https://bugs.webkit.org/show_bug.cgi?id=128639
+
+        Reviewed by Andreas Kling.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
+        (WebKit::WebChromeClient::didReceiveMobileDocType):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::didReceiveMobileDocType):
+
 2014-02-12  Anders Carlsson  <[email protected]>
 
         WKProcessClass.h and WKNavigationResponse.h should be public headers

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (163979 => 163980)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2014-02-12 21:37:26 UTC (rev 163980)
@@ -156,7 +156,7 @@
 #endif
 
 #if PLATFORM(IOS)
-    virtual void didReceiveMobileDocType() override;
+    virtual void didReceiveMobileDocType(bool) override;
     virtual void setNeedsScrollNotifications(WebCore::Frame*, bool) override;
     virtual void observedContentChange(WebCore::Frame*) override;
     virtual void clearContentChangeObservers(WebCore::Frame*) override;

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm (163979 => 163980)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm	2014-02-12 21:37:26 UTC (rev 163980)
@@ -51,9 +51,9 @@
     m_page->elementDidBlur(const_cast<WebCore::Node*>(node));
 }
 
-void WebChromeClient::didReceiveMobileDocType()
+void WebChromeClient::didReceiveMobileDocType(bool isMobileDoctype)
 {
-    // FIXME: update the ViewportConfiguration accordingly.
+    m_page->didReceiveMobileDocType(isMobileDoctype);
 }
 
 void WebChromeClient::setNeedsScrollNotifications(WebCore::Frame*, bool)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (163979 => 163980)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-02-12 21:37:26 UTC (rev 163980)
@@ -423,6 +423,7 @@
 
 #if PLATFORM(IOS)
     void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
+    void didReceiveMobileDocType(bool);
 
     double minimumPageScaleFactor() const;
     double maximumPageScaleFactor() const;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (163979 => 163980)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2014-02-12 21:27:22 UTC (rev 163979)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2014-02-12 21:37:26 UTC (rev 163980)
@@ -89,6 +89,14 @@
     viewportConfigurationChanged();
 }
 
+void WebPage::didReceiveMobileDocType(bool isMobileDoctype)
+{
+    if (isMobileDoctype)
+        m_viewportConfiguration.setDefaultConfiguration(ViewportConfiguration::xhtmlMobileParameters());
+    else
+        m_viewportConfiguration.setDefaultConfiguration(ViewportConfiguration::webpageParameters());
+}
+
 double WebPage::minimumPageScaleFactor() const
 {
     return m_viewportConfiguration.minimumScale();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to