2012년 11월 23일 금요일

[work-around] Using proxy on GTK MiniBrowser

Caveat : This code is not contributable!! Just for local test! :-)

Just export http_proxy on your machine.(bashrc, profile, environment .. whatever)

    diff --git a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
    index f17ac6c..bb93511 100644
    --- a/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
    +++ b/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
    @@ -71,6 +71,13 @@ WK_EXPORT int WebProcessMainGtk(int argc, char* argv[])
         g_object_set(session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
                      SOUP_SESSION_SSL_STRICT, FALSE, NULL);
     
    +    const char *httpProxy = g_getenv("http_proxy");
    +    if (httpProxy) {
    +        SoupURI *proxyUri = soup_uri_new(httpProxy);
    +        g_object_set(session, SOUP_SESSION_PROXY_URI, proxyUri, NULL);
    +        soup_uri_free(proxyUri);
    +    }
    +
         GOwnPtr<char> soupCacheDirectory(g_build_filename(g_get_user_cache_dir(), g_get_prgname(), NULL));
         GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(soupCacheDirectory.get(), SOUP_CACHE_SINGLE_USER));
         soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCache.get()));

2012년 11월 15일 목요일

[WebKit] Render code flow when you set src on img tag.

 Aside from setting value via idl interface, rendering has its own flow.

As you can see below, from the loader, RenderObject has callback for its resource change. Then, it will compare the width and height if it really has been changed and trigger setNeedsLayout with relevant value.

1   0x7fa41cac6cd8 WebCore::RenderObject::setNeedsLayout(bool, WebCore::MarkingBehavior)
2   0x7fa41d2d2c47 WebCore::RenderImage::imageDimensionsChanged(bool, WebCore::IntRect const*)
3   0x7fa41d2d2926 WebCore::RenderImage::imageChanged(void*, WebCore::IntRect const*)
4   0x7fa41d346911 WebCore::RenderObject::imageChanged(WebCore::CachedImage*, WebCore::IntRect const*)
5   0x7fa41cf80c42 WebCore::CachedImage::didAddClient(WebCore::CachedResourceClient*)
6   0x7fa41cf869e3 WebCore::CachedResource::addClient(WebCore::CachedResourceClient*)
7   0x7fa41d2d59d9 WebCore::RenderImageResource::setCachedImage(WebCore::CachedImage*)
8   0x7fa41cf2baed WebCore::ImageLoader::updateRenderer()
9   0x7fa41cf2b6a1 WebCore::ImageLoader::notifyFinished(WebCore::CachedResource*)
10  0x7fa41ccef60e WebCore::HTMLImageLoader::notifyFinished(WebCore::CachedResource*)
11  0x7fa41cf861d0 WebCore::CachedResource::checkNotify()
12  0x7fa41cf81eb9 WebCore::CachedImage::data(WTF::PassRefPtr<WebCore::ResourceBuffer>, bool)
13  0x7fa41cf48ca2 WebCore::SubresourceLoader::didFinishLoading(double)
14  0x7fa41cf43fd1 WebCore::ResourceLoader::didFinishLoading(WebCore::ResourceHandle*, double)

How to download webkitgtk-test-fonts archive when you are behind firewall.

As WebKitten, it is unfortunate that I am working behind firewall.
I don't think this is acceptable for web developers.
Anyway, I have no power to get rid of it from my surroundings :-), alternatively here I leave how we can download files, specifically those repositories are not certified.

Easy. Add '--no-check-certificate' option!

wget --no-check-certificate https://github.com/downloads/mrobinson/webkitgtk-test-fonts/webkitgtk-test-fonts-0.0.3.tar.gz

Have fun!