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

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

Issue 2350803002: [css-flexbox] Fix size comparison when scrollbars are present (Closed)
Patch Set: Created 4 years, 3 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 | « third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h ('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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 LayoutUnit LayoutFlexibleBox::crossAxisIntrinsicExtentForChild(const LayoutBox& child) const 512 LayoutUnit LayoutFlexibleBox::crossAxisIntrinsicExtentForChild(const LayoutBox& child) const
513 { 513 {
514 return hasOrthogonalFlow(child) ? childIntrinsicLogicalWidth(child) : childI ntrinsicLogicalHeight(child); 514 return hasOrthogonalFlow(child) ? childIntrinsicLogicalWidth(child) : childI ntrinsicLogicalHeight(child);
515 } 515 }
516 516
517 LayoutUnit LayoutFlexibleBox::mainAxisExtentForChild(const LayoutBox& child) con st 517 LayoutUnit LayoutFlexibleBox::mainAxisExtentForChild(const LayoutBox& child) con st
518 { 518 {
519 return isHorizontalFlow() ? child.size().width() : child.size().height(); 519 return isHorizontalFlow() ? child.size().width() : child.size().height();
520 } 520 }
521 521
522 LayoutUnit LayoutFlexibleBox::mainAxisContentExtentForChild(const LayoutBox& chi ld) const 522 LayoutUnit LayoutFlexibleBox::mainAxisContentExtentForChildIncludingScrollbar(co nst LayoutBox& child) const
523 { 523 {
524 return isHorizontalFlow() ? child.contentWidth() : child.contentHeight(); 524 return isHorizontalFlow() ? child.contentWidth() + child.verticalScrollbarWi dth() : child.contentHeight() + child.horizontalScrollbarHeight();
525 } 525 }
526 526
527 LayoutUnit LayoutFlexibleBox::crossAxisExtent() const 527 LayoutUnit LayoutFlexibleBox::crossAxisExtent() const
528 { 528 {
529 return isHorizontalFlow() ? size().height() : size().width(); 529 return isHorizontalFlow() ? size().height() : size().width();
530 } 530 }
531 531
532 LayoutUnit LayoutFlexibleBox::mainAxisExtent() const 532 LayoutUnit LayoutFlexibleBox::mainAxisExtent() const
533 { 533 {
534 return isHorizontalFlow() ? size().width() : size().height(); 534 return isHorizontalFlow() ? size().width() : size().height();
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 LayoutBox* child = flexItem.box; 1633 LayoutBox* child = flexItem.box;
1634 1634
1635 if (child->isOutOfFlowPositioned()) { 1635 if (child->isOutOfFlowPositioned()) {
1636 prepareChildForPositionedLayout(*child); 1636 prepareChildForPositionedLayout(*child);
1637 continue; 1637 continue;
1638 } 1638 }
1639 1639
1640 child->setMayNeedPaintInvalidation(); 1640 child->setMayNeedPaintInvalidation();
1641 1641
1642 setOverrideMainAxisContentSizeForChild(*child, flexItem.flexedContentSiz e); 1642 setOverrideMainAxisContentSizeForChild(*child, flexItem.flexedContentSiz e);
1643 if (flexItem.flexedContentSize != mainAxisContentExtentForChild(*child)) { 1643 // The flexed content size and the override size include the scrollbar
1644 // width, so we need to compare to the size including the scrollbar.
1645 // TODO(cbiesinger): Should it include the scrollbar?
1646 if (flexItem.flexedContentSize != mainAxisContentExtentForChildIncluding Scrollbar(*child)) {
1644 child->setChildNeedsLayout(MarkOnlyThis); 1647 child->setChildNeedsLayout(MarkOnlyThis);
1645 } else { 1648 } else {
1646 // To avoid double applying margin changes in updateAutoMarginsInCro ssAxis, we reset the margins here. 1649 // To avoid double applying margin changes in updateAutoMarginsInCro ssAxis, we reset the margins here.
1647 resetAutoMarginsAndLogicalTopInCrossAxis(*child); 1650 resetAutoMarginsAndLogicalTopInCrossAxis(*child);
1648 } 1651 }
1649 // We may have already forced relayout for orthogonal flowing children i n computeInnerFlexBaseSizeForChild. 1652 // We may have already forced relayout for orthogonal flowing children i n computeInnerFlexBaseSizeForChild.
1650 bool forceChildRelayout = relayoutChildren && !m_relaidOutChildren.conta ins(child); 1653 bool forceChildRelayout = relayoutChildren && !m_relaidOutChildren.conta ins(child);
1651 if (child->isLayoutBlock() && toLayoutBlock(*child).hasPercentHeightDesc endants()) { 1654 if (child->isLayoutBlock() && toLayoutBlock(*child).hasPercentHeightDesc endants()) {
1652 // Have to force another relayout even though the child is sized cor rectly, because 1655 // Have to force another relayout even though the child is sized cor rectly, because
1653 // its descendants are not sized correctly yet. Our previous layout of the child was 1656 // its descendants are not sized correctly yet. Our previous layout of the child was
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 DCHECK(child); 1932 DCHECK(child);
1930 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1933 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1931 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1934 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1932 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1935 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1933 adjustAlignmentForChild(*child, newOffset - originalOffset); 1936 adjustAlignmentForChild(*child, newOffset - originalOffset);
1934 } 1937 }
1935 } 1938 }
1936 } 1939 }
1937 1940
1938 } // namespace blink 1941 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698