diff options
author | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-08-20 20:23:31 +0000 |
---|---|---|
committer | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-08-20 20:23:31 +0000 |
commit | e78b1c69c0ca8adb1100bb9f906ff860cbdf02dc (patch) | |
tree | cee8e3c5d688a6716c8df713a4eaf86e43fe6b03 /third_party/WebKit/LayoutTests/fast/text-autosizing/wide-block-expected.html | |
parent | 9e7a220af322acfea7684d9bff296bc6000d8086 (diff) | |
download | chromium_src-e78b1c69c0ca8adb1100bb9f906ff860cbdf02dc.zip chromium_src-e78b1c69c0ca8adb1100bb9f906ff860cbdf02dc.tar.gz chromium_src-e78b1c69c0ca8adb1100bb9f906ff860cbdf02dc.tar.bz2 |
Text Autosizing: Only take into account block width <= document layout width.
https://bugs.webkit.org/show_bug.cgi?id=93862
Patch by John Mellor <johnme@chromium.org> on 2012-08-20
Reviewed by Kenneth Rohde Christiansen.
Source/WebCore:
Instead of calculating the textAutosizingMultiplier purely based on the
width of each block, we now work out the maximum width of the block
that could be displayed onscreen at any one time, and use that value.
This avoids excessive text size multiplication (there's no point making
text bigger than this, since you wouldn't be able to zoom out far
enough to read it!).
To determine the maximum onscreen block width, we take the minimum of
the block width and the layoutWidth of the narrowest non-flattened
ancestor frame. Flattened frames are ignored since they don't impose a
hard limit on the maximum width that can be displayed, instead they can
stretch to fit their contents. Note that on mobile the layoutWidth of
the main frame is the fixed layout width aka viewport width.
In practice this caps the maximum multiplier to a value that depends
on the metrics of the device. For example on a Nexus S (480 x 800px
and 1.5x devicePixelRatio) with a 980px default fixed layout width,
this limits the multiplier to: 980 / (480/1.5) = 3.0625
Most pages won't have blocks that actually hit this cap, or they will
only slightly exceed it (so their multiplier will only be slightly
reduced). For example it's not uncommon for desktop pages to be
slightly wider than 980px, but they would have to additionally have
text that spans the full width of the page for this to affect them, and
even then it would merely slightly decrease their multiplier).
This will have more dramatic effects on the rare desktop pages which
give a width=device-width (or similar) mobile viewport tag (on ports
which support viewports). A follow-up patch will hopefully address this
by wrapping the text in such excessively wide blocks to the layoutWidth.
Tests: fast/text-autosizing/narrow-iframe-flattened.html
fast/text-autosizing/narrow-iframe.html
fast/text-autosizing/wide-block.html
fast/text-autosizing/wide-iframe.html
* page/FrameView.cpp:
(WebCore::FrameView::isInChildFrameWithFrameFlattening):
Made public and const, so can be used from TextAutosizer.
* rendering/TextAutosizer.cpp:
(WebCore::TextAutosizer::processSubtree):
Computes the minimum layout width of the parent frames, as described
above.
(WebCore::TextAutosizer::processBlock):
Limits used block width to this min layout width.
LayoutTests:
Added 4 tests: a block wider than the main frame, iframes both narrower
than and wider than the main frame, both also containing wide blocks,
and a narrow iframe expanded by frame flattening.
I verified experimentally that narrow-iframe-flattened.html passes, by
enabling frame flattening in Settings.cpp, but unfortunately it won't
get run by any bots since the only platform which currently enables
Text Autosizing (Chromium), doesn't enable frame flattening (or have
the DRT methods required to test it).
* fast/text-autosizing/font-scale-factor-expected.html:
* fast/text-autosizing/font-scale-factor.html:
* fast/text-autosizing/narrow-iframe-expected.html: Added.
* fast/text-autosizing/narrow-iframe-flattened-expected.html: Added.
* fast/text-autosizing/narrow-iframe-flattened.html: Added.
* fast/text-autosizing/narrow-iframe.html: Added.
* fast/text-autosizing/wide-block-expected.html: Added.
* fast/text-autosizing/wide-block.html: Added.
* fast/text-autosizing/wide-iframe-expected.html: Added.
* fast/text-autosizing/wide-iframe.html: Added.
* platform/chromium/TestExpectations:
* platform/win/Skipped:
* platform/wincairo/Skipped:
git-svn-id: svn://svn.chromium.org/blink/trunk@126058 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/text-autosizing/wide-block-expected.html')
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/text-autosizing/wide-block-expected.html | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/text-autosizing/wide-block-expected.html b/third_party/WebKit/LayoutTests/fast/text-autosizing/wide-block-expected.html new file mode 100644 index 0000000..61896b4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/text-autosizing/wide-block-expected.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> +<head> + +<meta name="viewport" content="width=800"> +<style type="text/css"> +body { width: 800px; margin: 0; overflow-y: hidden; } +</style> + +</head> +<body> + +<div style="width: 1600px; font-size: 2.5rem"> + 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> + +</body> +</html> |