Calling Element::HasNonEmptyLayoutSize on the parent element of an svg DCHECKs |
||||
Issue descriptionChrome Version: 63.0.3222.0 What steps will reproduce the problem? (1) Visit beta.theglobeandmail.com (2) Call |blink::Element::HasNonEmptyLayoutSize| with the element of the title in the header (A class="c-header-title__anchor") We hit the DCHECK [1:1:0927/145647.527988:FATAL:LayoutBoxModelObject.cpp(607)] Check failed: object->IsText(). where the object is LayoutSVGContainer use class='o-logo o-logo--large' Note that calling |HasNonEmptyLayoutSize| with the parent (DIV class="c-header-title__container") works fine.
,
Sep 27 2017
My work on the function was just a renaming. Please feel free the change the DCHECK to be more appropriate.
,
Sep 28 2017
,
Sep 28 2017
Some more context would have been nice here - the fact that the <svg> root layout box is (apparently) empty (or it wouldn't have been descended into) seems to indicate that something odd was going on when HasNonEmptyLayoutSize was invoked. (Replaced content generally doesn't end up with a zero dimension unless told to. 'rem' being 0 seems like an oddity in most cases.)
,
Sep 28 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5551119d425e01a440c59870650de1aa03147cf9 commit 5551119d425e01a440c59870650de1aa03147cf9 Author: Fredrik Söderquist <fs@opera.com> Date: Thu Sep 28 17:19:28 2017 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/689997 Reviewed-by: Philip Rogers <pdr@chromium.org> Commit-Queue: Fredrik Söderquist <fs@opera.com> Cr-Commit-Position: refs/heads/master@{#505072} [modify] https://crrev.com/5551119d425e01a440c59870650de1aa03147cf9/third_party/WebKit/Source/core/exported/WebElementTest.cpp [modify] https://crrev.com/5551119d425e01a440c59870650de1aa03147cf9/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
,
Sep 28 2017
The context of the call is during traversal of the document where I'm using it to skip uninteresting nodes. The .c-header-title__logo svg root's |LogicalHeight| looks to be correct, but it has a |LogicalWidth| of zero. There is another use of the .c-header-title__logo svg in the fixed header when you scroll down the page which has a correct |LogicalWidth|.
,
Sep 28 2017
The LogicalWidth of zero can possibly be explained by the wrapping flex-container (the flex layout.) (Or the fact that one of the two logos will not be in the layout tree...) It's a bit of a blunt instrument to iterate the DOM in this case. Luckily HasNonEmptyLayoutSize will be quick most of the time (so unlikely to hit higher order complexities.)
,
Sep 28 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/00bbbf008169b5ae64b6857f1feede5d862665b7 commit 00bbbf008169b5ae64b6857f1feede5d862665b7 Author: Fredrik Söderquist <fs@opera.com> Date: Thu Sep 28 18:39:28 2017 Fix pre-order traversal in LayoutBoxModelObject::HasNonEmptyLayoutSize Passing 'this' (which |object| will be in this case) to LayoutObject::NextInPreOrder, will turn it into a non-obvious way of saying FirstChild. Pass |root| instead of |object| to make the traversal actually pre- order. Bug: 769459 Change-Id: I6bc4c487faab053d02bc16826862234f15e2376e Reviewed-on: https://chromium-review.googlesource.com/690254 Reviewed-by: Philip Rogers <pdr@chromium.org> Commit-Queue: Fredrik Söderquist <fs@opera.com> Cr-Commit-Position: refs/heads/master@{#505099} [modify] https://crrev.com/00bbbf008169b5ae64b6857f1feede5d862665b7/third_party/WebKit/Source/core/exported/WebElementTest.cpp [modify] https://crrev.com/00bbbf008169b5ae64b6857f1feede5d862665b7/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
,
Sep 28 2017
|
||||
►
Sign in to add a comment |
||||
Comment 1 by mcnee@chromium.org
, Sep 27 2017