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

Side by Side Diff: Source/core/rendering/RenderReplaced.cpp

Issue 325183002: Make preferred widths for replaced content independent on available width (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review comments 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/svg/custom/stf-container-with-intrinsic-ratio-svg.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 // of 'width' is: (used height) * (intrinsic ratio) 383 // of 'width' is: (used height) * (intrinsic ratio)
384 if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth & & hasIntrinsicHeight) || !computedHeightIsAuto)) { 384 if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth & & hasIntrinsicHeight) || !computedHeightIsAuto)) {
385 LayoutUnit logicalHeight = computeReplacedLogicalHeight(); 385 LayoutUnit logicalHeight = computeReplacedLogicalHeight();
386 return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToI nt(round(logicalHeight * intrinsicRatio)), shouldComputePreferred); 386 return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToI nt(round(logicalHeight * intrinsicRatio)), shouldComputePreferred);
387 } 387 }
388 388
389 // If 'height' and 'width' both have computed values of 'auto' and t he element has an intrinsic ratio but no intrinsic height or width, then the use d value of 389 // If 'height' and 'width' both have computed values of 'auto' and t he element has an intrinsic ratio but no intrinsic height or width, then the use d value of
390 // 'width' is undefined in CSS 2.1. However, it is suggested that, i f the containing block's width does not itself depend on the replaced element's width, then 390 // 'width' is undefined in CSS 2.1. However, it is suggested that, i f the containing block's width does not itself depend on the replaced element's width, then
391 // the used value of 'width' is calculated from the constraint equat ion used for block-level, non-replaced elements in normal flow. 391 // the used value of 'width' is calculated from the constraint equat ion used for block-level, non-replaced elements in normal flow.
392 if (computedHeightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeigh t) { 392 if (computedHeightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeigh t) {
393 if (shouldComputePreferred == ComputePreferred)
394 return 0;
393 // The aforementioned 'constraint equation' used for block-level , non-replaced elements in normal flow: 395 // The aforementioned 'constraint equation' used for block-level , non-replaced elements in normal flow:
394 // 'margin-left' + 'border-left-width' + 'padding-left' + 'width ' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containin g block 396 // 'margin-left' + 'border-left-width' + 'padding-left' + 'width ' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containin g block
395 LayoutUnit logicalWidth; 397 LayoutUnit logicalWidth;
396 // FIXME: This walking up the containgBlock chain to find the fi rst one with a specified width is bonkers. 398 // FIXME: This walking up the containgBlock chain to find the fi rst one with a specified width is bonkers.
397 // If nothing else, it requires making sure that computeReplaced LogicalWidthRespectingMinMaxWidth cannot 399 // If nothing else, it requires making sure that computeReplaced LogicalWidthRespectingMinMaxWidth cannot
398 // depend on the width of the replaced element or we infinite lo op. Right now we do that in 400 // depend on the width of the replaced element or we infinite lo op. Right now we do that in
399 // firstContainingBlockWithLogicalWidth by checking that width/m in-width/max-width are all specified. 401 // firstContainingBlockWithLogicalWidth by checking that width/m in-width/max-width are all specified.
400 // 402 //
401 // Firefox 27 seems to only do this if the <svg> has a viewbox. 403 // Firefox 27 seems to only do this if the <svg> has a viewbox.
402 if (RenderBlock* blockWithWidth = firstContainingBlockWithLogica lWidth(this)) { 404 if (RenderBlock* blockWithWidth = firstContainingBlockWithLogica lWidth(this)) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 // FIXME: layoutDelta needs to be applied in parts before/after transfor ms and 614 // FIXME: layoutDelta needs to be applied in parts before/after transfor ms and
613 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 615 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308
614 r.move(v->layoutDelta()); 616 r.move(v->layoutDelta());
615 } 617 }
616 618
617 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r); 619 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r);
618 return r; 620 return r;
619 } 621 }
620 622
621 } 623 }
OLDNEW
« no previous file with comments | « LayoutTests/svg/custom/stf-container-with-intrinsic-ratio-svg.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698