Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit f3136a3

Browse files
committed
Bug 1693032 - SVG text reflow can flow through multiple outer svg elements r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D105350
1 parent 9850573 commit f3136a3

File tree

5 files changed

+26
-4
lines changed

5 files changed

+26
-4
lines changed

layout/svg/SVGContainerFrame.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ nsIFrame* SVGDisplayContainerFrame::GetFrameForPoint(const gfxPoint& aPoint) {
281281
}
282282

283283
void SVGDisplayContainerFrame::ReflowSVG() {
284-
NS_ASSERTION(SVGUtils::OuterSVGIsCallingReflowSVG(this),
285-
"This call is probably a wasteful mistake");
284+
MOZ_ASSERT(SVGUtils::AnyOuterSVGIsCallingReflowSVG(this),
285+
"This call is probably a wasteful mistake");
286286

287287
MOZ_ASSERT(!HasAnyStateBits(NS_FRAME_IS_NONDISPLAY),
288288
"ReflowSVG mechanism not designed for this");

layout/svg/SVGObserverUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ void SVGTextPathObserver::OnRenderingChange() {
490490
text->AddStateBits(NS_STATE_SVG_TEXT_CORRESPONDENCE_DIRTY |
491491
NS_STATE_SVG_POSITIONING_DIRTY);
492492

493-
if (SVGUtils::OuterSVGIsCallingReflowSVG(text)) {
493+
if (SVGUtils::AnyOuterSVGIsCallingReflowSVG(text)) {
494494
text->AddStateBits(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
495495
if (text->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)) {
496496
text->ReflowSVGNonDisplayText();

layout/svg/SVGTextFrame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3294,7 +3294,7 @@ nsIFrame* SVGTextFrame::GetFrameForPoint(const gfxPoint& aPoint) {
32943294
}
32953295

32963296
void SVGTextFrame::ReflowSVG() {
3297-
MOZ_ASSERT(SVGUtils::OuterSVGIsCallingReflowSVG(this),
3297+
MOZ_ASSERT(SVGUtils::AnyOuterSVGIsCallingReflowSVG(this),
32983298
"This call is probaby a wasteful mistake");
32993299

33003300
MOZ_ASSERT(!HasAnyStateBits(NS_FRAME_IS_NONDISPLAY),

layout/svg/crashtests/1693032.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<script>
5+
document.addEventListener('DOMContentLoaded', () => {
6+
const svg_1 = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
7+
const svg_2 = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
8+
const switch_1 = document.createElementNS('http://www.w3.org/2000/svg', 'switch')
9+
const metadata_1 = document.createElementNS('http://www.w3.org/2000/svg', 'metadata')
10+
const foreign_1 = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject')
11+
const text_1 = document.createElementNS('http://www.w3.org/2000/svg', 'text')
12+
switch_1.appendChild(metadata_1)
13+
svg_2.appendChild(text_1)
14+
foreign_1.appendChild(svg_2)
15+
switch_1.appendChild(foreign_1)
16+
svg_1.appendChild(switch_1)
17+
document.documentElement.appendChild(svg_1)
18+
})
19+
</script>
20+
</head>
21+
</html>

layout/svg/crashtests/crashtests.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,4 @@ load 1605223-1.html
237237
load 1609663.html
238238
load 1671950.html
239239
load 1678947.html
240+
load 1693032.html

0 commit comments

Comments
 (0)