2016-03-03 69 views
0

當使用inline_svg寶石時,我的Rails應用程序中的某些頁面在頁面上存在svgs時似乎會使Safari完全崩潰。使用Rails時Safari會崩潰inline_svg gem

導航到頁面會導致錯誤消息「Safari Web Content意外退出」。

這裏是一個讓我相信它是與SVG渲染的問題堆棧跟蹤的一部分:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 
0 libsystem_kernel.dylib   0x00007fff8e2c1286 __pthread_kill + 10 
1 libsystem_c.dylib    0x00007fff9a58db53 abort + 129 
2 libsystem_c.dylib    0x00007fff9a555c39 __assert_rtn + 321 
3 com.apple.CoreGraphics   0x00007fff90ff9d0e CGPathCreateMutableCopyByTransformingPath + 242 
4 com.apple.CoreGraphics   0x00007fff9101de10 CGContextAddPath + 93 
5 com.apple.WebCore    0x00007fff920d70c0 WebCore::GraphicsContext::strokePath(WebCore::Path const&) + 80 
6 com.apple.WebCore    0x00007fff929c4140 WebCore::RenderSVGShape::strokeShape(WebCore::GraphicsContext*) const + 160 
7 com.apple.WebCore    0x00007fff929c8673 WebCore::RenderSVGPath::strokeShape(WebCore::GraphicsContext*) const + 99 
8 com.apple.WebCore    0x00007fff929d0fce WebCore::RenderSVGShape::strokeShape(WebCore::RenderStyle const&, WebCore::GraphicsContext*) + 126 
9 com.apple.WebCore    0x00007fff929d116f WebCore::RenderSVGShape::strokeShape(WebCore::GraphicsContext*) + 191 
10 com.apple.WebCore    0x00007fff929d11ce WebCore::RenderSVGShape::fillStrokeMarkers(WebCore::PaintInfo&) + 78 
11 com.apple.WebCore    0x00007fff91ff927b WebCore::RenderSVGShape::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) + 379 
12 com.apple.WebCore    0x00007fff92052b03 WebCore::RenderSVGContainer::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) + 531 
13 com.apple.WebCore    0x00007fff92052b03 WebCore::RenderSVGContainer::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) + 531 
14 com.apple.WebCore    0x00007fff92052b03 WebCore::RenderSVGContainer::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) + 531 
15 com.apple.WebCore    0x00007fff91ff8f12 WebCore::RenderSVGRoot::paintReplaced(WebCore::PaintInfo&, WebCore::LayoutPoint const&) + 1330 
16 com.apple.WebCore    0x00007fff91f70d32 WebCore::RenderReplaced::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) + 722 

這裏是什麼SVG本身的樣子:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" width="91px" height="25px" viewBox="0 0 91 25" version="1.1" class="priority-urgent"> 
    <title>Urgent</title> 
    <desc>Created with sketchtool.</desc> 
    <defs></defs> 
    <g id="1/18" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> 
     <g id="Detail" sketch:type="MSArtboardGroup" transform="translate(-459.000000, -264.000000)"> 
      <g id="Group" sketch:type="MSLayerGroup" transform="translate(429.000000, 103.000000)"> 
       <g id="Urgent_flag" transform="translate(30.000000, 161.000000)"> 
        <rect id="Rectangle-28" fill="#E74C3C" sketch:type="MSShapeGroup" x="0" y="0" width="91" height="25" rx="2"> </rect> 
        <text id="URGENT" sketch:type="MSTextLayer" font-family="Gotham Book" font-size="16" font-weight="313" sketch:alignment="middle" line-spacing="19" fill="#FFFFFF"> 
         <tspan x="10.508" y="18">URGENT</tspan> 
        </text> 
       </g> 
      </g> 
     </g> 
    </g> 
</svg> 

回答

0

原來這是我應用於我在<svg>上的css類的padding的問題。 Safari可能會考慮填充圖像的大小,可能會縮小圖像的大小。無論如何,刪除填充後,Safari停止崩潰。