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

Side by Side Diff: Source/core/rendering/TextAutosizer.cpp

Issue 16019004: Text Autosizing: Treat position:absolute/fixed as constrained height. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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/text-autosizing/positioned-out-of-flow-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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 bool TextAutosizer::contentHeightIsConstrained(const RenderBlock* container) 440 bool TextAutosizer::contentHeightIsConstrained(const RenderBlock* container)
441 { 441 {
442 // FIXME: Propagate constrainedness down the tree, to avoid inefficiently wa lking back up from each box. 442 // FIXME: Propagate constrainedness down the tree, to avoid inefficiently wa lking back up from each box.
443 // FIXME: This code needs to take into account vertical writing modes. 443 // FIXME: This code needs to take into account vertical writing modes.
444 // FIXME: Consider additional heuristics, such as ignoring fixed heights if the content is already overflowing before autosizing kicks in. 444 // FIXME: Consider additional heuristics, such as ignoring fixed heights if the content is already overflowing before autosizing kicks in.
445 for (; container; container = container->containingBlock()) { 445 for (; container; container = container->containingBlock()) {
446 RenderStyle* style = container->style(); 446 RenderStyle* style = container->style();
447 if (style->overflowY() >= OSCROLL) 447 if (style->overflowY() >= OSCROLL)
448 return false; 448 return false;
449 if (style->height().isSpecified() || style->maxHeight().isSpecified()) { 449 if (style->height().isSpecified() || style->maxHeight().isSpecified() || container->isOutOfFlowPositioned()) {
450 // Some sites (e.g. wikipedia) set their html and/or body elements t o height:100%, 450 // Some sites (e.g. wikipedia) set their html and/or body elements t o height:100%,
451 // without intending to constrain the height of the content within t hem. 451 // without intending to constrain the height of the content within t hem.
452 return !container->isRoot() && !container->isBody(); 452 return !container->isRoot() && !container->isBody();
453 } 453 }
454 if (container->isFloatingOrOutOfFlowPositioned()) 454 if (container->isFloating())
455 return false; 455 return false;
456 } 456 }
457 return false; 457 return false;
458 } 458 }
459 459
460 bool TextAutosizer::clusterShouldBeAutosized(TextAutosizingClusterInfo& clusterI nfo, float blockWidth) 460 bool TextAutosizer::clusterShouldBeAutosized(TextAutosizingClusterInfo& clusterI nfo, float blockWidth)
461 { 461 {
462 Vector<TextAutosizingClusterInfo> clusterInfos(1, clusterInfo); 462 Vector<TextAutosizingClusterInfo> clusterInfos(1, clusterInfo);
463 return compositeClusterShouldBeAutosized(clusterInfos, blockWidth); 463 return compositeClusterShouldBeAutosized(clusterInfos, blockWidth);
464 } 464 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 if (i + 1 < clusterInfos.size()) { 612 if (i + 1 < clusterInfos.size()) {
613 float currentWidth = clusterInfos[i].root->contentLogicalWidth(); 613 float currentWidth = clusterInfos[i].root->contentLogicalWidth();
614 float nextWidth = clusterInfos[i + 1].root->contentLogicalWidth(); 614 float nextWidth = clusterInfos[i + 1].root->contentLogicalWidth();
615 if (currentWidth - nextWidth > maxWidthDifferenceWithinGroup) 615 if (currentWidth - nextWidth > maxWidthDifferenceWithinGroup)
616 groups.grow(groups.size() + 1); 616 groups.grow(groups.size() + 1);
617 } 617 }
618 } 618 }
619 } 619 }
620 620
621 } // namespace WebCore 621 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/text-autosizing/positioned-out-of-flow-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698