Bug 1019326 - fix some issues with svg.new-getBBox.enabled r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D212772
This commit is contained in:
@@ -102,7 +102,7 @@ already_AddRefed<SVGRect> SVGGraphicsElement::GetBBox(
|
|||||||
}
|
}
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
if (aOptions.mFill) {
|
if (aOptions.mFill) {
|
||||||
flags |= SVGUtils::eBBoxIncludeFill;
|
flags |= SVGUtils::eBBoxIncludeFillGeometry;
|
||||||
}
|
}
|
||||||
if (aOptions.mStroke) {
|
if (aOptions.mStroke) {
|
||||||
flags |= SVGUtils::eBBoxIncludeStroke;
|
flags |= SVGUtils::eBBoxIncludeStroke;
|
||||||
@@ -114,11 +114,11 @@ already_AddRefed<SVGRect> SVGGraphicsElement::GetBBox(
|
|||||||
flags |= SVGUtils::eBBoxIncludeClipped;
|
flags |= SVGUtils::eBBoxIncludeClipped;
|
||||||
}
|
}
|
||||||
if (flags == 0) {
|
if (flags == 0) {
|
||||||
return do_AddRef(new SVGRect(this, gfx::Rect()));
|
return do_AddRef(new SVGRect(this, {}));
|
||||||
}
|
}
|
||||||
if (flags == SVGUtils::eBBoxIncludeMarkers ||
|
if (flags == SVGUtils::eBBoxIncludeMarkers ||
|
||||||
flags == SVGUtils::eBBoxIncludeClipped) {
|
flags == SVGUtils::eBBoxIncludeClipped) {
|
||||||
flags |= SVGUtils::eBBoxIncludeFill;
|
flags |= SVGUtils::eBBoxIncludeFillGeometry;
|
||||||
}
|
}
|
||||||
flags |= SVGUtils::eUseUserSpaceOfUseElement;
|
flags |= SVGUtils::eUseUserSpaceOfUseElement;
|
||||||
return do_AddRef(new SVGRect(this, ToRect(SVGUtils::GetBBox(frame, flags))));
|
return do_AddRef(new SVGRect(this, ToRect(SVGUtils::GetBBox(frame, flags))));
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
<circle cx="100" cy="100" r="5"/>
|
<circle cx="100" cy="100" r="5"/>
|
||||||
<g/>
|
<g/>
|
||||||
</g>
|
</g>
|
||||||
|
<!-- fill="none" should have a non-zero bounding box-->
|
||||||
|
<rect id="none" width="10" height="10" fill="none"/>
|
||||||
<use x="100" y="100" id="use_v" href="#v"/>
|
<use x="100" y="100" id="use_v" href="#v"/>
|
||||||
<use x="100" y="100" id="use_h" href="#h"/>
|
<use x="100" y="100" id="use_h" href="#h"/>
|
||||||
<use x="100" y="100" id="use_e" href="#e"/>
|
<use x="100" y="100" id="use_e" href="#e"/>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -147,28 +147,28 @@
|
|||||||
<text id="text6" font-size="20px" font-familiy="monospace" fill="blue" x="0" y="80" clip-path="url('#rect06')">99</text>
|
<text id="text6" font-size="20px" font-familiy="monospace" fill="blue" x="0" y="80" clip-path="url('#rect06')">99</text>
|
||||||
|
|
||||||
<!-- image -->
|
<!-- image -->
|
||||||
<image id="image1" x="150" y="150" width="200" height="200" preserveApectRatio="none" clip="rect(200,300,300,200)"
|
<image id="image1" x="150" y="150" width="200" height="200" preserveApectRatio="none" clip="rect(10px,90px,90px,10px)"
|
||||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
||||||
|
|
||||||
<image id="image2" x="2" y="2" width="200" height="200" clip-path="url('#circle1')" preserveApectRatio="none"
|
<image id="image2" x="2" y="2" width="200" height="200" clip-path="url('#circle1')" preserveApectRatio="none"
|
||||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
||||||
|
|
||||||
<image id="image3" x="205" y="2" width="200" height="200" clip-path="url('#circle1')" preserveApectRatio="none"
|
<image id="image3" x="205" y="2" width="200" height="200" clip-path="url('#circle1')" preserveApectRatio="none"
|
||||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
||||||
|
|
||||||
<image id="image4" x="2" y="205" width="200" height="200" clip-path="url('#circle1')" preserveApectRatio="none"
|
<image id="image4" x="2" y="205" width="200" height="200" clip-path="url('#circle1')" preserveApectRatio="none"
|
||||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
||||||
|
|
||||||
<image id="image5" x="205" y="205" width="200" height="200" clip-path="url('#circle1')" preserveApectRatio="none"
|
<image id="image5" x="205" y="205" width="200" height="200" clip-path="url('#circle1')" preserveApectRatio="none"
|
||||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
||||||
|
|
||||||
<image id="image6" x="2" y="2" width="200" height="200" clip-path="url('#circle2')" preserveApectRatio="none"
|
<image id="image6" x="2" y="2" width="200" height="200" clip-path="url('#circle2')" preserveApectRatio="none"
|
||||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
||||||
|
|
||||||
<image id="image7" x="205" y="2" width="200" height="200" clip-path="url('#circle2')" preserveApectRatio="none"
|
<image id="image7" x="205" y="2" width="200" height="200" clip-path="url('#circle2')" preserveApectRatio="none"
|
||||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
||||||
|
|
||||||
<image id="image8" x="2" y="205" width="200" height="200" clip-path="url('#circle2')" preserveApectRatio="none"
|
<image id="image8" x="2" y="205" width="200" height="200" clip-path="url('#circle2')" preserveApectRatio="none"
|
||||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKXRFWHRDcmVhdGlvbiBUaW1lAJCFIDMwIDQgMjAxNCAwOToyODo0MyArMDkwMH73aTcAAAAHdElNRQfeBB4AHhEfV06+AAAACXBIWXMAAB7BAAAewQHDaVRTAAAABGdBTUEAALGPC/xhBQAAABlJREFUeNpjZPj/n4EUwESS6lENoxqGlAYASU8CHux7qQ4AAAAASUVORK5CYII="/>
|
||||||
|
|
||||||
<image id="image9" x="205" y="205" width="200" height="200" clip-path="url('#circle2')" preserveApectRatio="none"
|
<image id="image9" x="205" y="205" width="200" height="200" clip-path="url('#circle2')" preserveApectRatio="none"
|
||||||
@@ -246,48 +246,48 @@
|
|||||||
<use id="use8" xlink:href="#rect-10" x="50" y="50" clip-path="url('#m_atr')"/>
|
<use id="use8" xlink:href="#rect-10" x="50" y="50" clip-path="url('#m_atr')"/>
|
||||||
|
|
||||||
<!-- foreignObject -->
|
<!-- foreignObject -->
|
||||||
<foreignObject id="fo1" x="2" y="2" width="200" height="200" clip-path="url('#circle1')" clip="rect(2,102,102,2)">
|
<foreignObject id="fo1" x="2" y="2" width="200" height="200" clip-path="url('#circle1')" clip="rect(2px,102px,102px,2px)">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
||||||
There are issues of dynamic loading required for tiling. Accroding to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
There are issues of dynamic loading required for tiling. According to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
||||||
</div>
|
</div>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
<foreignObject id="fo2" x="205" y="2" width="200" height="200" clip-path="url('#circle1')" >
|
<foreignObject id="fo2" x="205" y="2" width="200" height="200" clip-path="url('#circle1')" >
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
||||||
There are issues of dynamic loading required for tiling. Accroding to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
There are issues of dynamic loading required for tiling. According to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
||||||
</div>
|
</div>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
<foreignObject id="fo3" x="2" y="205" width="200" height="200" clip-path="url('#circle1')" >
|
<foreignObject id="fo3" x="2" y="205" width="200" height="200" clip-path="url('#circle1')" >
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
||||||
There are issues of dynamic loading required for tiling. Accroding to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
There are issues of dynamic loading required for tiling. According to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
||||||
</div>
|
</div>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
<foreignObject id="fo4" x="205" y="205" width="200" height="200" clip-path="url('#circle1')" clip="rect(2,102,102,2)">
|
<foreignObject id="fo4" x="205" y="205" width="200" height="200" clip-path="url('#circle1')" clip="rect(2px,102px,102px,2px)">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
||||||
There are issues of dynamic loading required for tiling. Accroding to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
There are issues of dynamic loading required for tiling. According to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
||||||
</div>
|
</div>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
|
|
||||||
<foreignObject id="fo5" x="250" y="250" width="200" height="200" clip-path="url('#rect8')">
|
<foreignObject id="fo5" x="250" y="250" width="200" height="200" clip-path="url('#rect8')">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
||||||
There are issues of dynamic loading required for tiling. Accroding to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
There are issues of dynamic loading required for tiling. According to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
||||||
</div>
|
</div>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
|
|
||||||
<foreignObject id="fo6" x="0" y="0" width="200" height="200" clip-path="url('#rect9')">
|
<foreignObject id="fo6" x="0" y="0" width="200" height="200" clip-path="url('#rect9')">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
||||||
There are issues of dynamic loading required for tiling. Accroding to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
There are issues of dynamic loading required for tiling. According to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
||||||
</div>
|
</div>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
|
|
||||||
<foreignObject id="fo7" x="0" y="0" width="200" height="200" clip-path="url('#rect8')">
|
<foreignObject id="fo7" x="0" y="0" width="200" height="200" clip-path="url('#rect8')">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
||||||
There are issues of dynamic loading required for tiling. Accroding to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
There are issues of dynamic loading required for tiling. According to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
||||||
</div>
|
</div>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
|
|
||||||
<foreignObject id="fo8" x="0" y="0" width="200" height="200" clip-path="url('#m_atr')">
|
<foreignObject id="fo8" x="0" y="0" width="200" height="200" clip-path="url('#m_atr')">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
<div xmlns="http://www.w3.org/1999/xhtml" style="background-color:pink;width:100%;height:100%;">
|
||||||
There are issues of dynamic loading required for tiling. Accroding to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
There are issues of dynamic loading required for tiling. According to 'postpone' attribute of Resource Priorities, the dynamic loading is controlled by positional relation with bounding box of embedded contents and container's viewport. However, each bounding boxes of embedded contents should be whole earth basically when this method is used. (green part on Example) Tiling is impossible unless this situation is changed.
|
||||||
</div>
|
</div>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
@@ -15,7 +15,7 @@ support-files = [
|
|||||||
"bounds-helper.svg",
|
"bounds-helper.svg",
|
||||||
"dataTypes-helper.svg",
|
"dataTypes-helper.svg",
|
||||||
"fragments-helper.svg",
|
"fragments-helper.svg",
|
||||||
"getBBox-method-helper.svg",
|
"getBBox-options-helper.svg",
|
||||||
"getCTM-helper.svg",
|
"getCTM-helper.svg",
|
||||||
"getSubStringLength-helper.svg",
|
"getSubStringLength-helper.svg",
|
||||||
"matrixUtils.js",
|
"matrixUtils.js",
|
||||||
@@ -82,7 +82,7 @@ support-files = [
|
|||||||
|
|
||||||
["test_fragments.html"]
|
["test_fragments.html"]
|
||||||
|
|
||||||
["test_getBBox-method.html"]
|
["test_getBBox-options.html"]
|
||||||
|
|
||||||
["test_getCTM.html"]
|
["test_getCTM.html"]
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ function run() {
|
|||||||
checkBBox("v", 95, 45, 10, 155, 0.001);
|
checkBBox("v", 95, 45, 10, 155, 0.001);
|
||||||
checkBBox("h", 195, 45, 105, 55, 0.001);
|
checkBBox("h", 195, 45, 105, 55, 0.001);
|
||||||
checkBBox("e", 95, 95, 10, 10, 0.001);
|
checkBBox("e", 95, 95, 10, 10, 0.001);
|
||||||
|
checkBBox("none", 0, 0, 10, 10, 0.001);
|
||||||
checkBBox("use_v", 195, 145, 10, 155, 0.001);
|
checkBBox("use_v", 195, 145, 10, 155, 0.001);
|
||||||
checkBBox("use_h", 295, 145, 105, 55, 0.001);
|
checkBBox("use_h", 295, 145, 105, 55, 0.001);
|
||||||
checkBBox("use_e", 195, 195, 10, 10, 0.001);
|
checkBBox("use_e", 195, 195, 10, 10, 0.001);
|
||||||
|
|||||||
@@ -1,248 +0,0 @@
|
|||||||
<!DOCTYPE HTML>
|
|
||||||
<!--
|
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=999964
|
|
||||||
-->
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8"/>
|
|
||||||
<title>Test case for Bug 999964</title>
|
|
||||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=999964">Mozilla Bug 999964</a>
|
|
||||||
<p id="display"></p>
|
|
||||||
<div id="content" style="display: none"></div>
|
|
||||||
|
|
||||||
<iframe id="svg" src="getBBox-method-helper.svg"></iframe>
|
|
||||||
|
|
||||||
<pre id="test">
|
|
||||||
<script class="testbody" type="application/javascript">
|
|
||||||
|
|
||||||
/** Test case for Bug 999964 **/
|
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
|
|
||||||
function run() {
|
|
||||||
var flag = SpecialPowers.getBoolPref("svg.new-getBBox.enabled");
|
|
||||||
if (!flag) {
|
|
||||||
ok(!flag, "skip test for bug999964.");
|
|
||||||
SimpleTest.finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var doc = $("svg").contentDocument;
|
|
||||||
|
|
||||||
function isFuzzy(a, b, error, name) {
|
|
||||||
ok(!(Math.abs(a - b) > error), name, "got " + a + ", expected " + b + " (within " + error + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBBox(id, opt) {
|
|
||||||
return doc.getElementById(id).getBBox(opt);
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkBBox(id, opt, x, y, width, height, error) {
|
|
||||||
var bbox = getBBox(id, opt);
|
|
||||||
isFuzzy(bbox.x, x, error, id + ".getBBox().x");
|
|
||||||
isFuzzy(bbox.y, y, error, id + ".getBBox().y");
|
|
||||||
isFuzzy(bbox.width, width, error, id + ".getBBox().width");
|
|
||||||
isFuzzy(bbox.height, height, error, id + ".getBBox().height");
|
|
||||||
}
|
|
||||||
|
|
||||||
function compareBBox1(id1, id2) {
|
|
||||||
var bbox1 = getBBox(id1);
|
|
||||||
var bbox2 = getBBox(id2);
|
|
||||||
is(bbox1.x, bbox2.x, id1 + ".getBBox().x");
|
|
||||||
is(bbox1.y, bbox2.y, id1 + ".getBBox().y");
|
|
||||||
isFuzzy(bbox1.width, bbox2.width, 0.0002, id1 + ".getBBox().width");
|
|
||||||
isFuzzy(bbox1.height, bbox2.height, 0.0001, id1 + ".getBBox().height");
|
|
||||||
}
|
|
||||||
|
|
||||||
function compareBBox2(id1, id2) {
|
|
||||||
// without 'x'
|
|
||||||
var bbox1 = getBBox(id1);
|
|
||||||
var bbox2 = getBBox(id2);
|
|
||||||
is(bbox1.y, bbox2.y, id1 + ".getBBox().y");
|
|
||||||
isFuzzy(bbox1.width, bbox2.width, 0.0002, id1 + ".getBBox().width");
|
|
||||||
isFuzzy(bbox1.height, bbox2.height, 0.0001, id1 + ".getBBox().height");
|
|
||||||
}
|
|
||||||
|
|
||||||
var opt = { fill: true, stroke: true, markers: true, clipped: true };
|
|
||||||
|
|
||||||
// <text>
|
|
||||||
// fill
|
|
||||||
opt = { fill: true, stroke: false, markers: false, clipped: false };
|
|
||||||
compareBBox1("text1", "text3");
|
|
||||||
compareBBox1("text2", "text4");
|
|
||||||
compareBBox1("text5", "text6");
|
|
||||||
// all
|
|
||||||
opt = { fill: true, stroke: true, markers: true, clipped: true };
|
|
||||||
compareBBox2("text1", "text3");
|
|
||||||
compareBBox2("text2", "text4");
|
|
||||||
compareBBox2("text5", "text6");
|
|
||||||
// clipped
|
|
||||||
opt = { fill: false, stroke: false, markers: false, clipped: true };
|
|
||||||
compareBBox2("text1", "text3");
|
|
||||||
compareBBox2("text2", "text4");
|
|
||||||
compareBBox2("text5", "text6");
|
|
||||||
|
|
||||||
// <image>
|
|
||||||
opt = { fill: true, stroke: true, markers: true, clipped: true };
|
|
||||||
checkBBox("image1", opt, 250, 250, 100, 100);
|
|
||||||
checkBBox("image2", opt, 53, 53, 149, 149);
|
|
||||||
checkBBox("image3", opt, 205, 53, 148, 149);
|
|
||||||
checkBBox("image4", opt, 53, 205, 149, 148);
|
|
||||||
checkBBox("image5", opt, 205, 205, 148, 148);
|
|
||||||
checkBBox("image6", opt, 52, 52, 100, 100);
|
|
||||||
checkBBox("image7", opt, 255, 52, 100, 100);
|
|
||||||
checkBBox("image8", opt, 52, 255, 100, 100);
|
|
||||||
checkBBox("image9", opt, 255, 255, 100, 100);
|
|
||||||
checkBBox("image10", opt, 200, 200, 200, 200);
|
|
||||||
checkBBox("image11", opt, 0, 0, 0, 0);
|
|
||||||
checkBBox("image12", opt, 43, 43, 714, 660);
|
|
||||||
checkBBox("image13", opt, 50, 50, 300, 300);
|
|
||||||
checkBBox("image14", opt, 0, 0, 0, 0);
|
|
||||||
|
|
||||||
opt = { fill: true, stroke: false, markers: false, clipped: false };
|
|
||||||
checkBBox("image1", opt, 150, 150, 200, 200, 0);
|
|
||||||
checkBBox("image2", opt, 2, 2, 200, 200, 0);
|
|
||||||
checkBBox("image3", opt, 205, 2, 200, 200, 0);
|
|
||||||
checkBBox("image4", opt, 2, 205, 200, 200, 0);
|
|
||||||
checkBBox("image5", opt, 205, 205, 200, 200, 0);
|
|
||||||
checkBBox("image6", opt, 2, 2, 200, 200, 0);
|
|
||||||
checkBBox("image7", opt, 205, 2, 200, 200, 0);
|
|
||||||
checkBBox("image8", opt, 2, 205, 200, 200, 0);
|
|
||||||
checkBBox("image9", opt, 205, 205, 200, 200, 0);
|
|
||||||
checkBBox("image10", opt, 0, 0, 400, 400, 0);
|
|
||||||
checkBBox("image11", opt, 0, 0, 400, 400, 0);
|
|
||||||
checkBBox("image12", opt, 25, 43, 768, 768, 0);
|
|
||||||
checkBBox("image13", opt, 0, 0, 400, 400, 0);
|
|
||||||
|
|
||||||
// <path>
|
|
||||||
opt = { fill: true, stroke: true, markers: true, clipped: true };
|
|
||||||
checkBBox("path1", opt, 2, 17, 120, 95, 0);
|
|
||||||
checkBBox("path2", opt, 156, 21, 116, 91, 0);
|
|
||||||
checkBBox("path3", opt, 6, 121, 116, 91, 0);
|
|
||||||
checkBBox("path4", opt, 2, 17, 98, 83, 0);
|
|
||||||
checkBBox("path5", opt, 156, 21, 44, 79, 0);
|
|
||||||
checkBBox("path6", opt, 6, 150, 94, 62, 0);
|
|
||||||
checkBBox("path7", opt, 2, 17, 98, 83, 0);
|
|
||||||
checkBBox("path8", opt, 156, 21, 94, 79, 0);
|
|
||||||
checkBBox("path9", opt, 6, 121, 94, 79, 0);
|
|
||||||
checkBBox("path10", opt, 10, 25, 100, 75, 0);
|
|
||||||
checkBBox("path11", opt, 160, 25, 100, 75, 0);
|
|
||||||
checkBBox("path12", opt, 10, 125, 100, 75, 0);
|
|
||||||
|
|
||||||
opt = { fill: true, stroke: false, markers: false, clipped: true };
|
|
||||||
checkBBox("path1", opt, 10, 25, 100, 75, 0);
|
|
||||||
checkBBox("path2", opt, 160, 25, 100, 75, 0);
|
|
||||||
checkBBox("path3", opt, 10, 125, 100, 75, 0);
|
|
||||||
checkBBox("path4", opt, 10, 25, 90, 75, 0);
|
|
||||||
checkBBox("path5", opt, 160, 25, 40, 75, 0);
|
|
||||||
checkBBox("path6", opt, 10, 150, 90, 50, 0);
|
|
||||||
checkBBox("path7", opt, 10, 25, 90, 75, 0);
|
|
||||||
checkBBox("path8", opt, 160, 25, 90, 75, 0);
|
|
||||||
checkBBox("path9", opt, 10, 125, 90, 75, 0);
|
|
||||||
checkBBox("path10", opt, 10, 25, 100, 75, 0);
|
|
||||||
checkBBox("path11", opt, 160, 25, 100, 75, 0);
|
|
||||||
checkBBox("path12", opt, 10, 125, 100, 75, 0);
|
|
||||||
|
|
||||||
opt = { fill: true, stroke: false, markers: false, clipped: false };
|
|
||||||
checkBBox("path1", opt, 10, 25, 100, 75, 0);
|
|
||||||
checkBBox("path2", opt, 160, 25, 100, 75, 0);
|
|
||||||
checkBBox("path3", opt, 10, 125, 100, 75, 0);
|
|
||||||
checkBBox("path4", opt, 10, 25, 100, 75, 0);
|
|
||||||
checkBBox("path5", opt, 160, 25, 100, 75, 0);
|
|
||||||
checkBBox("path6", opt, 10, 125, 100, 75, 0);
|
|
||||||
checkBBox("path7", opt, 10, 25, 100, 75, 0);
|
|
||||||
checkBBox("path8", opt, 160, 25, 100, 75, 0);
|
|
||||||
checkBBox("path9", opt, 10, 125, 100, 75, 0);
|
|
||||||
checkBBox("path10", opt, 10, 25, 100, 75, 0);
|
|
||||||
checkBBox("path11", opt, 160, 25, 100, 75, 0);
|
|
||||||
checkBBox("path12", opt, 10, 125, 100, 75, 0);
|
|
||||||
checkBBox("path13", opt, 0, 0, 100, 100, 0);
|
|
||||||
|
|
||||||
opt = { fill: false, stroke: true, markers: false, clipped: false };
|
|
||||||
checkBBox("path1", opt, 2, 17, 116, 91, 0);
|
|
||||||
checkBBox("path2", opt, 156, 21, 108, 83, 0);
|
|
||||||
checkBBox("path3", opt, 6, 121, 108, 83, 0);
|
|
||||||
checkBBox("path4", opt, 2, 17, 116, 91, 0);
|
|
||||||
checkBBox("path5", opt, 156, 21, 108, 83, 0);
|
|
||||||
checkBBox("path6", opt, 6, 121, 108, 83, 0);
|
|
||||||
checkBBox("path7", opt, 2, 17, 116, 91, 0);
|
|
||||||
checkBBox("path8", opt, 156, 21, 108, 83, 0);
|
|
||||||
checkBBox("path9", opt, 6, 121, 108, 83, 0);
|
|
||||||
checkBBox("path10", opt, 2, 17, 116, 91, 0);
|
|
||||||
checkBBox("path11", opt, 156, 21, 108, 83, 0);
|
|
||||||
checkBBox("path12", opt, 6, 121, 108, 83, 0);
|
|
||||||
|
|
||||||
opt = { fill: false, stroke: false, markers: true, clipped: false };
|
|
||||||
checkBBox("path1", opt, 10, 25, 112, 87, 0);
|
|
||||||
checkBBox("path2", opt, 160, 25, 112, 87, 0);
|
|
||||||
checkBBox("path3", opt, 10, 125, 112, 87, 0);
|
|
||||||
checkBBox("path4", opt, 10, 25, 112, 87, 0);
|
|
||||||
checkBBox("path5", opt, 160, 25, 112, 87, 0);
|
|
||||||
checkBBox("path6", opt, 10, 125, 112, 87, 0);
|
|
||||||
checkBBox("path7", opt, 10, 25, 112, 87, 0);
|
|
||||||
checkBBox("path8", opt, 160, 25, 112, 87, 0);
|
|
||||||
checkBBox("path9", opt, 10, 125, 112, 87, 0);
|
|
||||||
checkBBox("path10", opt, 10, 25, 112, 87, 0);
|
|
||||||
checkBBox("path11", opt, 160, 25, 112, 87, 0);
|
|
||||||
checkBBox("path12", opt, 10, 125, 112, 87, 0);
|
|
||||||
|
|
||||||
// <use>
|
|
||||||
opt = { fill: true, stroke: false, markers: false, clipped: false };
|
|
||||||
checkBBox("use1", opt, 70, 70, 180, 180, 0);
|
|
||||||
checkBBox("use2", opt, 250, 70, 180, 180, 0);
|
|
||||||
checkBBox("use3", opt, 70, 250, 180, 180, 0);
|
|
||||||
checkBBox("use4", opt, 22, 22, 180, 180, 0);
|
|
||||||
checkBBox("use5", opt, 225, 22, 180, 180, 0);
|
|
||||||
checkBBox("use6", opt, 22, 225, 180, 180, 0);
|
|
||||||
checkBBox("use7", opt, 225, 225, 180, 180, 0);
|
|
||||||
|
|
||||||
opt = { fill: true, stroke: true, markers: true, clipped: true };
|
|
||||||
checkBBox("use1", opt, 70, 66, 180, 94, 0);
|
|
||||||
checkBBox("use2", opt, 250, 70, 180, 90, 0);
|
|
||||||
checkBBox("use3", opt, 70, 250, 180, 90, 0);
|
|
||||||
checkBBox("use4", opt, 18, 18, 134, 134, 0);
|
|
||||||
checkBBox("use5", opt, 221, 18, 134, 134, 0);
|
|
||||||
checkBBox("use6", opt, 18, 221, 134, 134, 0);
|
|
||||||
checkBBox("use7", opt, 221, 221, 134, 134, 0);
|
|
||||||
checkBBox("use8", opt, 0, 0, 0, 0, 0);
|
|
||||||
|
|
||||||
// <foreignObject>
|
|
||||||
opt = { fill: true, stroke: false, markers: false, clipped: false };
|
|
||||||
checkBBox("fo1", opt, 2, 2, 200, 200, 0);
|
|
||||||
checkBBox("fo2", opt, 205, 2, 200, 200, 0);
|
|
||||||
checkBBox("fo3", opt, 2, 205, 200, 200, 0);
|
|
||||||
checkBBox("fo4", opt, 205, 205, 200, 200, 0);
|
|
||||||
checkBBox("fo5", opt, 250, 250, 200, 200, 0);
|
|
||||||
checkBBox("fo6", opt, 0, 0, 200, 200, 0);
|
|
||||||
checkBBox("fo7", opt, 0, 0, 200, 200, 0);
|
|
||||||
|
|
||||||
opt = { fill: true, stroke: true, markers: true, clipped: true };
|
|
||||||
checkBBox("fo1", opt, 53, 53, 51, 51, 0);
|
|
||||||
checkBBox("fo2", opt, 205, 53, 148, 149, 0);
|
|
||||||
checkBBox("fo3", opt, 53, 205, 149, 148, 0);
|
|
||||||
checkBBox("fo4", opt, 207, 207, 100, 100, 0);
|
|
||||||
checkBBox("fo5", opt, 0, 0, 0, 0, 0);
|
|
||||||
checkBBox("fo6", opt, 100, 100, 100, 100, 0);
|
|
||||||
checkBBox("fo7", opt, 10, 10, 180, 180, 0);
|
|
||||||
checkBBox("fo8", opt, 0, 0, 0, 0, 0);
|
|
||||||
|
|
||||||
// from http://www.w3.org/Graphics/SVG/Test/20110816/harness/htmlObjectApproved/masking-path-07-b.html
|
|
||||||
opt = { fill: true, stroke: true, markers: true, clipped: true };
|
|
||||||
checkBBox("rect-1", opt, 10, 10, 140, 140, 0);
|
|
||||||
checkBBox("rect-2", opt, 50, 30, 25, 100, 0);
|
|
||||||
checkBBox("rect-3", opt, 50, 50, 100, 100, 0);
|
|
||||||
checkBBox("g1", opt, 50, 50, 100, 100, 0);
|
|
||||||
|
|
||||||
SimpleTest.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener("load", run);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</pre>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
244
dom/svg/test/test_getBBox-options.html
Normal file
244
dom/svg/test/test_getBBox-options.html
Normal file
@@ -0,0 +1,244 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=999964
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<title>Test case for Bug 999964</title>
|
||||||
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=999964">Mozilla Bug 999964</a>
|
||||||
|
<p id="display"></p>
|
||||||
|
<div id="content" style="display: none"></div>
|
||||||
|
|
||||||
|
<iframe id="svg" src="getBBox-options-helper.svg"></iframe>
|
||||||
|
|
||||||
|
<pre id="test">
|
||||||
|
<script class="testbody" type="application/javascript">
|
||||||
|
|
||||||
|
/** Test case for Bug 999964 **/
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
function run() {
|
||||||
|
SpecialPowers.pushPrefEnv({'set': [['svg.new-getBBox.enabled', true]]}, runTests);
|
||||||
|
}
|
||||||
|
|
||||||
|
function runTests() {
|
||||||
|
var doc = $("svg").contentDocument;
|
||||||
|
|
||||||
|
function getBBox(id, opt) {
|
||||||
|
return doc.getElementById(id).getBBox(opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkBBox(id, opt, x, y, width, height, epsilon) {
|
||||||
|
if (epsilon == undefined) {
|
||||||
|
epsilon = 0.1;
|
||||||
|
}
|
||||||
|
var bbox = getBBox(id, opt);
|
||||||
|
isfuzzy(bbox.x, x, epsilon, id + ".getBBox().x " + JSON.stringify(opt));
|
||||||
|
isfuzzy(bbox.y, y, epsilon, id + ".getBBox().y " + JSON.stringify(opt));
|
||||||
|
isfuzzy(bbox.width, width, epsilon, id + ".getBBox().width " + JSON.stringify(opt));
|
||||||
|
isfuzzy(bbox.height, height, epsilon, id + ".getBBox().height " + JSON.stringify(opt));
|
||||||
|
}
|
||||||
|
|
||||||
|
function compareBBox1(id1, id2) {
|
||||||
|
var bbox1 = getBBox(id1);
|
||||||
|
var bbox2 = getBBox(id2);
|
||||||
|
is(bbox1.x, bbox2.x, id1 + ".getBBox().x");
|
||||||
|
is(bbox1.y, bbox2.y, id1 + ".getBBox().y");
|
||||||
|
isfuzzy(bbox1.width, bbox2.width, 0.0002, id1 + ".getBBox().width");
|
||||||
|
isfuzzy(bbox1.height, bbox2.height, 0.0001, id1 + ".getBBox().height");
|
||||||
|
}
|
||||||
|
|
||||||
|
function compareBBox2(id1, id2) {
|
||||||
|
// without 'x'
|
||||||
|
var bbox1 = getBBox(id1);
|
||||||
|
var bbox2 = getBBox(id2);
|
||||||
|
is(bbox1.y, bbox2.y, id1 + ".getBBox().y");
|
||||||
|
isfuzzy(bbox1.width, bbox2.width, 0.0002, id1 + ".getBBox().width");
|
||||||
|
isfuzzy(bbox1.height, bbox2.height, 0.0001, id1 + ".getBBox().height");
|
||||||
|
}
|
||||||
|
|
||||||
|
var opt = { fill: true, stroke: true, markers: true, clipped: true };
|
||||||
|
|
||||||
|
// <text>
|
||||||
|
// fill
|
||||||
|
opt = { fill: true, stroke: false, markers: false, clipped: false };
|
||||||
|
compareBBox1("text1", "text3");
|
||||||
|
compareBBox1("text2", "text4");
|
||||||
|
compareBBox1("text5", "text6");
|
||||||
|
// all
|
||||||
|
opt = { fill: true, stroke: true, markers: true, clipped: true };
|
||||||
|
compareBBox2("text1", "text3");
|
||||||
|
compareBBox2("text2", "text4");
|
||||||
|
compareBBox2("text5", "text6");
|
||||||
|
// clipped
|
||||||
|
opt = { fill: false, stroke: false, markers: false, clipped: true };
|
||||||
|
compareBBox2("text1", "text3");
|
||||||
|
compareBBox2("text2", "text4");
|
||||||
|
compareBBox2("text5", "text6");
|
||||||
|
|
||||||
|
// <image>
|
||||||
|
opt = { fill: true, stroke: true, markers: true, clipped: true };
|
||||||
|
checkBBox("image1", opt, 160, 160, 80, 80);
|
||||||
|
checkBBox("image2", opt, 53, 53, 149, 149);
|
||||||
|
checkBBox("image3", opt, 205, 53, 148, 149);
|
||||||
|
checkBBox("image4", opt, 53, 205, 149, 148);
|
||||||
|
checkBBox("image5", opt, 205, 205, 148, 148);
|
||||||
|
checkBBox("image6", opt, 52, 52, 100, 100);
|
||||||
|
checkBBox("image7", opt, 255, 52, 100, 100);
|
||||||
|
checkBBox("image8", opt, 52, 255, 100, 100);
|
||||||
|
checkBBox("image9", opt, 255, 255, 100, 100);
|
||||||
|
checkBBox("image10", opt, 200, 200, 200, 200);
|
||||||
|
checkBBox("image11", opt, 0, 0, 0, 0);
|
||||||
|
checkBBox("image12", opt, 43, 43, 714, 660);
|
||||||
|
checkBBox("image13", opt, 50, 50, 300, 300);
|
||||||
|
checkBBox("image14", opt, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
opt = { fill: true, stroke: false, markers: false, clipped: false };
|
||||||
|
checkBBox("image1", opt, 150, 150, 200, 200);
|
||||||
|
checkBBox("image2", opt, 2, 2, 200, 200);
|
||||||
|
checkBBox("image3", opt, 205, 2, 200, 200);
|
||||||
|
checkBBox("image4", opt, 2, 205, 200, 200);
|
||||||
|
checkBBox("image5", opt, 205, 205, 200, 200);
|
||||||
|
checkBBox("image6", opt, 2, 2, 200, 200);
|
||||||
|
checkBBox("image7", opt, 205, 2, 200, 200);
|
||||||
|
checkBBox("image8", opt, 2, 205, 200, 200);
|
||||||
|
checkBBox("image9", opt, 205, 205, 200, 200);
|
||||||
|
checkBBox("image10", opt, 0, 0, 400, 400);
|
||||||
|
checkBBox("image11", opt, 0, 0, 400, 400);
|
||||||
|
checkBBox("image12", opt, 25, 43, 768, 768);
|
||||||
|
checkBBox("image13", opt, 0, 0, 400, 400);
|
||||||
|
|
||||||
|
// <path>
|
||||||
|
opt = { fill: true, stroke: true, markers: true, clipped: true };
|
||||||
|
checkBBox("path1", opt, 6.2, 20.8, 115.8, 91.2, 2);
|
||||||
|
checkBBox("path2", opt, 156.2, 20.8, 115.8, 91.2, 2);
|
||||||
|
checkBBox("path3", opt, 6.2, 120.7, 115.8, 91.2, 2);
|
||||||
|
checkBBox("path4", opt, 6.2, 20.8, 93.8, 79.2, 2);
|
||||||
|
checkBBox("path5", opt, 156.2, 20.8, 43.8, 79.2, 2);
|
||||||
|
checkBBox("path6", opt, 6.2, 150, 93.8, 62, 2);
|
||||||
|
checkBBox("path7", opt, 6.2, 20.8, 93.8, 79.2, 2);
|
||||||
|
checkBBox("path8", opt, 156.2, 20.8, 93.8, 79.2, 2);
|
||||||
|
checkBBox("path9", opt, 6.2, 120.8, 93.8, 79.2, 2);
|
||||||
|
checkBBox("path10", opt, 10, 25, 100, 75);
|
||||||
|
checkBBox("path11", opt, 160, 25, 100, 75);
|
||||||
|
checkBBox("path12", opt, 10, 125, 100, 75);
|
||||||
|
|
||||||
|
opt = { fill: true, stroke: false, markers: false, clipped: true };
|
||||||
|
checkBBox("path1", opt, 10, 25, 100, 75);
|
||||||
|
checkBBox("path2", opt, 160, 25, 100, 75);
|
||||||
|
checkBBox("path3", opt, 10, 125, 100, 75);
|
||||||
|
checkBBox("path4", opt, 10, 25, 90, 75);
|
||||||
|
checkBBox("path5", opt, 160, 25, 40, 75);
|
||||||
|
checkBBox("path6", opt, 10, 150, 90, 50);
|
||||||
|
checkBBox("path7", opt, 10, 25, 90, 75);
|
||||||
|
checkBBox("path8", opt, 160, 25, 90, 75);
|
||||||
|
checkBBox("path9", opt, 10, 125, 90, 75);
|
||||||
|
checkBBox("path10", opt, 10, 25, 100, 75);
|
||||||
|
checkBBox("path11", opt, 160, 25, 100, 75);
|
||||||
|
checkBBox("path12", opt, 10, 125, 100, 75);
|
||||||
|
|
||||||
|
opt = { fill: true, stroke: false, markers: false, clipped: false };
|
||||||
|
checkBBox("path1", opt, 10, 25, 100, 75);
|
||||||
|
checkBBox("path2", opt, 160, 25, 100, 75);
|
||||||
|
checkBBox("path3", opt, 10, 125, 100, 75);
|
||||||
|
checkBBox("path4", opt, 10, 25, 100, 75);
|
||||||
|
checkBBox("path5", opt, 160, 25, 100, 75);
|
||||||
|
checkBBox("path6", opt, 10, 125, 100, 75);
|
||||||
|
checkBBox("path7", opt, 10, 25, 100, 75);
|
||||||
|
checkBBox("path8", opt, 160, 25, 100, 75);
|
||||||
|
checkBBox("path9", opt, 10, 125, 100, 75);
|
||||||
|
checkBBox("path10", opt, 10, 25, 100, 75);
|
||||||
|
checkBBox("path11", opt, 160, 25, 100, 75);
|
||||||
|
checkBBox("path12", opt, 10, 125, 100, 75);
|
||||||
|
checkBBox("path13", opt, 0, 0, 100, 100);
|
||||||
|
|
||||||
|
opt = { fill: false, stroke: true, markers: false, clipped: false };
|
||||||
|
checkBBox("path1", opt, 6.2, 20.8, 107.8, 83.2, 4);
|
||||||
|
checkBBox("path2", opt, 156.2, 20.8, 107.8, 83.2, 4);
|
||||||
|
checkBBox("path3", opt, 6.2, 120.8, 107.8, 83.2, 4);
|
||||||
|
checkBBox("path4", opt, 6.2, 20.8, 107.8, 83.2, 4);
|
||||||
|
checkBBox("path5", opt, 156.2, 20.8, 107.8, 83.2, 4);
|
||||||
|
checkBBox("path6", opt, 6.2, 120.8, 107.8, 83.2, 4);
|
||||||
|
checkBBox("path7", opt, 6.2, 20.8, 107.8, 83.2, 4);
|
||||||
|
checkBBox("path8", opt, 156.2, 20.8, 107.8, 83.2, 4);
|
||||||
|
checkBBox("path9", opt, 6.2, 120.8, 107.8, 83.2, 4);
|
||||||
|
checkBBox("path10", opt, 6.2, 20.8, 107.8, 83.2, 4);
|
||||||
|
checkBBox("path11", opt, 156.2, 20.8, 107.8, 83.2, 4);
|
||||||
|
checkBBox("path12", opt, 6.2, 120.8, 107.8, 83.2, 4);
|
||||||
|
|
||||||
|
opt = { fill: false, stroke: false, markers: true, clipped: false };
|
||||||
|
checkBBox("path1", opt, 10, 25, 112, 87);
|
||||||
|
checkBBox("path2", opt, 160, 25, 112, 87);
|
||||||
|
checkBBox("path3", opt, 10, 125, 112, 87);
|
||||||
|
checkBBox("path4", opt, 10, 25, 112, 87);
|
||||||
|
checkBBox("path5", opt, 160, 25, 112, 87);
|
||||||
|
checkBBox("path6", opt, 10, 125, 112, 87);
|
||||||
|
checkBBox("path7", opt, 10, 25, 112, 87);
|
||||||
|
checkBBox("path8", opt, 160, 25, 112, 87);
|
||||||
|
checkBBox("path9", opt, 10, 125, 112, 87);
|
||||||
|
checkBBox("path10", opt, 10, 25, 112, 87);
|
||||||
|
checkBBox("path11", opt, 160, 25, 112, 87);
|
||||||
|
checkBBox("path12", opt, 10, 125, 112, 87);
|
||||||
|
|
||||||
|
// <use>
|
||||||
|
opt = { fill: true, stroke: false, markers: false, clipped: false };
|
||||||
|
checkBBox("use1", opt, 70, 70, 180, 180);
|
||||||
|
checkBBox("use2", opt, 250, 70, 180, 180);
|
||||||
|
checkBBox("use3", opt, 70, 250, 180, 180);
|
||||||
|
checkBBox("use4", opt, 22, 22, 180, 180);
|
||||||
|
checkBBox("use5", opt, 225, 22, 180, 180);
|
||||||
|
checkBBox("use6", opt, 22, 225, 180, 180);
|
||||||
|
checkBBox("use7", opt, 225, 225, 180, 180);
|
||||||
|
|
||||||
|
opt = { fill: true, stroke: true, markers: true, clipped: true };
|
||||||
|
checkBBox("use1", opt, 70, 66, 180, 94);
|
||||||
|
checkBBox("use2", opt, 250, 70, 180, 90);
|
||||||
|
checkBBox("use3", opt, 70, 250, 180, 90);
|
||||||
|
checkBBox("use4", opt, 18, 18, 134, 134);
|
||||||
|
checkBBox("use5", opt, 221, 18, 134, 134);
|
||||||
|
checkBBox("use6", opt, 18, 221, 134, 134);
|
||||||
|
checkBBox("use7", opt, 221, 221, 134, 134);
|
||||||
|
checkBBox("use8", opt, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
// <foreignObject>
|
||||||
|
opt = { fill: true, stroke: false, markers: false, clipped: false };
|
||||||
|
checkBBox("fo1", opt, 2, 2, 200, 200);
|
||||||
|
checkBBox("fo2", opt, 205, 2, 200, 200);
|
||||||
|
checkBBox("fo3", opt, 2, 205, 200, 200);
|
||||||
|
checkBBox("fo4", opt, 205, 205, 200, 200);
|
||||||
|
checkBBox("fo5", opt, 250, 250, 200, 200);
|
||||||
|
checkBBox("fo6", opt, 0, 0, 200, 200);
|
||||||
|
checkBBox("fo7", opt, 0, 0, 200, 200);
|
||||||
|
|
||||||
|
opt = { fill: true, stroke: true, markers: true, clipped: true };
|
||||||
|
checkBBox("fo1", opt, 53, 53, 51, 51);
|
||||||
|
checkBBox("fo2", opt, 205, 53, 148, 149);
|
||||||
|
checkBBox("fo3", opt, 53, 205, 149, 148);
|
||||||
|
checkBBox("fo4", opt, 207, 207, 100, 100);
|
||||||
|
checkBBox("fo5", opt, 0, 0, 0, 0);
|
||||||
|
checkBBox("fo6", opt, 100, 100, 100, 100);
|
||||||
|
checkBBox("fo7", opt, 10, 10, 180, 180);
|
||||||
|
checkBBox("fo8", opt, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
// from http://www.w3.org/Graphics/SVG/Test/20110816/harness/htmlObjectApproved/masking-path-07-b.html
|
||||||
|
opt = { fill: true, stroke: true, markers: true, clipped: true };
|
||||||
|
checkBBox("rect-1", opt, 10, 10, 140, 140);
|
||||||
|
checkBBox("rect-2", opt, 50, 30, 25, 100);
|
||||||
|
checkBBox("rect-3", opt, 50, 50, 100, 100);
|
||||||
|
checkBBox("g1", opt, 50, 50, 100, 100);
|
||||||
|
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("load", run);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -424,15 +424,15 @@ SVGBBox SVGClipPathFrame::GetBBoxForClipPathFrame(const SVGBBox& aBBox,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsIContent* node = GetContent()->GetFirstChild();
|
nsIContent* node = GetContent()->GetFirstChild();
|
||||||
SVGBBox unionBBox, tmpBBox;
|
SVGBBox unionBBox;
|
||||||
for (; node; node = node->GetNextSibling()) {
|
for (; node; node = node->GetNextSibling()) {
|
||||||
if (nsIFrame* frame = node->GetPrimaryFrame()) {
|
if (nsIFrame* frame = node->GetPrimaryFrame()) {
|
||||||
ISVGDisplayableFrame* svg = do_QueryFrame(frame);
|
ISVGDisplayableFrame* svg = do_QueryFrame(frame);
|
||||||
if (svg) {
|
if (svg) {
|
||||||
gfxMatrix matrix =
|
gfxMatrix matrix =
|
||||||
SVGUtils::GetTransformMatrixInUserSpace(frame) * aMatrix;
|
SVGUtils::GetTransformMatrixInUserSpace(frame) * aMatrix;
|
||||||
tmpBBox = svg->GetBBoxContribution(gfx::ToMatrix(matrix),
|
SVGBBox tmpBBox = svg->GetBBoxContribution(
|
||||||
SVGUtils::eBBoxIncludeFill);
|
gfx::ToMatrix(matrix), SVGUtils::eBBoxIncludeFillGeometry);
|
||||||
SVGClipPathFrame* clipPathFrame;
|
SVGClipPathFrame* clipPathFrame;
|
||||||
if (SVGObserverUtils::GetAndObserveClipPath(frame, &clipPathFrame) !=
|
if (SVGObserverUtils::GetAndObserveClipPath(frame, &clipPathFrame) !=
|
||||||
SVGObserverUtils::eHasRefsSomeInvalid &&
|
SVGObserverUtils::eHasRefsSomeInvalid &&
|
||||||
@@ -449,9 +449,8 @@ SVGBBox SVGClipPathFrame::GetBBoxForClipPathFrame(const SVGBBox& aBBox,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (clipPathThatClipsClipPath) {
|
if (clipPathThatClipsClipPath) {
|
||||||
tmpBBox = clipPathThatClipsClipPath->GetBBoxForClipPathFrame(aBBox, aMatrix,
|
unionBBox.Intersect(clipPathThatClipsClipPath->GetBBoxForClipPathFrame(
|
||||||
aFlags);
|
aBBox, aMatrix, aFlags));
|
||||||
unionBBox.Intersect(tmpBBox);
|
|
||||||
}
|
}
|
||||||
return unionBBox;
|
return unionBBox;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -809,8 +809,7 @@ gfxRect SVGUtils::GetClipRectForFrame(const nsIFrame* aFrame, float aX,
|
|||||||
|
|
||||||
const auto& rect = effects->mClip.AsRect();
|
const auto& rect = effects->mClip.AsRect();
|
||||||
nsRect coordClipRect = rect.ToLayoutRect();
|
nsRect coordClipRect = rect.ToLayoutRect();
|
||||||
nsIntRect clipPxRect = coordClipRect.ToOutsidePixels(
|
nsIntRect clipPxRect = coordClipRect.ToOutsidePixels(AppUnitsPerCSSPixel());
|
||||||
aFrame->PresContext()->AppUnitsPerDevPixel());
|
|
||||||
gfxRect clipRect =
|
gfxRect clipRect =
|
||||||
gfxRect(clipPxRect.x, clipPxRect.y, clipPxRect.width, clipPxRect.height);
|
gfxRect(clipPxRect.x, clipPxRect.y, clipPxRect.width, clipPxRect.height);
|
||||||
if (rect.right.IsAuto()) {
|
if (rect.right.IsAuto()) {
|
||||||
@@ -909,17 +908,14 @@ gfxRect SVGUtils::GetBBox(nsIFrame* aFrame, uint32_t aFlags,
|
|||||||
// Account for 'clipped'.
|
// Account for 'clipped'.
|
||||||
if (aFlags & SVGUtils::eBBoxIncludeClipped) {
|
if (aFlags & SVGUtils::eBBoxIncludeClipped) {
|
||||||
gfxRect clipRect;
|
gfxRect clipRect;
|
||||||
float x, y, width, height;
|
|
||||||
gfxRect fillBBox =
|
gfxRect fillBBox =
|
||||||
svg->GetBBoxContribution({}, SVGUtils::eBBoxIncludeFill).ToThebesRect();
|
svg->GetBBoxContribution({}, SVGUtils::eBBoxIncludeFill).ToThebesRect();
|
||||||
x = fillBBox.x;
|
|
||||||
y = fillBBox.y;
|
|
||||||
width = fillBBox.width;
|
|
||||||
height = fillBBox.height;
|
|
||||||
// XXX Should probably check for overflow: clip too.
|
// XXX Should probably check for overflow: clip too.
|
||||||
bool hasClip = aFrame->StyleDisplay()->IsScrollableOverflow();
|
bool hasClip = aFrame->StyleDisplay()->IsScrollableOverflow();
|
||||||
if (hasClip) {
|
if (hasClip) {
|
||||||
clipRect = SVGUtils::GetClipRectForFrame(aFrame, x, y, width, height);
|
clipRect = SVGUtils::GetClipRectForFrame(aFrame, 0.0f, 0.0f,
|
||||||
|
fillBBox.width, fillBBox.height);
|
||||||
|
clipRect.MoveBy(fillBBox.TopLeft());
|
||||||
if (aFrame->IsSVGForeignObjectFrame() || aFrame->IsSVGUseFrame()) {
|
if (aFrame->IsSVGForeignObjectFrame() || aFrame->IsSVGUseFrame()) {
|
||||||
clipRect = matrix.TransformBounds(clipRect);
|
clipRect = matrix.TransformBounds(clipRect);
|
||||||
}
|
}
|
||||||
@@ -927,14 +923,14 @@ gfxRect SVGUtils::GetBBox(nsIFrame* aFrame, uint32_t aFlags,
|
|||||||
SVGClipPathFrame* clipPathFrame;
|
SVGClipPathFrame* clipPathFrame;
|
||||||
if (SVGObserverUtils::GetAndObserveClipPath(aFrame, &clipPathFrame) ==
|
if (SVGObserverUtils::GetAndObserveClipPath(aFrame, &clipPathFrame) ==
|
||||||
SVGObserverUtils::eHasRefsSomeInvalid) {
|
SVGObserverUtils::eHasRefsSomeInvalid) {
|
||||||
bbox = gfxRect(0, 0, 0, 0);
|
bbox = gfxRect();
|
||||||
} else {
|
} else {
|
||||||
if (clipPathFrame) {
|
if (clipPathFrame) {
|
||||||
SVGClipPathElement* clipContent =
|
SVGClipPathElement* clipContent =
|
||||||
static_cast<SVGClipPathElement*>(clipPathFrame->GetContent());
|
static_cast<SVGClipPathElement*>(clipPathFrame->GetContent());
|
||||||
if (clipContent->IsUnitsObjectBoundingBox()) {
|
if (clipContent->IsUnitsObjectBoundingBox()) {
|
||||||
matrix.PreTranslate(gfxPoint(x, y));
|
matrix.PreTranslate(fillBBox.TopLeft());
|
||||||
matrix.PreScale(width, height);
|
matrix.PreScale(fillBBox.width, fillBBox.height);
|
||||||
} else if (aFrame->IsSVGForeignObjectFrame()) {
|
} else if (aFrame->IsSVGForeignObjectFrame()) {
|
||||||
matrix = gfxMatrix();
|
matrix = gfxMatrix();
|
||||||
}
|
}
|
||||||
@@ -949,7 +945,7 @@ gfxRect SVGUtils::GetBBox(nsIFrame* aFrame, uint32_t aFlags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bbox.IsEmpty()) {
|
if (bbox.IsEmpty()) {
|
||||||
bbox = gfxRect(0, 0, 0, 0);
|
bbox = gfxRect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user