Unable to load svg image from file (*.svg) on qtwebkit 5.4.2 - WEC7-x86

313 views Asked by At

I was able to successfully build qtwebkit-5.4.2 for WEC7-x86. However while trying the webkit example browser (qtwebkit-examples\examples\webkitwidgets\browser), it is not able to load svg images with file as source (*.svg). Also, when I tried to insert the same svg inline, it loads fine. I also tried the Desktop (x86) build for qtwebkit-5.4.2 and it is able to load the attached html perfectly.

Below is the html used, and the rendered page screenshots on Desktop and WEC7-x86 device.

<html>
<head>
    <title>Welcome</title>
    <style>
        body, button {
            margin: 0 auto;
            font-size: 40px;
            font-family: Tahoma, Verdana, Arial, sans-serif;
        }

        .backimage_svg {
            width: 155px;
            height: 155px;
            background-image: url("polygon.svg");
            background-color: rgb(255,255,204);
        }

        .backimage_png {
            width: 155px;
            height: 155px;
            background-image: url("polygon.png");
            background-color: rgb(255,204,204);
        }
    </style>
</head>
<body>
    <!-- [OK] Inline SVG -->
    <p style="background-color: yellow" id="test">
        <svg id="logomark" x="0px" y="0px" width="155px" height="155px" viewBox="0 0 155 155" enable-background="new 0 0 155 155" onclick="xxx()">
            <polygon id="logomark-polyline" fill-rule="evenodd" clip-rule="evenodd" fill="#0CB9C7" points="128.25,26 147.19,96.69 95.44,148.44 24.75,129.5 5.81,58.81 57.56,7.06 " />
        </svg>
    </p>
    <p style="background-color: lime">
        <!-- [OK]  img element with PNG -->
        1<img src="polygon.png" border="1">
        <!-- [NG]  FancyBrowser fails to render SVG as img's source -->
        2<img src="polygon.svg" border="1">
        <!-- [OK]  PNG as background-image specified by CSS -->
        3<img class="backimage_png" border="1">
        <!-- [NG]  FancyBrowser fails to render SVG as background-image specified by CSS -->
        4<img class="backimage_svg" border="1">
    </p>
    <div class="backimage_svg">5</div>
    <div class="backimage_png">6</div>

    <button class="backimage_svg">7</button>
    <button>8<object class="backimage_svg"></object></button>
    <button>
        9<svg id="logomark" x="0px" y="0px" width="155px" height="155px" viewBox="0 0 155 155" enable-background="new 0 0 155 155">
            <polygon id="logomark-polyline" fill-rule="evenodd" clip-rule="evenodd" fill="#0CB9C7" points="128.25,26 147.19,96.69 95.44,148.44 24.75,129.5 5.81,58.81 57.56,7.06 " />
        </svg>
    </button>
    <button class="backimage_png">10</button>
</body>
</html>

I tried searching if there is a known issue, but didn't find anything (some people have faced issues with incorrect height etc of svg).

Below is the svg file referred in the above html as polygon.svg:

<svg width="155" height="155" xmlns ="http://www.w3.org/2000/svg">
  <polygon fill-rule="evenodd" clip-rule="evenodd" fill="#0CB9C7" points="128.25,26 147.19,96.69 95.44,148.44 24.75,129.5 5.81,58.81 57.56,7.06 "/>
</svg>

Below are the rendered screenshots on WEC7 and Desktop:

Desktop Rendering Screenshot

enter image description here

WEC7 Rendering Screenshot

enter image description here

As it can be seen in the screenshots, WEC7 browser is not able to render the svg images where it is present as local file source (2, 4, 5, 7, 8).

Could someone please suggest a solution or possible approach to debug.

Thanks.

UPDATE: I tried the qtsvg example (qtsvg\examples\svg\svgviewer) and it is able to load svg image from file source. It would be really helpful if someone could point me precisely to the code which is handling this part while rendering through qtwebkit browser. I'll then try a comparison between WEC7 and Desktop code. Thanks.

UPDATE: Able to reproduce the same on Desktop-x86 build too with below configuration (works fine if qt-5.4.2 windows installer/pre-built binaries are used):

Configuration:
    pcre
    debug
    compile_examples
Qt Configuration:
    minimal-config
    small-config
    medium-config
    large-config
    full-config
    debug_and_release build_all release
    debug
    shared
    zlib
    png
    freetype
    harfbuzz
    build_all
    audio-backend
    wmf-backend
    native-gestures
    qpa
    concurrent
QMAKESPEC...................win32-msvc2008 (detected)
Architecture................i386, features:
Host Architecture...........i386, features:
Maketool....................nmake
Debug build.................yes (combined)
Default build...............debug
Force debug info............no
C++11 support...............auto
Link Time Code Generation...no
Accessibility support.......no
RTTI support................yes
SSE2 support................yes
SSE3 support................yes
SSSE3 support...............yes
SSE4.1 support..............yes
SSE4.2 support..............yes
AVX support.................no
AVX2 support................no
NEON support................no
OpenGL support..............no
Large File support..........yes
NIS support.................no
Iconv support...............no
Evdev support...............no
Mtdev support...............no
Inotify support.............no
eventfd(7) support..........no
Glib support................no
CUPS support................no
OpenVG support..............no
SSL support.................no
OpenSSL support.............no
Qt D-Bus support............no
Qt Widgets module support...yes
Qt GUI module support.......yes
QML debugging...............yes
DirectWrite support.........no
Use system proxies..........no
QPA Backends:
    GDI.....................yes
    Direct2D................no
Third Party Libraries:
    ZLIB support............qt
    GIF support.............plugin
    JPEG support............plugin
    PNG support.............yes
    FreeType support........yes
    Fontconfig support......no
    HarfBuzz support........qt
    PCRE support............qt
    ICU support.............no
    ANGLE...................no
    Dynamic OpenGL..........no
Styles:
    Windows.................yes
    Windows XP..............yes
    Windows Vista...........yes
    Fusion..................yes
    Windows CE..............no
    Windows Mobile..........no
Sql Drivers:
    ODBC....................no
    MySQL...................no
    OCI.....................no
    PostgreSQL..............no
    TDS.....................no
    DB2.....................no
    SQLite..................plugin (qt)
    SQLite2.................no
    InterBase...............no

0

There are 0 answers