无法从qtwebkit 5.4.2上的文件(* .svg)加载svg图像-WEC7-x86

时间:2018-07-10 04:22:42

标签: svg webkit windows-ce qtwebkit qt5.4

我能够为WEC7-x86成功构建qtwebkit-5.4.2。但是,在尝试使用Webkit示例浏览器(qtwebkit-examples \ examples \ webkitwidgets \ browser)时,它无法加载以文件为源(* .svg)的svg图像。另外,当我尝试内联插入相同的svg时,它加载正常。我还尝试了qtwebkit-5.4.2的Desktop(x86)构建,它能够完美地加载附加的html。

下面是使用的html,以及台式机和WEC7-x86设备上的呈现的页面截图。

<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>

我尝试搜索是否存在已知问题,但没有找到任何东西(某些人遇到了高度不正确的svg等问题)。

以下是上面html中称为“ polygon.svg”的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>

以下是WEC7和桌面上的渲染屏幕截图:

桌面渲染屏幕截图

enter image description here

WEC7渲染屏幕截图

enter image description here

从屏幕截图中可以看到,WEC7浏览器无法渲染以本地文件源(2、4、5、7、8)形式显示的svg图像。

请有人提出解决方案或可能的调试方法。

谢谢。

更新:我尝试了qtsvg示例(qtsvg \ examples \ svg \ svgviewer),它能够从文件源加载svg图像。如果有人可以将我精确地指向在通过qtwebkit浏览器进行渲染时正在处理此部分的代码,那将非常有帮助。然后,我将尝试比较WEC7和桌面代码。谢谢。

更新:使用以下配置,也可以在Desktop-x86构建中重现相同的内容(如果使用qt-5.4.2 Windows Installer /预构建的二进制文件,则可以正常工作):

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 个答案:

没有答案