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

Unified Diff: Source/core/rendering/RenderReplaced.cpp

Issue 341773004: Use available width for replaced element with intrinsic ratio but no dimensions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase and add NeedsRebaseline to zoom test with off-by-one (or so) errors Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/svg/custom/inline-svg-use-available-width-in-stf.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderReplaced.cpp
diff --git a/Source/core/rendering/RenderReplaced.cpp b/Source/core/rendering/RenderReplaced.cpp
index 306d203798ba2522a9c31de50d744648296c1177..67084fb89222e7e534649d96662713585b380927 100644
--- a/Source/core/rendering/RenderReplaced.cpp
+++ b/Source/core/rendering/RenderReplaced.cpp
@@ -205,25 +205,6 @@ bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const LayoutPoint& paintO
return true;
}
-static inline RenderBlock* firstContainingBlockWithLogicalWidth(const RenderReplaced* replaced)
-{
- // We have to lookup the containing block, which has an explicit width, which must not be equal to our direct containing block.
- // If the embedded document appears _after_ we performed the initial layout, our intrinsic size is 300x150. If our containing
- // block doesn't provide an explicit width, it's set to the 300 default, coming from the initial layout run.
- RenderBlock* containingBlock = replaced->containingBlock();
- if (!containingBlock)
- return 0;
-
- for (; !containingBlock->isRenderView() && !containingBlock->isBody(); containingBlock = containingBlock->containingBlock()) {
- if (containingBlock->style()->logicalWidth().isSpecified()
- && containingBlock->style()->logicalMinWidth().isSpecified()
- && (containingBlock->style()->logicalMaxWidth().isSpecified() || containingBlock->style()->logicalMaxWidth().isUndefined()))
- return containingBlock;
- }
-
- return 0;
-}
-
bool RenderReplaced::hasReplacedLogicalHeight() const
{
if (style()->logicalHeight().isAuto())
@@ -388,20 +369,7 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh
return 0;
// The aforementioned 'constraint equation' used for block-level, non-replaced elements in normal flow:
// 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block
- LayoutUnit logicalWidth;
- // FIXME: This walking up the containgBlock chain to find the first one with a specified width is bonkers.
- // If nothing else, it requires making sure that computeReplacedLogicalWidthRespectingMinMaxWidth cannot
- // depend on the width of the replaced element or we infinite loop. Right now we do that in
- // firstContainingBlockWithLogicalWidth by checking that width/min-width/max-width are all specified.
- //
- // Firefox 27 seems to only do this if the <svg> has a viewbox.
- if (RenderBlock* blockWithWidth = firstContainingBlockWithLogicalWidth(this)) {
- logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing(blockWithWidth->style()->logicalWidth()), shouldComputePreferred);
- } else {
- // FIXME: If shouldComputePreferred == ComputePreferred, then we're reading this during preferred width
- // computation, at which point this is reading stale data from a previous layout.
- logicalWidth = containingBlock()->availableLogicalWidth();
- }
+ LayoutUnit logicalWidth = containingBlock()->availableLogicalWidth();
// This solves above equation for 'width' (== logicalWidth).
LayoutUnit marginStart = minimumValueForLength(style()->marginStart(), logicalWidth);
« no previous file with comments | « LayoutTests/svg/custom/inline-svg-use-available-width-in-stf.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698