Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Issue 186913003: Fix infinite recursion in computePreferredLogicalWidths. (Closed)

Created:
6 years, 9 months ago by ojan
Modified:
6 years, 9 months ago
Reviewers:
pdr., esprehn, eseidel
CC:
blink-reviews, bemjb+rendering_chromium.org, dsinclair, zoltan1, eae+blinkwatch, leviw+renderwatch, jchaffraix+rendering, pdr.
Visibility:
Public.

Description

Fix infinite recursion in computePreferredLogicalWidths. RenderReplaced::computeReplacedLogicalWidth walks up to it's containingBlock in some cases and asks for the containingBlock's width. If the containingBlock's width itself depends on the RenderReplaced's width, then we infinite loop. Avoid the infinite loop by making sure that width/min-width/max-width are all specified on the containingBlock, which will keep the width from depending on it's children. Added FIXMEs. I think we should delete all this containingBlock walking code, but it needs to be done carefully to make sure percentage widths on <svg> keep working. The spec actually considered this undefined behavior, but suggests doing the crazy that we do here. BUG=344647 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=168511

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+29 lines, -2 lines) Patch
A LayoutTests/svg/css/replaced-intrinsic-ratio-min-width-min-content.html View 1 chunk +9 lines, -0 lines 0 comments Download
A LayoutTests/svg/css/replaced-intrinsic-ratio-min-width-min-content-expected.html View 1 chunk +7 lines, -0 lines 0 comments Download
A + LayoutTests/svg/css/resources/intrinsic-ratio.svg View 0 chunks +-1 lines, --1 lines 0 comments Download
M Source/core/rendering/RenderReplaced.cpp View 2 chunks +14 lines, -3 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
ojan
I'm not terribly happy with this fix. I think the existing code is a bit ...
6 years, 9 months ago (2014-03-04 19:09:08 UTC) #1
ojan
6 years, 9 months ago (2014-03-04 19:11:32 UTC) #2
esprehn
lgtm, that's a crazy bug
6 years, 9 months ago (2014-03-04 20:22:04 UTC) #3
ojan
The CQ bit was checked by ojan@chromium.org
6 years, 9 months ago (2014-03-04 22:03:19 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ojan@chromium.org/186913003/1
6 years, 9 months ago (2014-03-04 22:04:56 UTC) #5
commit-bot: I haz the power
Change committed as 168511
6 years, 9 months ago (2014-03-05 18:37:22 UTC) #6
davve
6 years, 9 months ago (2014-03-06 08:06:59 UTC) #7
Message was sent while issue was closed.
> This needs someone to think through how percentage widths on <svg> *should*
work and rewrite this code.

Just for the reference, the way I think percentage widths (and heights) on <svg>
should work is outlined in as a draft patch in
https://codereview.chromium.org/26390004/, i.e. make width/height presentation
attributes (map them to style) and let percentages be handled in the normal CSS
way. There are a couple of problems:

*  we may break some content, especially content written for Blink/WebKit like a
lot of testcases that uses the old behavior both intentionally and
unintentionally.

* It's not what IE(10) does. I've received some clues that IE handles SVGs as
non-replaced block content but I don't have the full picture of what they do.

* There is some controversy regarding mapping *default* 100% width/height values
to style. This is discussed a bit in
http://code.google.com/p/chromium/issues/detail?id=308992.

As for this specific piece of code, I can't say much except that we need
_something_ to not fall into the 300(x150) trap for SVG content without
intrinsic width (but with intrinsic ratio).

Powered by Google App Engine
This is Rietveld 408576698