summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc27
1 files changed, 20 insertions, 7 deletions
diff --git a/chromium/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc b/chromium/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc
index 5b61f954cd0..5ce9a312d13 100644
--- a/chromium/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc
+++ b/chromium/third_party/blink/renderer/core/layout/svg/layout_svg_inline.cc
@@ -73,17 +73,30 @@ bool LayoutSVGInline::IsObjectBoundingBoxValid() const {
return FirstLineBox();
}
+// static
+void LayoutSVGInline::ObjectBoundingBoxForCursor(NGInlineCursor& cursor,
+ FloatRect& bounds) {
+ for (; cursor; cursor.MoveToNextForSameLayoutObject()) {
+ const NGFragmentItem& item = *cursor.CurrentItem();
+ if (item.Type() == NGFragmentItem::kSvgText) {
+ bounds.Unite(item.ObjectBoundingBox());
+ } else if (NGInlineCursor descendants = cursor.CursorForDescendants()) {
+ for (; descendants; descendants.MoveToNext()) {
+ const NGFragmentItem& descendant_item = *descendants.CurrentItem();
+ if (descendant_item.Type() == NGFragmentItem::kSvgText)
+ bounds.Unite(descendant_item.ObjectBoundingBox());
+ }
+ }
+ }
+}
+
FloatRect LayoutSVGInline::ObjectBoundingBox() const {
NOT_DESTROYED();
FloatRect bounds;
if (IsInLayoutNGInlineFormattingContext()) {
NGInlineCursor cursor;
- for (cursor.MoveToIncludingCulledInline(*this); cursor;
- cursor.MoveToNextForSameLayoutObject()) {
- const NGFragmentItem& item = *cursor.CurrentItem();
- if (item.Type() == NGFragmentItem::kSVGText)
- bounds.Unite(item.ObjectBoundingBox());
- }
+ cursor.MoveToIncludingCulledInline(*this);
+ ObjectBoundingBoxForCursor(cursor, bounds);
return bounds;
}
for (InlineFlowBox* box : *LineBoxes())
@@ -126,7 +139,7 @@ void LayoutSVGInline::AbsoluteQuads(Vector<FloatQuad>& quads,
for (cursor.MoveToIncludingCulledInline(*this); cursor;
cursor.MoveToNextForSameLayoutObject()) {
const NGFragmentItem& item = *cursor.CurrentItem();
- if (item.Type() == NGFragmentItem::kSVGText) {
+ if (item.Type() == NGFragmentItem::kSvgText) {
quads.push_back(
LocalToAbsoluteQuad(SVGLayoutSupport::ExtendTextBBoxWithStroke(
*this, item.ObjectBoundingBox()),