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

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

Issue 2065243003: [css-sizing] Ensure positive available size on replaced elements Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: A different approach. Created 4 years, 1 month 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. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 3232 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 return computeReplacedLogicalWidthRespectingMinMaxWidth( 3243 return computeReplacedLogicalWidthRespectingMinMaxWidth(
3244 computeReplacedLogicalWidthUsing(MainOrPreferredSize, 3244 computeReplacedLogicalWidthUsing(MainOrPreferredSize,
3245 style()->logicalWidth()), 3245 style()->logicalWidth()),
3246 shouldComputePreferred); 3246 shouldComputePreferred);
3247 } 3247 }
3248 3248
3249 LayoutUnit LayoutBox::computeReplacedLogicalWidthRespectingMinMaxWidth( 3249 LayoutUnit LayoutBox::computeReplacedLogicalWidthRespectingMinMaxWidth(
3250 LayoutUnit logicalWidth, 3250 LayoutUnit logicalWidth,
3251 ShouldComputePreferred shouldComputePreferred) const { 3251 ShouldComputePreferred shouldComputePreferred) const {
3252 LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred && 3252 LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred &&
3253 style()->logicalMinWidth().isPercentOrCalc()) 3253 (style()->logicalMinWidth().isPercentOrCalc() ||
3254 style()->logicalMinWidth().isFitContent() ||
3255 style()->logicalMinWidth().isFillAvailable()))
3254 ? logicalWidth 3256 ? logicalWidth
3255 : computeReplacedLogicalWidthUsing( 3257 : computeReplacedLogicalWidthUsing(
3256 MinSize, style()->logicalMinWidth()); 3258 MinSize, style()->logicalMinWidth());
3257 LayoutUnit maxLogicalWidth = 3259 LayoutUnit maxLogicalWidth =
3258 (shouldComputePreferred == ComputePreferred && 3260 (shouldComputePreferred == ComputePreferred &&
3259 style()->logicalMaxWidth().isPercentOrCalc()) || 3261 (style()->logicalMaxWidth().isPercentOrCalc() ||
3262 style()->logicalMaxWidth().isFitContent() ||
3263 style()->logicalMaxWidth().isFillAvailable())) ||
mstensho (USE GERRIT) 2016/11/10 19:54:25 So, what's a good term to use when you're either p
jfernandez 2016/11/10 20:54:39 If I manage to do something very simple, I think i
3260 style()->logicalMaxWidth().isMaxSizeNone() 3264 style()->logicalMaxWidth().isMaxSizeNone()
3261 ? logicalWidth 3265 ? logicalWidth
3262 : computeReplacedLogicalWidthUsing(MaxSize, 3266 : computeReplacedLogicalWidthUsing(MaxSize,
3263 style()->logicalMaxWidth()); 3267 style()->logicalMaxWidth());
3264 return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth)); 3268 return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth));
3265 } 3269 }
3266 3270
3267 LayoutUnit LayoutBox::computeReplacedLogicalWidthUsing( 3271 LayoutUnit LayoutBox::computeReplacedLogicalWidthUsing(
3268 SizeType sizeType, 3272 SizeType sizeType,
3269 const Length& logicalWidth) const { 3273 const Length& logicalWidth) const {
(...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after
5638 LayoutRect rect = frameRect(); 5642 LayoutRect rect = frameRect();
5639 5643
5640 LayoutBlock* block = containingBlock(); 5644 LayoutBlock* block = containingBlock();
5641 if (block) 5645 if (block)
5642 block->adjustChildDebugRect(rect); 5646 block->adjustChildDebugRect(rect);
5643 5647
5644 return rect; 5648 return rect;
5645 } 5649 }
5646 5650
5647 } // namespace blink 5651 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698