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

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

Issue 1171703002: Don't let anonymous boxes impede percentage resolution on children. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/ruby/percentage-height-child-expected.html ('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 2414 matching lines...) Expand 10 before | Expand all | Expand 10 after
2425 return -1; 2425 return -1;
2426 } 2426 }
2427 2427
2428 bool LayoutBox::skipContainingBlockForPercentHeightCalculation(const LayoutBox* containingBlock) const 2428 bool LayoutBox::skipContainingBlockForPercentHeightCalculation(const LayoutBox* containingBlock) const
2429 { 2429 {
2430 // If the writing mode of the containing block is orthogonal to ours, it mea ns that we shouldn't 2430 // If the writing mode of the containing block is orthogonal to ours, it mea ns that we shouldn't
2431 // skip anything, since we're going to resolve the percentage height against a containing block *width*. 2431 // skip anything, since we're going to resolve the percentage height against a containing block *width*.
2432 if (isHorizontalWritingMode() != containingBlock->isHorizontalWritingMode()) 2432 if (isHorizontalWritingMode() != containingBlock->isHorizontalWritingMode())
2433 return false; 2433 return false;
2434 2434
2435 // Flow threads for multicol or paged overflow should be skipped. They are i nvisible to the DOM, 2435 // Anonymous layout objects are invisible to the DOM, so whatever they're do ing there, they
2436 // and percent heights of children should be resolved against the multicol o r paged container. 2436 // should not impede percentage resolution on a child. Examples of such anon ymous layout objects
2437 if (containingBlock->isLayoutFlowThread()) 2437 // are multicol flow threads and ruby runs.
2438 if (containingBlock->isAnonymous())
2438 return true; 2439 return true;
2439 2440
2440 // For quirks mode and anonymous blocks, we skip auto-height containingBlock s when computing percentages. 2441 // For quirks mode, we skip most auto-height containing blocks when computin g percentages.
2441 // For standards mode, we treat the percentage as auto if it has an auto-hei ght containing block. 2442 return document().inQuirksMode() && !containingBlock->isTableCell() && !cont ainingBlock->isOutOfFlowPositioned() && containingBlock->style()->logicalHeight( ).isAuto();
2442 if (!document().inQuirksMode() && !containingBlock->isAnonymousBlock())
2443 return false;
2444
2445 return !containingBlock->isTableCell() && !containingBlock->isOutOfFlowPosit ioned() && containingBlock->style()->logicalHeight().isAuto();
2446 } 2443 }
2447 2444
2448 LayoutUnit LayoutBox::computePercentageLogicalHeight(const Length& height) const 2445 LayoutUnit LayoutBox::computePercentageLogicalHeight(const Length& height) const
2449 { 2446 {
2450 LayoutUnit availableHeight = -1; 2447 LayoutUnit availableHeight = -1;
2451 2448
2452 bool skippedAutoHeightContainingBlock = false; 2449 bool skippedAutoHeightContainingBlock = false;
2453 LayoutBlock* cb = containingBlock(); 2450 LayoutBlock* cb = containingBlock();
2454 const LayoutBox* containingBlockChild = this; 2451 const LayoutBox* containingBlockChild = this;
2455 LayoutUnit rootMarginBorderPaddingHeight = 0; 2452 LayoutUnit rootMarginBorderPaddingHeight = 0;
(...skipping 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after
4793 bool LayoutBox::canRenderBorderImage() const 4790 bool LayoutBox::canRenderBorderImage() const
4794 { 4791 {
4795 if (!style()->hasBorderDecoration()) 4792 if (!style()->hasBorderDecoration())
4796 return false; 4793 return false;
4797 4794
4798 StyleImage* borderImage = style()->borderImage().image(); 4795 StyleImage* borderImage = style()->borderImage().image();
4799 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4796 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4800 } 4797 }
4801 4798
4802 } // namespace blink 4799 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/ruby/percentage-height-child-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698