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

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

Issue 2286543002: Add Length::isPercent and use it in tables. (Closed)
Patch Set: rebase 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
OLDNEW
1 /* 1 /*
2 * This file is part of the layout object implementation for KHTML. 2 * This file is part of the layout object implementation for KHTML.
3 * 3 *
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org) 5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * Copyright (C) 2003 Apple Computer, Inc. 6 * Copyright (C) 2003 Apple Computer, Inc.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 // our box's intrinsic height. 438 // our box's intrinsic height.
439 LayoutUnit maxAscent; 439 LayoutUnit maxAscent;
440 LayoutUnit maxDescent; 440 LayoutUnit maxDescent;
441 for (LayoutBox* child = iterator.first(); child; child = iterator.next() ) { 441 for (LayoutBox* child = iterator.first(); child; child = iterator.next() ) {
442 if (child->isOutOfFlowPositioned()) 442 if (child->isOutOfFlowPositioned())
443 continue; 443 continue;
444 444
445 SubtreeLayoutScope layoutScope(*child); 445 SubtreeLayoutScope layoutScope(*child);
446 // TODO(jchaffraix): It seems incorrect to check isAtomicInlineLevel in this file. 446 // TODO(jchaffraix): It seems incorrect to check isAtomicInlineLevel in this file.
447 // We probably want to check if the element is replaced. 447 // We probably want to check if the element is replaced.
448 if (relayoutChildren || (child->isAtomicInlineLevel() && (child->sty le()->width().hasPercent() || child->style()->height().hasPercent()))) 448 if (relayoutChildren || (child->isAtomicInlineLevel() && (child->sty le()->width().isPercentOrCalc() || child->style()->height().isPercentOrCalc())))
449 layoutScope.setChildNeedsLayout(child); 449 layoutScope.setChildNeedsLayout(child);
450 450
451 // Compute the child's vertical margins. 451 // Compute the child's vertical margins.
452 child->computeAndSetBlockDirectionMargins(this); 452 child->computeAndSetBlockDirectionMargins(this);
453 453
454 if (!child->needsLayout()) 454 if (!child->needsLayout())
455 child->markForPaginationRelayoutIfNeeded(layoutScope); 455 child->markForPaginationRelayoutIfNeeded(layoutScope);
456 456
457 // Now do the layout. 457 // Now do the layout.
458 child->layoutIfNeeded(); 458 child->layoutIfNeeded();
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 childLayer->setStaticInlinePosition(borderStart() + paddingStart ()); 738 childLayer->setStaticInlinePosition(borderStart() + paddingStart ());
739 if (childLayer->staticBlockPosition() != size().height()) { 739 if (childLayer->staticBlockPosition() != size().height()) {
740 childLayer->setStaticBlockPosition(size().height()); 740 childLayer->setStaticBlockPosition(size().height());
741 if (child->style()->hasStaticBlockPosition(style()->isHorizo ntalWritingMode())) 741 if (child->style()->hasStaticBlockPosition(style()->isHorizo ntalWritingMode()))
742 child->setChildNeedsLayout(MarkOnlyThis); 742 child->setChildNeedsLayout(MarkOnlyThis);
743 } 743 }
744 continue; 744 continue;
745 } 745 }
746 746
747 SubtreeLayoutScope layoutScope(*child); 747 SubtreeLayoutScope layoutScope(*child);
748 if (!haveLineClamp && (relayoutChildren || (child->isAtomicInlineLev el() && (child->style()->width().hasPercent() || child->style()->height().hasPer cent())))) 748 if (!haveLineClamp && (relayoutChildren || (child->isAtomicInlineLev el() && (child->style()->width().isPercentOrCalc() || child->style()->height().i sPercentOrCalc()))))
749 layoutScope.setChildNeedsLayout(child); 749 layoutScope.setChildNeedsLayout(child);
750 750
751 if (child->style()->visibility() == EVisibility::Collapse) { 751 if (child->style()->visibility() == EVisibility::Collapse) {
752 // visibility: collapsed children do not participate in our posi tioning. 752 // visibility: collapsed children do not participate in our posi tioning.
753 // But we need to lay them down. 753 // But we need to lay them down.
754 child->layoutIfNeeded(); 754 child->layoutIfNeeded();
755 continue; 755 continue;
756 } 756 }
757 757
758 // Compute the child's vertical margins. 758 // Compute the child's vertical margins.
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 void LayoutDeprecatedFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutChildren) 950 void LayoutDeprecatedFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutChildren)
951 { 951 {
952 UseCounter::count(document(), UseCounter::LineClamp); 952 UseCounter::count(document(), UseCounter::LineClamp);
953 953
954 int maxLineCount = 0; 954 int maxLineCount = 0;
955 for (LayoutBox* child = iterator.first(); child; child = iterator.next()) { 955 for (LayoutBox* child = iterator.first(); child; child = iterator.next()) {
956 if (childDoesNotAffectWidthOrFlexing(child)) 956 if (childDoesNotAffectWidthOrFlexing(child))
957 continue; 957 continue;
958 958
959 child->clearOverrideSize(); 959 child->clearOverrideSize();
960 if (relayoutChildren || (child->isAtomicInlineLevel() && (child->style() ->width().hasPercent() || child->style()->height().hasPercent())) 960 if (relayoutChildren || (child->isAtomicInlineLevel() && (child->style() ->width().isPercentOrCalc() || child->style()->height().isPercentOrCalc()))
961 || (child->style()->height().isAuto() && child->isLayoutBlock())) { 961 || (child->style()->height().isAuto() && child->isLayoutBlock())) {
962 child->setChildNeedsLayout(MarkOnlyThis); 962 child->setChildNeedsLayout(MarkOnlyThis);
963 963
964 // Dirty all the positioned objects. 964 // Dirty all the positioned objects.
965 if (child->isLayoutBlockFlow()) { 965 if (child->isLayoutBlockFlow()) {
966 toLayoutBlockFlow(child)->markPositionedObjectsForLayout(); 966 toLayoutBlockFlow(child)->markPositionedObjectsForLayout();
967 clearTruncation(toLayoutBlockFlow(child)); 967 clearTruncation(toLayoutBlockFlow(child));
968 } 968 }
969 } 969 }
970 child->layoutIfNeeded(); 970 child->layoutIfNeeded();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 } 1038 }
1039 1039
1040 void LayoutDeprecatedFlexibleBox::clearLineClamp() 1040 void LayoutDeprecatedFlexibleBox::clearLineClamp()
1041 { 1041 {
1042 FlexBoxIterator iterator(this); 1042 FlexBoxIterator iterator(this);
1043 for (LayoutBox* child = iterator.first(); child; child = iterator.next()) { 1043 for (LayoutBox* child = iterator.first(); child; child = iterator.next()) {
1044 if (childDoesNotAffectWidthOrFlexing(child)) 1044 if (childDoesNotAffectWidthOrFlexing(child))
1045 continue; 1045 continue;
1046 1046
1047 child->clearOverrideSize(); 1047 child->clearOverrideSize();
1048 if ((child->isAtomicInlineLevel() && (child->style()->width().hasPercent () || child->style()->height().hasPercent())) 1048 if ((child->isAtomicInlineLevel() && (child->style()->width().isPercentO rCalc() || child->style()->height().isPercentOrCalc()))
1049 || (child->style()->height().isAuto() && child->isLayoutBlock())) { 1049 || (child->style()->height().isAuto() && child->isLayoutBlock())) {
1050 child->setChildNeedsLayout(); 1050 child->setChildNeedsLayout();
1051 1051
1052 if (child->isLayoutBlockFlow()) { 1052 if (child->isLayoutBlockFlow()) {
1053 toLayoutBlockFlow(child)->markPositionedObjectsForLayout(); 1053 toLayoutBlockFlow(child)->markPositionedObjectsForLayout();
1054 clearTruncation(toLayoutBlockFlow(child)); 1054 clearTruncation(toLayoutBlockFlow(child));
1055 } 1055 }
1056 } 1056 }
1057 } 1057 }
1058 } 1058 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 if (minHeight.isFixed() || minHeight.isAuto()) { 1108 if (minHeight.isFixed() || minHeight.isAuto()) {
1109 LayoutUnit minHeight(child->style()->minHeight().value()); 1109 LayoutUnit minHeight(child->style()->minHeight().value());
1110 LayoutUnit height = contentHeightForChild(child); 1110 LayoutUnit height = contentHeightForChild(child);
1111 LayoutUnit allowedShrinkage = (minHeight - height).clampPositiveToZero() ; 1111 LayoutUnit allowedShrinkage = (minHeight - height).clampPositiveToZero() ;
1112 return allowedShrinkage; 1112 return allowedShrinkage;
1113 } 1113 }
1114 return LayoutUnit(); 1114 return LayoutUnit();
1115 } 1115 }
1116 1116
1117 } // namespace blink 1117 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698