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

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

Issue 1530303003: Implement Layout Containment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switch to Ahem. Created 4 years, 9 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 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 itemMarker->layout(); 2081 itemMarker->layout();
2082 maxWidth = std::max<float>(maxWidth, toLayoutListMarker(itemMarker)- >logicalWidth().toFloat()); 2082 maxWidth = std::max<float>(maxWidth, toLayoutListMarker(itemMarker)- >logicalWidth().toFloat());
2083 break; 2083 break;
2084 } 2084 }
2085 } 2085 }
2086 return maxWidth; 2086 return maxWidth;
2087 } 2087 }
2088 2088
2089 void LayoutBox::computeLogicalWidth(LogicalExtentComputedValues& computedValues) const 2089 void LayoutBox::computeLogicalWidth(LogicalExtentComputedValues& computedValues) const
2090 { 2090 {
2091 computedValues.m_extent = logicalWidth(); 2091 computedValues.m_extent = style()->containsLayout() ? borderAndPaddingLogica lWidth() : logicalWidth();
2092 computedValues.m_position = logicalLeft(); 2092 computedValues.m_position = logicalLeft();
2093 computedValues.m_margins.m_start = marginStart(); 2093 computedValues.m_margins.m_start = marginStart();
2094 computedValues.m_margins.m_end = marginEnd(); 2094 computedValues.m_margins.m_end = marginEnd();
2095 2095
2096 if (isOutOfFlowPositioned()) { 2096 if (isOutOfFlowPositioned()) {
2097 computePositionedLogicalWidth(computedValues); 2097 computePositionedLogicalWidth(computedValues);
2098 return; 2098 return;
2099 } 2099 }
2100 2100
2101 // The parent box is flexing us, so it has increased or decreased our 2101 // The parent box is flexing us, so it has increased or decreased our
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 // Either no auto margins, or our margin box width is >= the container width , auto margins will just turn into 0. 2411 // Either no auto margins, or our margin box width is >= the container width , auto margins will just turn into 0.
2412 marginStart = marginStartWidth; 2412 marginStart = marginStartWidth;
2413 marginEnd = marginEndWidth; 2413 marginEnd = marginEndWidth;
2414 } 2414 }
2415 2415
2416 void LayoutBox::updateLogicalHeight() 2416 void LayoutBox::updateLogicalHeight()
2417 { 2417 {
2418 m_intrinsicContentLogicalHeight = contentLogicalHeight(); 2418 m_intrinsicContentLogicalHeight = contentLogicalHeight();
2419 2419
2420 LogicalExtentComputedValues computedValues; 2420 LogicalExtentComputedValues computedValues;
2421 computeLogicalHeight(logicalHeight(), logicalTop(), computedValues); 2421 LayoutUnit height = style()->containsLayout() ? borderAndPaddingLogicalHeigh t() : logicalHeight();
2422 computeLogicalHeight(height, logicalTop(), computedValues);
2422 2423
2423 setLogicalHeight(computedValues.m_extent); 2424 setLogicalHeight(computedValues.m_extent);
2424 setLogicalTop(computedValues.m_position); 2425 setLogicalTop(computedValues.m_position);
2425 setMarginBefore(computedValues.m_margins.m_before); 2426 setMarginBefore(computedValues.m_margins.m_before);
2426 setMarginAfter(computedValues.m_margins.m_after); 2427 setMarginAfter(computedValues.m_margins.m_after);
2427 } 2428 }
2428 2429
2429 void LayoutBox::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logica lTop, LogicalExtentComputedValues& computedValues) const 2430 void LayoutBox::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logica lTop, LogicalExtentComputedValues& computedValues) const
2430 { 2431 {
2431 computedValues.m_extent = logicalHeight; 2432 computedValues.m_extent = logicalHeight;
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
3789 } 3790 }
3790 3791
3791 static bool shouldBeConsideredAsReplaced(Node* node) 3792 static bool shouldBeConsideredAsReplaced(Node* node)
3792 { 3793 {
3793 // Checkboxes and radioboxes are not isAtomicInlineLevel() nor do they have their own layoutObject in which to override avoidFloats(). 3794 // Checkboxes and radioboxes are not isAtomicInlineLevel() nor do they have their own layoutObject in which to override avoidFloats().
3794 return node && node->isElementNode() && (toElement(node)->isFormControlEleme nt() || isHTMLImageElement(toElement(node))); 3795 return node && node->isElementNode() && (toElement(node)->isFormControlEleme nt() || isHTMLImageElement(toElement(node)));
3795 } 3796 }
3796 3797
3797 bool LayoutBox::avoidsFloats() const 3798 bool LayoutBox::avoidsFloats() const
3798 { 3799 {
3799 return isAtomicInlineLevel() || shouldBeConsideredAsReplaced(node()) || hasO verflowClip() || isHR() || isLegend() || isWritingModeRoot() || isFlexItemInclud ingDeprecated() || style()->containsPaint(); 3800 return isAtomicInlineLevel() || shouldBeConsideredAsReplaced(node()) || hasO verflowClip() || isHR() || isLegend() || isWritingModeRoot() || isFlexItemInclud ingDeprecated() || style()->containsPaint() || style()->containsLayout();
3800 } 3801 }
3801 3802
3802 bool LayoutBox::hasNonCompositedScrollbars() const 3803 bool LayoutBox::hasNonCompositedScrollbars() const
3803 { 3804 {
3804 if (PaintLayer* layer = this->layer()) { 3805 if (PaintLayer* layer = this->layer()) {
3805 if (PaintLayerScrollableArea* scrollableArea = layer->scrollableArea()) { 3806 if (PaintLayerScrollableArea* scrollableArea = layer->scrollableArea()) {
3806 if (scrollableArea->hasHorizontalScrollbar() && !scrollableArea->lay erForHorizontalScrollbar()) 3807 if (scrollableArea->hasHorizontalScrollbar() && !scrollableArea->lay erForHorizontalScrollbar())
3807 return true; 3808 return true;
3808 if (scrollableArea->hasVerticalScrollbar() && !scrollableArea->layer ForVerticalScrollbar()) 3809 if (scrollableArea->hasVerticalScrollbar() && !scrollableArea->layer ForVerticalScrollbar())
3809 return true; 3810 return true;
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
4721 } 4722 }
4722 4723
4723 void LayoutBox::IntrinsicSizingInfo::transpose() 4724 void LayoutBox::IntrinsicSizingInfo::transpose()
4724 { 4725 {
4725 size = size.transposedSize(); 4726 size = size.transposedSize();
4726 aspectRatio = aspectRatio.transposedSize(); 4727 aspectRatio = aspectRatio.transposedSize();
4727 std::swap(hasWidth, hasHeight); 4728 std::swap(hasWidth, hasHeight);
4728 } 4729 }
4729 4730
4730 } // namespace blink 4731 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698