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

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

Issue 2121173002: [css-grid] Fix percentage height resolution for replaced elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/LayoutBoxModelObject.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) 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 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // the layout view. The available height is taken from the frame. 548 // the layout view. The available height is taken from the frame.
549 if (cb->isLayoutView()) 549 if (cb->isLayoutView())
550 return nullptr; 550 return nullptr;
551 551
552 if (cb->isOutOfFlowPositioned() && !cb->style()->logicalTop().isAuto() && !c b->style()->logicalBottom().isAuto()) 552 if (cb->isOutOfFlowPositioned() && !cb->style()->logicalTop().isAuto() && !c b->style()->logicalBottom().isAuto())
553 return nullptr; 553 return nullptr;
554 554
555 return cb; 555 return cb;
556 } 556 }
557 557
558 bool LayoutBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() const 558 bool LayoutBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight(bool che ckingContainingBlock) const
svillar 2016/07/07 11:45:48 It's usually considered better to use an enum inst
Manuel Rego 2016/07/07 14:40:57 Ok, I can change this I'm thinking in something li
cbiesinger 2016/07/07 17:34:27 To make sure I understand, callers should never pa
Manuel Rego 2016/07/08 07:57:04 Yeah that's the idea. Probably it'd be better tha
559 { 559 {
560 const LayoutBox* thisBox = isBox() ? toLayoutBox(this) : nullptr; 560 const LayoutBox* thisBox = isBox() ? toLayoutBox(this) : nullptr;
561 Length logicalHeightLength = style()->logicalHeight(); 561 Length logicalHeightLength = style()->logicalHeight();
562 LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeightLength) ; 562 LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeightLength) ;
563 if (logicalHeightLength.hasPercent() && cb && isBox()) 563 if (logicalHeightLength.hasPercent() && cb && isBox())
564 cb->addPercentHeightDescendant(const_cast<LayoutBox*>(toLayoutBox(this)) ); 564 cb->addPercentHeightDescendant(const_cast<LayoutBox*>(toLayoutBox(this)) );
565 if (thisBox && thisBox->isFlexItem()) { 565 if (thisBox && thisBox->isFlexItem()) {
566 LayoutFlexibleBox& flexBox = toLayoutFlexibleBox(*parent()); 566 LayoutFlexibleBox& flexBox = toLayoutFlexibleBox(*parent());
567 if (flexBox.childLogicalHeightForPercentageResolution(*thisBox) != Layou tUnit(-1)) 567 if (flexBox.childLogicalHeightForPercentageResolution(*thisBox) != Layou tUnit(-1))
568 return false; 568 return false;
569 } 569 }
570 if (thisBox && thisBox->isGridItem()) {
571 if (checkingContainingBlock && thisBox->hasOverrideLogicalContentHeight( ))
572 return false;
573 if (!checkingContainingBlock && thisBox->hasOverrideContainingBlockLogic alHeight())
574 return false;
575 }
570 if (logicalHeightLength.isAuto()) 576 if (logicalHeightLength.isAuto())
571 return true; 577 return true;
572 578
573 if (document().inQuirksMode()) 579 if (document().inQuirksMode())
574 return false; 580 return false;
575 581
576 // If the height of the containing block computes to 'auto', then it hasn't been 'specified explicitly'. 582 // If the height of the containing block computes to 'auto', then it hasn't been 'specified explicitly'.
577 if (cb) 583 if (cb)
578 return cb->hasAutoHeightOrContainingBlockWithAutoHeight(); 584 return cb->hasAutoHeightOrContainingBlockWithAutoHeight(true);
579 return false; 585 return false;
580 } 586 }
581 587
582 LayoutSize LayoutBoxModelObject::relativePositionOffset() const 588 LayoutSize LayoutBoxModelObject::relativePositionOffset() const
583 { 589 {
584 LayoutSize offset = accumulateInFlowPositionOffsets(); 590 LayoutSize offset = accumulateInFlowPositionOffsets();
585 591
586 LayoutBlock* containingBlock = this->containingBlock(); 592 LayoutBlock* containingBlock = this->containingBlock();
587 593
588 // Objects that shrink to avoid floats normally use available line width whe n computing containing block width. However 594 // Objects that shrink to avoid floats normally use available line width whe n computing containing block width. However
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 if (rootElementStyle->hasBackground()) 1121 if (rootElementStyle->hasBackground())
1116 return false; 1122 return false;
1117 1123
1118 if (node() != document().firstBodyElement()) 1124 if (node() != document().firstBodyElement())
1119 return false; 1125 return false;
1120 1126
1121 return true; 1127 return true;
1122 } 1128 }
1123 1129
1124 } // namespace blink 1130 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698