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

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

Issue 2086083002: Fix percentage handling for replaced elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: with test 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/Source/core/layout/LayoutBox.cpp ('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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() const
559 { 559 {
560 const LayoutBox* thisBox = isBox() ? toLayoutBox(this) : nullptr; 560 const LayoutBox* thisBox = isBox() ? toLayoutBox(this) : nullptr;
561 Length logicalHeightLength = style()->logicalHeight();
562 LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeightLength) ;
563 if (logicalHeightLength.hasPercent() && cb && isBox())
564 cb->addPercentHeightDescendant(const_cast<LayoutBox*>(toLayoutBox(this)) );
561 if (thisBox && thisBox->isFlexItem()) { 565 if (thisBox && thisBox->isFlexItem()) {
562 LayoutFlexibleBox& flexBox = toLayoutFlexibleBox(*parent()); 566 LayoutFlexibleBox& flexBox = toLayoutFlexibleBox(*parent());
563 if (flexBox.childLogicalHeightForPercentageResolution(*thisBox) != Layou tUnit(-1)) 567 if (flexBox.childLogicalHeightForPercentageResolution(*thisBox) != Layou tUnit(-1))
564 return false; 568 return false;
565 } 569 }
566 Length logicalHeightLength = style()->logicalHeight();
567 if (logicalHeightLength.isAuto()) 570 if (logicalHeightLength.isAuto())
568 return true; 571 return true;
569 572
570 if (document().inQuirksMode()) 573 if (document().inQuirksMode())
571 return false; 574 return false;
572 575
573 // If the height of the containing block computes to 'auto', then it hasn't been 'specified explicitly'. 576 // If the height of the containing block computes to 'auto', then it hasn't been 'specified explicitly'.
574 if (LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeightLen gth)) 577 if (cb)
575 return cb->hasAutoHeightOrContainingBlockWithAutoHeight(); 578 return cb->hasAutoHeightOrContainingBlockWithAutoHeight();
576 return false; 579 return false;
577 } 580 }
578 581
579 LayoutSize LayoutBoxModelObject::relativePositionOffset() const 582 LayoutSize LayoutBoxModelObject::relativePositionOffset() const
580 { 583 {
581 LayoutSize offset = accumulateInFlowPositionOffsets(); 584 LayoutSize offset = accumulateInFlowPositionOffsets();
582 585
583 LayoutBlock* containingBlock = this->containingBlock(); 586 LayoutBlock* containingBlock = this->containingBlock();
584 587
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 if (rootElementStyle->hasBackground()) 1115 if (rootElementStyle->hasBackground())
1113 return false; 1116 return false;
1114 1117
1115 if (node() != document().firstBodyElement()) 1118 if (node() != document().firstBodyElement())
1116 return false; 1119 return false;
1117 1120
1118 return true; 1121 return true;
1119 } 1122 }
1120 1123
1121 } // namespace blink 1124 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698