zoukankan      html  css  js  c++  java
  • Cut Down QtWebkit Library

    Code With Trance: Cut Down QtWebkit Library

    2010年3月30日 星期二

    Cut Down QtWebkit Library

    With webkit nightly building(Qtwebkit weekly builds),QtWebkit library's size becomes bigger and bigger,for many of us who use qtwebkit library to code apps,some features of webkit are unnecessary ,such as Html5 support ,JavaScript debugger,WML support,especially SVG.So just remove these feature from webkit and then we can save some rooms when we release our apps.Unlike the entire highly modular of Gecko,Webkit is lightweight renderer that clean code base.That is why google picked webkit rather than gecko as their browser engine.It make our things easy。





    Qt version :4.6.0

    -platform: win32-msvc2008

    Qtwebkit.dll

    The initial size of the: 9673k



    Ater cutting down:5963k



    Step 1. Edit QTDIR\src\3rdparty\webkit\WebCore\WebCore.pro,add following lines


    DEFINES += ENABLE_SVG=0               :disenable SVG support

    DEFINES += ENABLE_RUBY=0             :disenable HTML5 ruby support

    DEFINES += ENABLE_VIDEO=0            :disenable HTML5 media support

    DEFINES += ENABLE_NETSCAPE_PLUGIN_API=0      :disenable Nescape plugins support

    DEFINES += ENABLE_VIDEO=0                                :disenable Web Socket support.

    DEFINES += ENABLE_XSLT=0                                  :disenable XSLT support with QtXmlPatterns

    DEFINES += ENABLE_CHANNEL_MESSAGING=0         :disenable HTML5 channel messaging support

    DEFINES += ENABLE_JAVASCRIPT_DEBUGGER=0     :disenable JavaScript debugger/profiler support

    DEFINES += ENABLE_SQLITE=0                              :disenable sqlite support

    DEFINES += ENABLE_DATABASE=0                          :disenable HTML5 client-side database storage support

    DEFINES += ENABLE_EVENTSOURCE=0                    :disenable HTML5 server-sent events support

    DEFINES += ENABLE_OFFLINE_WEB_APPLICATIONS=0  :disenable HTML5 offline web applications support

    DEFINES += ENABLE_DOM_STORAGE=0                       :disenable HTML5 client-side session and persistent storage support

    DEFINES += ENABLE_ICONDATABASE=0                        :disenable Icon database support

    DEFINES += ENABLE_SHARED_WORKERS=0                   :disenable SharedWorkers support

    DEFINES += ENABLE_WORKERS=0                                :disenable workder support

    DEFINES += ENABLE_WML=0                                        :disenable wml

    DEFINES += ENABLE_XPATH=0                                     :disenable xpath

    DEFINES += ENABLE_XBL=0                                         :disenable xbl

    DEFINES += ENABLE_ORIENTATION_EVENTS=0 :

    DEFINES += ENABLE_DASHBOARD_SUPPORT=0 :

    DEFINES += ENABLE_FILTERS=0 :

    DEFINES += ENABLE_WCSS=0 :

    DEFINES += ENABLE_XHTMLMP=0 :

    DEFINES += ENABLE_DATAGRID=0 :

    DEFINES += ENABLE_SINGLE_THREADED=1 :



    Step 2.when we release our apps,the WebInpector is unuseful for most of people,although it's very convenient for developer.Firstly Remove the following line from WebCore.pro which contains many images for WebInspector compiling.



    RESOURCES += $PWD/../WebCore/inspector/front-end/WebKit.qrc



    then insert these into WebCore.pro



    DEFINES += ENABLE_INSPECTOR=0

    contains(DEFINES, ENABLE_INSPECTOR=) {

    SOURCES -= \

    inspector/ConsoleMessage.cpp \

    inspector/InspectorBackend.cpp \

    inspector/InspectorController.cpp \

    inspector/InspectorDatabaseResource.cpp \

    inspector/InspectorDOMAgent.cpp \

    inspector/InspectorDOMStorageResource.cpp \

    inspector/InspectorFrontend.cpp \

    inspector/InspectorResource.cpp \

    inspector/InspectorTimelineAgent.cpp \

    inspector/TimelineRecordFactory.cpp \

    }


    Tips:follow steps above and nmake may still cause errors。you just find the .cpp and .h files displayed errors and insert the corresponding macro.It will be ok.

    Remember to run QTDIR/demo/browser to test if new QtWebkit4.dll works succesfully.

    Hope you can make it.

  • 相关阅读:
    3.25Java常量
    3.26Java逻辑运算符
    3.26Java关系运算符
    Java标识符
    3.27Java位运算符
    3.26Java运算符(operator)
    3.26Java字符型(char)变量、常量
    3.26Java布尔类型(boolean)变量、常量
    《算法导论》第9章 顺序统计学 (1)最小值和最大值
    《算法导论》第8章 线性时间排序 (1)计数排序
  • 原文地址:https://www.cnblogs.com/lexus/p/2442421.html
Copyright © 2011-2022 走看看