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

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

Issue 2025543002: Fix when orthogonal writing mode roots have floating siblings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 3rd option Created 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/writing-mode/orthogonal-writing-modes-floats-crash-expected.txt ('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) 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 void LayoutBox::removeFloatingOrPositionedChildFromBlockLists() 155 void LayoutBox::removeFloatingOrPositionedChildFromBlockLists()
156 { 156 {
157 ASSERT(isFloatingOrOutOfFlowPositioned()); 157 ASSERT(isFloatingOrOutOfFlowPositioned());
158 158
159 if (documentBeingDestroyed()) 159 if (documentBeingDestroyed())
160 return; 160 return;
161 161
162 if (isFloating()) { 162 if (isFloating()) {
163 LayoutBlockFlow* parentBlockFlow = nullptr; 163 LayoutBlockFlow* parentBlockFlow = nullptr;
164 for (LayoutObject* curr = parent(); curr && !curr->isLayoutView(); curr = curr->parent()) { 164 for (LayoutObject* curr = parent(); curr; curr = curr->parent()) {
wkorman 2016/06/08 18:23:33 This line diff seems to already be in ToT. Update
165 if (curr->isLayoutBlockFlow()) { 165 if (curr->isLayoutBlockFlow()) {
166 LayoutBlockFlow* currBlockFlow = toLayoutBlockFlow(curr); 166 LayoutBlockFlow* currBlockFlow = toLayoutBlockFlow(curr);
167 if (!parentBlockFlow || currBlockFlow->containsFloat(this)) 167 if (!parentBlockFlow || currBlockFlow->containsFloat(this))
168 parentBlockFlow = currBlockFlow; 168 parentBlockFlow = currBlockFlow;
169 } 169 }
170 } 170 }
171 171
172 if (parentBlockFlow) { 172 if (parentBlockFlow) {
173 parentBlockFlow->markSiblingsWithFloatsForLayout(this); 173 parentBlockFlow->markSiblingsWithFloatsForLayout(this);
174 parentBlockFlow->markAllDescendantsWithFloatsForLayout(this, false); 174 parentBlockFlow->markAllDescendantsWithFloatsForLayout(this, false);
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWid th, availableLogicalWidth)); 2310 return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWid th, availableLogicalWidth));
2311 } 2311 }
2312 2312
2313 if (logicalWidth.isIntrinsic()) 2313 if (logicalWidth.isIntrinsic())
2314 return computeIntrinsicLogicalWidthUsing(logicalWidth, availableLogicalW idth, borderAndPaddingLogicalWidth()); 2314 return computeIntrinsicLogicalWidthUsing(logicalWidth, availableLogicalW idth, borderAndPaddingLogicalWidth());
2315 2315
2316 LayoutUnit marginStart; 2316 LayoutUnit marginStart;
2317 LayoutUnit marginEnd; 2317 LayoutUnit marginEnd;
2318 LayoutUnit logicalWidthResult = fillAvailableMeasure(availableLogicalWidth, marginStart, marginEnd); 2318 LayoutUnit logicalWidthResult = fillAvailableMeasure(availableLogicalWidth, marginStart, marginEnd);
2319 2319
2320 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() && toLayoutBlockFlow(cb )->containsFloats()) 2320 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() && toLayoutBlockFlow(cb )->containsFloats()
2321 && cb->style()->isHorizontalWritingMode() == style()->isHorizontalWritin gMode()) {
wkorman 2016/06/08 18:23:33 Perhaps use static helper method like isParallelWr
2321 logicalWidthResult = std::min(logicalWidthResult, shrinkLogicalWidthToAv oidFloats(marginStart, marginEnd, toLayoutBlockFlow(cb))); 2322 logicalWidthResult = std::min(logicalWidthResult, shrinkLogicalWidthToAv oidFloats(marginStart, marginEnd, toLayoutBlockFlow(cb)));
2323 }
2322 2324
2323 if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(logica lWidth)) 2325 if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(logica lWidth))
2324 return std::max(minPreferredLogicalWidth(), std::min(maxPreferredLogical Width(), logicalWidthResult)); 2326 return std::max(minPreferredLogicalWidth(), std::min(maxPreferredLogical Width(), logicalWidthResult));
2325 return logicalWidthResult; 2327 return logicalWidthResult;
2326 } 2328 }
2327 2329
2328 static bool columnFlexItemHasStretchAlignment(const LayoutObject* flexitem) 2330 static bool columnFlexItemHasStretchAlignment(const LayoutObject* flexitem)
2329 { 2331 {
2330 LayoutObject* parent = flexitem->parent(); 2332 LayoutObject* parent = flexitem->parent();
2331 // auto margins mean we don't stretch. Note that this function will only be used for 2333 // auto margins mean we don't stretch. Note that this function will only be used for
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2433 if (marginStartLength.isAuto()) 2435 if (marginStartLength.isAuto())
2434 marginStartLength.setValue(0); 2436 marginStartLength.setValue(0);
2435 if (marginEndLength.isAuto()) 2437 if (marginEndLength.isAuto())
2436 marginEndLength.setValue(0); 2438 marginEndLength.setValue(0);
2437 } 2439 }
2438 2440
2439 LayoutUnit marginStartWidth = minimumValueForLength(marginStartLength, conta inerWidth); 2441 LayoutUnit marginStartWidth = minimumValueForLength(marginStartLength, conta inerWidth);
2440 LayoutUnit marginEndWidth = minimumValueForLength(marginEndLength, container Width); 2442 LayoutUnit marginEndWidth = minimumValueForLength(marginEndLength, container Width);
2441 2443
2442 LayoutUnit availableWidth = containerWidth; 2444 LayoutUnit availableWidth = containerWidth;
2443 if (avoidsFloats() && containingBlock->isLayoutBlockFlow() && toLayoutBlockF low(containingBlock)->containsFloats()) { 2445 if (avoidsFloats() && containingBlock->isLayoutBlockFlow() && toLayoutBlockF low(containingBlock)->containsFloats()
2446 && containingBlock->style()->isHorizontalWritingMode() == style()->isHor izontalWritingMode()) {
2444 availableWidth = containingBlockAvailableLineWidth(); 2447 availableWidth = containingBlockAvailableLineWidth();
2445 if (shrinkToAvoidFloats() && availableWidth < containerWidth) { 2448 if (shrinkToAvoidFloats() && availableWidth < containerWidth) {
2446 marginStart = std::max(LayoutUnit(), marginStartWidth); 2449 marginStart = std::max(LayoutUnit(), marginStartWidth);
2447 marginEnd = std::max(LayoutUnit(), marginEndWidth); 2450 marginEnd = std::max(LayoutUnit(), marginEndWidth);
2448 } 2451 }
2449 } 2452 }
2450 2453
2451 // CSS 2.1 (10.3.3): "If 'width' is not 'auto' and 'border-left-width' + 'pa dding-left' + 'width' + 'padding-right' + 'border-right-width' 2454 // CSS 2.1 (10.3.3): "If 'width' is not 'auto' and 'border-left-width' + 'pa dding-left' + 'width' + 'padding-right' + 'border-right-width'
2452 // (plus any of 'margin-left' or 'margin-right' that are not 'auto') is larg er than the width of the containing block, then any 'auto' 2455 // (plus any of 'margin-left' or 'margin-right' that are not 'auto') is larg er than the width of the containing block, then any 'auto'
2453 // values for 'margin-left' or 'margin-right' are, for the following rules, treated as zero. 2456 // values for 'margin-left' or 'margin-right' are, for the following rules, treated as zero.
(...skipping 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after
4921 m_rareData->m_snapAreas->remove(&snapArea); 4924 m_rareData->m_snapAreas->remove(&snapArea);
4922 } 4925 }
4923 } 4926 }
4924 4927
4925 SnapAreaSet* LayoutBox::snapAreas() const 4928 SnapAreaSet* LayoutBox::snapAreas() const
4926 { 4929 {
4927 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4930 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4928 } 4931 }
4929 4932
4930 } // namespace blink 4933 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/writing-mode/orthogonal-writing-modes-floats-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698