Changeset 163980 in webkit


Ignore:
Timestamp:
Feb 12, 2014 1:37:26 PM (10 years ago)
Author:
benjamin@webkit.org
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 <bpoulain@apple.com> 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):

Location:
trunk/Source
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r163978 r163980  
     12014-02-12  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [WK2][iOS] Add back the special viewport for the old xhtml mobile doctype
     4        https://bugs.webkit.org/show_bug.cgi?id=128639
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebCore.exp.in:
     9        * dom/Document.cpp:
     10        (WebCore::Document::childrenChanged):
     11        Document::setDocType() has been removed and the doctype update code with it.
     12        Add a call to didReceiveDocType() to ensure the viewport is updated when the doctype is parsed.
     13
     14        * loader/EmptyClients.h:
     15        * page/Chrome.cpp:
     16        (WebCore::Chrome::didReceiveDocType):
     17        * page/ChromeClient.h:
     18        * page/ViewportConfiguration.cpp:
     19        (WebCore::ViewportConfiguration::xhtmlMobileParameters):
     20        * page/ViewportConfiguration.h:
     21
    1222014-02-12  Alexey Proskuryakov  <ap@apple.com>
    223
  • trunk/Source/WebCore/WebCore.exp.in

    r163978 r163980  
    857857__ZN7WebCore21ViewportConfiguration20setMinimumLayoutSizeERKNS_7IntSizeE
    858858__ZN7WebCore21ViewportConfiguration20setViewportArgumentsERKNS_17ViewportArgumentsE
     859__ZN7WebCore21ViewportConfiguration21xhtmlMobileParametersEv
    859860__ZN7WebCore21ViewportConfiguration22textDocumentParametersEv
    860861__ZN7WebCore21ViewportConfiguration23imageDocumentParametersEv
  • trunk/Source/WebCore/dom/Document.cpp

    r163863 r163980  
    798798    ContainerNode::childrenChanged(change);
    799799
     800#if PLATFORM(IOS)
     801    // FIXME: Chrome::didReceiveDocType() used to be called only when the doctype changed. We need to check the
     802    // impact of calling this systematically. If the overhead is negligible, we need to rename didReceiveDocType,
     803    // otherwise, we need to detect the doc type changes before updating the viewport.
     804    page()->chrome().didReceiveDocType(frame());
     805#endif
     806
    800807    Element* newDocumentElement = childrenOfType<Element>(*this).first();
    801808    if (newDocumentElement == m_documentElement)
  • trunk/Source/WebCore/loader/EmptyClients.h

    r163920 r163980  
    192192    virtual void didPreventDefaultForEvent() override { }
    193193#endif
    194     virtual void didReceiveMobileDocType() override { }
     194    virtual void didReceiveMobileDocType(bool) override { }
    195195    virtual void setNeedsScrollNotifications(Frame*, bool) override { }
    196196    virtual void observedContentChange(Frame*) override { }
  • trunk/Source/WebCore/page/Chrome.cpp

    r163726 r163980  
    606606        return;
    607607
    608     DocumentType* documentType = frame->document()->doctype();
    609     if (!documentType) {
    610         // FIXME: We should notify the client when <!DOCTYPE> is removed so that
    611         // it can adjust the viewport accordingly. See <rdar://problem/15417894>.
    612         return;
    613     }
    614 
    615     if (documentType->publicId().contains("xhtml mobile", false))
    616         m_client.didReceiveMobileDocType();
     608    bool hasMobileDocType = false;
     609    if (DocumentType* documentType = frame->document()->doctype())
     610        hasMobileDocType = documentType->publicId().contains("xhtml mobile", false);
     611    m_client.didReceiveMobileDocType(hasMobileDocType);
    617612}
    618613#endif
  • trunk/Source/WebCore/page/ChromeClient.h

    r163863 r163980  
    227227
    228228#if PLATFORM(IOS)
    229     virtual void didReceiveMobileDocType() = 0;
     229    virtual void didReceiveMobileDocType(bool) = 0;
    230230    virtual void setNeedsScrollNotifications(Frame*, bool) = 0;
    231231    virtual void observedContentChange(Frame*) = 0;
  • trunk/Source/WebCore/page/ViewportConfiguration.cpp

    r163839 r163980  
    181181}
    182182
     183ViewportConfiguration::Parameters ViewportConfiguration::xhtmlMobileParameters()
     184{
     185    Parameters parameters = webpageParameters();
     186    parameters.width = 320;
     187    return parameters;
     188}
     189
    183190static inline bool viewportArgumentValueIsValid(float value)
    184191{
  • trunk/Source/WebCore/page/ViewportConfiguration.h

    r163839 r163980  
    8686    static Parameters textDocumentParameters();
    8787    static Parameters imageDocumentParameters();
     88    static Parameters xhtmlMobileParameters();
    8889
    8990private:
  • trunk/Source/WebKit/ios/ChangeLog

    r163740 r163980  
     12014-02-12  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [WK2][iOS] Add back the special viewport for the old xhtml mobile doctype
     4        https://bugs.webkit.org/show_bug.cgi?id=128639
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebCoreSupport/WebChromeClientIOS.h:
     9        * WebCoreSupport/WebChromeClientIOS.mm:
     10        (WebChromeClientIOS::didReceiveMobileDocType):
     11
    1122014-02-08  Ryosuke Niwa  <rniwa@webkit.org>
    213
  • trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h

    r163724 r163980  
    4949    virtual void didPreventDefaultForEvent() override;
    5050#endif
    51     virtual void didReceiveMobileDocType() override;
     51    virtual void didReceiveMobileDocType(bool) override;
    5252    virtual void setNeedsScrollNotifications(WebCore::Frame*, bool) override;
    5353    virtual void observedContentChange(WebCore::Frame*) override;
  • trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm

    r163079 r163980  
    132132#endif
    133133
    134 void WebChromeClientIOS::didReceiveMobileDocType()
    135 {
    136     [[webView() _UIKitDelegateForwarder] webViewDidReceiveMobileDocType:webView() ];
     134void WebChromeClientIOS::didReceiveMobileDocType(bool isMobileDoctype)
     135{
     136    if (isMobileDoctype)
     137        [[webView() _UIKitDelegateForwarder] webViewDidReceiveMobileDocType:webView()];
    137138}
    138139
  • trunk/Source/WebKit2/ChangeLog

    r163977 r163980  
     12014-02-12  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [WK2][iOS] Add back the special viewport for the old xhtml mobile doctype
     4        https://bugs.webkit.org/show_bug.cgi?id=128639
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebProcess/WebCoreSupport/WebChromeClient.h:
     9        * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
     10        (WebKit::WebChromeClient::didReceiveMobileDocType):
     11        * WebProcess/WebPage/WebPage.h:
     12        * WebProcess/WebPage/ios/WebPageIOS.mm:
     13        (WebKit::WebPage::didReceiveMobileDocType):
     14
    1152014-02-12  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

    r163863 r163980  
    157157
    158158#if PLATFORM(IOS)
    159     virtual void didReceiveMobileDocType() override;
     159    virtual void didReceiveMobileDocType(bool) override;
    160160    virtual void setNeedsScrollNotifications(WebCore::Frame*, bool) override;
    161161    virtual void observedContentChange(WebCore::Frame*) override;
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm

    r163515 r163980  
    5252}
    5353
    54 void WebChromeClient::didReceiveMobileDocType()
     54void WebChromeClient::didReceiveMobileDocType(bool isMobileDoctype)
    5555{
    56     // FIXME: update the ViewportConfiguration accordingly.
     56    m_page->didReceiveMobileDocType(isMobileDoctype);
    5757}
    5858
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r163948 r163980  
    424424#if PLATFORM(IOS)
    425425    void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
     426    void didReceiveMobileDocType(bool);
    426427
    427428    double minimumPageScaleFactor() const;
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r163919 r163980  
    9090}
    9191
     92void WebPage::didReceiveMobileDocType(bool isMobileDoctype)
     93{
     94    if (isMobileDoctype)
     95        m_viewportConfiguration.setDefaultConfiguration(ViewportConfiguration::xhtmlMobileParameters());
     96    else
     97        m_viewportConfiguration.setDefaultConfiguration(ViewportConfiguration::webpageParameters());
     98}
     99
    92100double WebPage::minimumPageScaleFactor() const
    93101{
Note: See TracChangeset for help on using the changeset viewer.