Commit 5551119d authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

LayoutBoxModelObject::HasNonEmptyLayoutSize ignores SVG model objects

Extend the DCHECK to also cover SVG layout objects. The IsBox() check
should cover the SVG root, and if it is zero-sized any descendant should
not be considered to have a "non-empty" layout size. Overflow is
disregarded (as it seems to be in general in this method.)

Bug: 769459
Change-Id: Iea15b86032094a15608b614f5baa1057c5d6a686
Reviewed-on: https://chromium-review.googlesource.com/689997Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#505072}
parent a3d01ad2
...@@ -50,6 +50,11 @@ static const char kBlockWithText[] = ...@@ -50,6 +50,11 @@ static const char kBlockWithText[] =
" <div>Hello</div> " " <div>Hello</div> "
"</div>"; "</div>";
static const char kBlockWithEmptyZeroSizedSVG[] =
"<div id='testElement'>"
" <svg height='0'><g><rect width='100' height='100'/></g></svg> "
"</div>";
static const char kBlockWithInlines[] = static const char kBlockWithInlines[] =
"<div id='testElement'>" "<div id='testElement'>"
" <span>Hello</span> " " <span>Hello</span> "
...@@ -99,6 +104,9 @@ TEST_F(WebElementTest, HasNonEmptyLayoutSize) { ...@@ -99,6 +104,9 @@ TEST_F(WebElementTest, HasNonEmptyLayoutSize) {
InsertHTML(kBlockWithEmptyInlines); InsertHTML(kBlockWithEmptyInlines);
EXPECT_FALSE(TestElement().HasNonEmptyLayoutSize()); EXPECT_FALSE(TestElement().HasNonEmptyLayoutSize());
InsertHTML(kBlockWithEmptyZeroSizedSVG);
EXPECT_FALSE(TestElement().HasNonEmptyLayoutSize());
InsertHTML(kBlockWithContinuations); InsertHTML(kBlockWithContinuations);
EXPECT_TRUE(TestElement().HasNonEmptyLayoutSize()); EXPECT_TRUE(TestElement().HasNonEmptyLayoutSize());
......
...@@ -603,7 +603,7 @@ bool LayoutBoxModelObject::HasNonEmptyLayoutSize() const { ...@@ -603,7 +603,7 @@ bool LayoutBoxModelObject::HasNonEmptyLayoutSize() const {
if (!layout_inline.LinesBoundingBox().IsEmpty()) if (!layout_inline.LinesBoundingBox().IsEmpty())
return true; return true;
} else { } else {
DCHECK(object->IsText()); DCHECK(object->IsText() || object->IsSVG());
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment