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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutReplaced.cpp

Issue 1637473002: Consistency in LayoutReplaced::computeReplacedLogicalWidth() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth & & hasIntrinsicHeight) || !computedHeightIsAuto)) { 569 if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth & & hasIntrinsicHeight) || !computedHeightIsAuto)) {
570 LayoutUnit logicalHeight = computeReplacedLogicalHeight(); 570 LayoutUnit logicalHeight = computeReplacedLogicalHeight();
571 return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalH eight * intrinsicRatio, shouldComputePreferred); 571 return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalH eight * intrinsicRatio, shouldComputePreferred);
572 } 572 }
573 573
574 // 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 574 // 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
575 // '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 575 // '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
576 // the used value of 'width' is calculated from the constraint equat ion used for block-level, non-replaced elements in normal flow. 576 // the used value of 'width' is calculated from the constraint equat ion used for block-level, non-replaced elements in normal flow.
577 if (computedHeightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeigh t) { 577 if (computedHeightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeigh t) {
578 if (shouldComputePreferred == ComputePreferred) 578 if (shouldComputePreferred == ComputePreferred)
579 return 0; 579 return computeReplacedLogicalWidthRespectingMinMaxWidth(0, C omputePreferred);
580 // The aforementioned 'constraint equation' used for block-level , non-replaced elements in normal flow: 580 // The aforementioned 'constraint equation' used for block-level , non-replaced elements in normal flow:
581 // 'margin-left' + 'border-left-width' + 'padding-left' + 'width ' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containin g block 581 // 'margin-left' + 'border-left-width' + 'padding-left' + 'width ' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containin g block
582 LayoutUnit logicalWidth = containingBlock()->availableLogicalWid th(); 582 LayoutUnit logicalWidth = containingBlock()->availableLogicalWid th();
583 583
584 // This solves above equation for 'width' (== logicalWidth). 584 // This solves above equation for 'width' (== logicalWidth).
585 LayoutUnit marginStart = minimumValueForLength(style()->marginSt art(), logicalWidth); 585 LayoutUnit marginStart = minimumValueForLength(style()->marginSt art(), logicalWidth);
586 LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd( ), logicalWidth); 586 LayoutUnit marginEnd = minimumValueForLength(style()->marginEnd( ), logicalWidth);
587 logicalWidth = std::max<LayoutUnit>(0, logicalWidth - (marginSta rt + marginEnd + (size().width() - clientWidth()))); 587 logicalWidth = std::max<LayoutUnit>(0, logicalWidth - (marginSta rt + marginEnd + (size().width() - clientWidth())));
588 return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalW idth, shouldComputePreferred); 588 return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalW idth, shouldComputePreferred);
589 } 589 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 // We only include the space below the baseline in our layer's cached paint invalidation rect if the 745 // We only include the space below the baseline in our layer's cached paint invalidation rect if the
746 // image is selected. Since the selection state has changed update the rect. 746 // image is selected. Since the selection state has changed update the rect.
747 if (hasLayer()) 747 if (hasLayer())
748 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe rForPaintInvalidation())); 748 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe rForPaintInvalidation()));
749 749
750 if (canUpdateSelectionOnRootLineBoxes()) 750 if (canUpdateSelectionOnRootLineBoxes())
751 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone ); 751 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone );
752 } 752 }
753 753
754 } 754 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698