Index: Source/core/dom/Range.cpp |
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp |
index a27e461926f28db32139dffb77454fcbbe4abe0f..449aa66d63792d1272a6c3902ad4e7ad79c00a41 100644 |
--- a/Source/core/dom/Range.cpp |
+++ b/Source/core/dom/Range.cpp |
@@ -1775,9 +1775,18 @@ FloatRect Range::boundingRect() const |
Vector<FloatQuad> quads; |
getBorderAndTextQuads(quads); |
+ if (quads.isEmpty()) |
+ return FloatRect(); |
+ |
FloatRect result; |
- for (const FloatQuad& quad : quads) |
- result.unite(quad.boundingBox()); |
+ for (const FloatQuad& quad : quads) { |
+ if (result.isEmpty()) { |
+ result = quad.boundingBox(); |
+ continue; |
+ } |
+ |
+ result.uniteEvenIfEmpty(quad.boundingBox()); |
+ } |
return result; |
} |