diff options
author | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-09-21 06:20:57 +0000 |
---|---|---|
committer | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-09-21 06:20:57 +0000 |
commit | 4c33c8b64e190f0753828bdde5a03140437c2c72 (patch) | |
tree | 4be774a799cc90088b44da17b6fa108afe9643f5 /third_party/WebKit/LayoutTests/fast/text-autosizing/constrained-and-overflow-scroll-ancestor-expected.html | |
parent | 649dde1d0881279bea5d621d48f95ef5003e43e1 (diff) | |
download | chromium_src-4c33c8b64e190f0753828bdde5a03140437c2c72.zip chromium_src-4c33c8b64e190f0753828bdde5a03140437c2c72.tar.gz chromium_src-4c33c8b64e190f0753828bdde5a03140437c2c72.tar.bz2 |
Text Autosizing: Cluster text at flow roots, for consistency and to avoid autosizing headers/footers.
https://bugs.webkit.org/show_bug.cgi?id=97025
Patch by John Mellor <johnme@chromium.org> on 2012-09-20
Reviewed by Julien Chaffraix.
Source/WebCore:
This patch has 3 main changes:
1. All text within a "cluster" (roughly equivalent to a CSS flow root /
block formatting context) must have a uniform textAutosizingMultiplier,
except for subtrees which are themselves clusters. This improves the
consistency of the final output, since sibling blocks are now more
likely to have the same multiplier (hence grow in proportion).
2. Clusters must contain a minimum amount of text in order to be
autosized (4 lines of text, assuming each char is 1em wide, so about
2 lines of text in practice). This is to reduce the likelihood of
autosizing things like headers and footers, which can be quite
visually distracting. The rationale is that if a cluster contains
very few lines of text then it's ok to have to zoom in and pan from
side to side to read each line, since if there are very few lines of
text you'll only need to pan across once or twice.
3. To avoid adding a 3rd tree traversal, processSubtree/processBox were
refactored such that all of Text Autosizing now happens as a single
tree traversal (hence halving the number of tree traversals done).
Tests: fast/text-autosizing/cluster-narrow-in-wide.html
fast/text-autosizing/cluster-wide-in-narrow.html
fast/text-autosizing/clusters-insufficient-text.html
fast/text-autosizing/clusters-insufficient-width.html
fast/text-autosizing/clusters-sufficient-text-except-in-root.html
fast/text-autosizing/clusters-sufficient-width.html
* rendering/TextAutosizer.cpp:
(TextAutosizingWindowInfo):
Added this struct to bundle together the various sizes that
processSubtree needs to pass to every recursive call to
processCluster and processContainer.
(WebCore::TextAutosizer::processSubtree):
- Bundle windowSize and minLayoutSize together as a single struct,
TextAutosizingWindowInfo, rather than passing them separately.
- Walk up the tree to find the current cluster and container, rather
than (incorrectly) assuming that the layoutRoot is always a
container.
- Call processCluster instead of traversing the tree.
(WebCore::TextAutosizer::processCluster):
Calculates the multiplier based on the width of the cluster (moved
the calculation here from processBox, since now the multiplier is
fixed per cluster), and delegates to processContainer for the actual
tree traversal (since clusters are also containers).
(WebCore::contentHeightIsConstrained):
Changed parameter to RenderBlock.
(WebCore::TextAutosizer::processContainer):
This now takes care of the whole tree traversal, recursively calling
processCluster/processContainer when it encounters such an object,
and setMultiplier on RenderText objects (as processBox used to).
Also added a check that the RenderText's multiplier is not already
equal to the target multiplier (to save needlessly setting it).
(WebCore::TextAutosizer::isContainer):
- Changed to be a positive (is) instead of negative (isNot) check.
- Require objects to be RenderBlocks so it's easier to find them
using containingBlock, and there don't seem to be many interesting
RenderBoxes that aren't RenderBlocks.
(WebCore::TextAutosizer::isAutosizingCluster):
A container that is also a flow root / block formatting context
(approximately), hence demarcates an independent region of the page,
within which we want consistent autosizing.
(WebCore::TextAutosizer::clusterShouldBeAutosized):
Uses measureDescendantTextWidth and to check whether the cluster
contains enough text to be worth autosizing.
(WebCore::TextAutosizer::measureDescendantTextWidth):
Recursively traverse the cluster, skipping constrained height
containers as processContainer does, to measure how much autosizable
text it contains. Early out as soon as the minimum text width is
reached.
(WebCore::TextAutosizer::nextInPreOrderSkippingDescendantsOfContainers):
Replaces nextInPreOrderMatchingFilter. The filter is now fixed to
isContainer (we no longer need an isAutosizingCluster filter, since
I consolidated the tree traversal), and filtered objects are
actually returned (so they can in turn be recursively traversed),
it's just their descendants that get skipped.
* rendering/TextAutosizer.h:
(TextAutosizer):
- Deleted RenderObjectFilterFunctor, since the filter of
nextInPreOrderSkippingDescendantsOfContainers is now fixed.
LayoutTests:
Added 6 tests (cluster*.html). Updated various other tests to have
enough text so that they continue to pass, or that if they fail, it's
for the reason that was being tested, not just because clustering
decided they had insufficient text.
* fast/text-autosizing/cluster-narrow-in-wide-expected.html: Added.
* fast/text-autosizing/cluster-narrow-in-wide.html: Copied from LayoutTests/fast/text-autosizing/em-margin-border-padding.html.
* fast/text-autosizing/cluster-wide-in-narrow-expected.html: Added.
* fast/text-autosizing/cluster-wide-in-narrow.html: Added.
* fast/text-autosizing/clusters-insufficient-text-expected.html: Added.
* fast/text-autosizing/clusters-insufficient-text.html: Added.
* fast/text-autosizing/clusters-insufficient-width-expected.html: Added.
* fast/text-autosizing/clusters-insufficient-width.html: Added.
* fast/text-autosizing/clusters-sufficient-text-except-in-root-expected.html: Added.
* fast/text-autosizing/clusters-sufficient-text-except-in-root.html: Added.
* fast/text-autosizing/clusters-sufficient-width-expected.html: Added.
* fast/text-autosizing/clusters-sufficient-width.html: Added.
* fast/text-autosizing/constrained-and-overflow-auto-ancestor-expected.html:
* fast/text-autosizing/constrained-and-overflow-auto-ancestor.html:
* fast/text-autosizing/constrained-and-overflow-hidden-ancestor-expected.html:
* fast/text-autosizing/constrained-and-overflow-hidden-ancestor.html:
* fast/text-autosizing/constrained-and-overflow-paged-x-ancestor-expected.html:
* fast/text-autosizing/constrained-and-overflow-paged-x-ancestor.html:
* fast/text-autosizing/constrained-and-overflow-scroll-ancestor-expected.html:
* fast/text-autosizing/constrained-and-overflow-scroll-ancestor.html:
* fast/text-autosizing/constrained-height-ancestor-expected.html:
* fast/text-autosizing/constrained-height-ancestor.html:
* fast/text-autosizing/constrained-maxheight-ancestor-expected.html:
* fast/text-autosizing/constrained-maxheight-ancestor.html:
* fast/text-autosizing/constrained-maxheight-expected.html:
* fast/text-autosizing/constrained-maxheight.html:
* fast/text-autosizing/constrained-percent-maxheight-expected.html:
* fast/text-autosizing/constrained-percent-maxheight.html:
* fast/text-autosizing/constrained-percent-of-viewport-maxheight-expected.html:
* fast/text-autosizing/constrained-percent-of-viewport-maxheight.html:
* fast/text-autosizing/constrained-then-overflow-ancestors-expected.html:
* fast/text-autosizing/constrained-then-overflow-ancestors.html:
* fast/text-autosizing/constrained-then-overflow-then-positioned-ancestors-expected.html:
* fast/text-autosizing/constrained-then-overflow-then-positioned-ancestors.html:
* fast/text-autosizing/constrained-then-position-absolute-ancestors-expected.html:
* fast/text-autosizing/constrained-then-position-absolute-ancestors.html:
* fast/text-autosizing/constrained-then-position-fixed-ancestors-expected.html:
* fast/text-autosizing/constrained-then-position-fixed-ancestors.html:
* fast/text-autosizing/constrained-within-overflow-ancestor-expected.html:
* fast/text-autosizing/constrained-within-overflow-ancestor.html:
* fast/text-autosizing/em-margin-border-padding-expected.html:
* fast/text-autosizing/em-margin-border-padding.html:
* fast/text-autosizing/narrow-child-expected.html:
* fast/text-autosizing/narrow-child.html:
* fast/text-autosizing/wide-child-expected.html:
* fast/text-autosizing/wide-child.html:
* fast/text-autosizing/wide-iframe-expected.html:
* fast/text-autosizing/wide-iframe.html:
git-svn-id: svn://svn.chromium.org/blink/trunk@129195 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/text-autosizing/constrained-and-overflow-scroll-ancestor-expected.html')
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/text-autosizing/constrained-and-overflow-scroll-ancestor-expected.html | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/text-autosizing/constrained-and-overflow-scroll-ancestor-expected.html b/third_party/WebKit/LayoutTests/fast/text-autosizing/constrained-and-overflow-scroll-ancestor-expected.html index 35784c9..b44cd77 100644 --- a/third_party/WebKit/LayoutTests/fast/text-autosizing/constrained-and-overflow-scroll-ancestor-expected.html +++ b/third_party/WebKit/LayoutTests/fast/text-autosizing/constrained-and-overflow-scroll-ancestor-expected.html @@ -3,9 +3,9 @@ <head> <meta name="viewport" content="width=800"> -<style type="text/css"> +<style> html { font-size: 16px; } -body { width: 800px; margin: 0; } +body { width: 800px; margin: 0; overflow-y: hidden; } ::-webkit-scrollbar { /* Keeps the text size multiplier a round number. */ width: 0px; @@ -18,7 +18,8 @@ body { width: 800px; margin: 0; } <div style="max-height: 500px; overflow-y: scroll"> <div> <div style="font-size: 2.5rem"> - This text should be autosized to 40px computed font-size, since the grandparent's overflow-y:scroll means the available height is unconstrained (despite the grandparent also having a max-height). + This text should be autosized to 40px computed font-size, since the grandparent's overflow-y:scroll means the available height is unconstrained (despite the grandparent also having a max-height).<br> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div> </div> </div> |