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

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: Add one more test 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
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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // of 'width' is: (used height) * (intrinsic ratio) 394 // of 'width' is: (used height) * (intrinsic ratio)
395 if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth & & hasIntrinsicHeight) || !computedHeightIsAuto)) { 395 if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth & & hasIntrinsicHeight) || !computedHeightIsAuto)) {
396 LayoutUnit logicalHeight = computeReplacedLogicalHeight(); 396 LayoutUnit logicalHeight = computeReplacedLogicalHeight();
397 return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToI nt(round(logicalHeight * intrinsicRatio)), shouldComputePreferred); 397 return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToI nt(round(logicalHeight * intrinsicRatio)), shouldComputePreferred);
398 } 398 }
399 399
400 // 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 400 // 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
401 // '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 401 // '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
402 // the used value of 'width' is calculated from the constraint equat ion used for block-level, non-replaced elements in normal flow. 402 // the used value of 'width' is calculated from the constraint equat ion used for block-level, non-replaced elements in normal flow.
403 if (computedHeightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeigh t) { 403 if (computedHeightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeigh t) {
404 if (shouldComputePreferred == ComputePreferred)
405 return 0;
404 // The aforementioned 'constraint equation' used for block-level , non-replaced elements in normal flow: 406 // The aforementioned 'constraint equation' used for block-level , non-replaced elements in normal flow:
405 // 'margin-left' + 'border-left-width' + 'padding-left' + 'width ' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containin g block 407 // 'margin-left' + 'border-left-width' + 'padding-left' + 'width ' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containin g block
406 LayoutUnit logicalWidth; 408 LayoutUnit logicalWidth;
407 // FIXME: This walking up the containgBlock chain to find the fi rst one with a specified width is bonkers. 409 // FIXME: This walking up the containgBlock chain to find the fi rst one with a specified width is bonkers.
408 // If nothing else, it requires making sure that computeReplaced LogicalWidthRespectingMinMaxWidth cannot 410 // If nothing else, it requires making sure that computeReplaced LogicalWidthRespectingMinMaxWidth cannot
409 // depend on the width of the replaced element or we infinite lo op. Right now we do that in 411 // depend on the width of the replaced element or we infinite lo op. Right now we do that in
410 // firstContainingBlockWithLogicalWidth by checking that width/m in-width/max-width are all specified. 412 // firstContainingBlockWithLogicalWidth by checking that width/m in-width/max-width are all specified.
411 // 413 //
412 // Firefox 27 seems to only do this if the <svg> has a viewbox. 414 // Firefox 27 seems to only do this if the <svg> has a viewbox.
413 if (RenderBlock* blockWithWidth = firstContainingBlockWithLogica lWidth(this)) { 415 if (RenderBlock* blockWithWidth = firstContainingBlockWithLogica lWidth(this)) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 // FIXME: layoutDelta needs to be applied in parts before/after transfor ms and 625 // FIXME: layoutDelta needs to be applied in parts before/after transfor ms and
624 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 626 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308
625 r.move(v->layoutDelta()); 627 r.move(v->layoutDelta());
626 } 628 }
627 629
628 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r); 630 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r);
629 return r; 631 return r;
630 } 632 }
631 633
632 } 634 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698