Diff
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-height-body-expected.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-height-body-expected.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-height-body-expected.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
</style>
</head>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-height-body.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-height-body.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-height-body.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
</style>
<script>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-then-float-ancestors-expected.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-then-float-ancestors-expected.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-then-float-ancestors-expected.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
</style>
</head>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-then-float-ancestors.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-then-float-ancestors.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-then-float-ancestors.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
</style>
<script>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-then-position-fixed-ancestors-expected.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-then-position-fixed-ancestors-expected.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-then-position-fixed-ancestors-expected.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
</style>
</head>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-then-position-fixed-ancestors.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-then-position-fixed-ancestors.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/constrained-then-position-fixed-ancestors.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
</style>
<script>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/nested-em-line-height-expected.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/nested-em-line-height-expected.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/nested-em-line-height-expected.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
</style>
</head>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/nested-em-line-height.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/nested-em-line-height.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/nested-em-line-height.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
</style>
<script>
Copied: branches/chromium/1410/LayoutTests/fast/text-autosizing/oscillation-_javascript_-fontsize-change-expected.html (from rev 143356, trunk/LayoutTests/fast/text-autosizing/oscillation-_javascript_-fontsize-change-expected.html) (0 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/oscillation-_javascript_-fontsize-change-expected.html (rev 0)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/oscillation-_javascript_-fontsize-change-expected.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html style="font-size: 16px">
+<head>
+
+<meta name="viewport" content="width=800">
+<style>
+ body {
+ width: 800px;
+ margin: 0;
+ overflow-y: hidden;
+ }
+</style>
+
+</head>
+<body>
+
+<div style="top:50px;position:absolute;font-size:19.8px">
+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<br/>
+ This paragraph should be autosized to 19.8px<br/>
+ because it contains line breaks.<br/>
+ This test is intended to check<br/>
+ that there are no oscillations due to _javascript_<br/>
+ briefly increasing the font size of a<br/>
+ small paragraph below.
+</div>
+<div id="sizechanging">
+ This text changes size using _javascript_ below.
+</div>
+
+</body>
+</html>
Copied: branches/chromium/1410/LayoutTests/fast/text-autosizing/oscillation-_javascript_-fontsize-change.html (from rev 143356, trunk/LayoutTests/fast/text-autosizing/oscillation-_javascript_-fontsize-change.html) (0 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/oscillation-_javascript_-fontsize-change.html (rev 0)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/oscillation-_javascript_-fontsize-change.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html style="font-size: 16px">
+<head>
+
+<meta name="viewport" content="width=800">
+<style>
+ body {
+ width: 800px;
+ margin: 0;
+ overflow-y: hidden;
+ }
+ .largersize{font-size: 1.1em}
+</style>
+
+<script>
+if (window.internals) {
+ window.internals.settings.setTextAutosizingEnabled(true);
+ window.internals.settings.setTextAutosizingWindowSizeOverride(320, 480);
+} else if (window.console && console.warn) {
+ console.warn("This test depends on the Text Autosizing setting being true, so run it in DumpRenderTree, or manually enable Text Autosizing, and either use a mobile device with 320px device-width (like Nexus S or iPhone), or define HACK_FORCE_TEXT_AUTOSIZING_ON_DESKTOP.");
+}
+</script>
+
+</head>
+<body>
+
+<div style="top:50px;position:absolute;">
+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<br/>
+ This paragraph should be autosized to 19.8px<br/>
+ because it contains line breaks.<br/>
+ This test is intended to check<br/>
+ that there are no oscillations due to _javascript_<br/>
+ briefly increasing the font size of a<br/>
+ small paragraph below.
+</div>
+<div id="sizechanging">
+ This text changes size using _javascript_ below.
+</div>
+
+<script>
+element = document.getElementById("sizechanging");
+if (element.offsetHeight) {
+ // force layout (computation of offsetHeight triggers reflow)
+}
+element.className = 'largersize';
+if (element.offsetHeight) {}
+element.className = '';
+if (element.offsetHeight) {}
+</script>
+<noscript>fail (no support for _javascript_)</noscript>
+
+</body>
+</html>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/simple-paragraph-expected.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/simple-paragraph-expected.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/simple-paragraph-expected.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
</style>
</head>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/simple-paragraph.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/simple-paragraph.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/simple-paragraph.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
</style>
<script>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/span-child-expected.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/span-child-expected.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/span-child-expected.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
</style>
</head>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/span-child.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/span-child.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/span-child.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
</style>
<script>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/unwrappable-blocks-expected.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/unwrappable-blocks-expected.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/unwrappable-blocks-expected.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
pre { margin: 0; }
</style>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/unwrappable-blocks.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/unwrappable-blocks.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/unwrappable-blocks.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
pre { margin: 0; }
</style>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/unwrappable-inlines-expected.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/unwrappable-inlines-expected.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/unwrappable-inlines-expected.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
pre { margin: 0; }
</style>
Modified: branches/chromium/1410/LayoutTests/fast/text-autosizing/unwrappable-inlines.html (143933 => 143934)
--- branches/chromium/1410/LayoutTests/fast/text-autosizing/unwrappable-inlines.html 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/LayoutTests/fast/text-autosizing/unwrappable-inlines.html 2013-02-25 17:05:25 UTC (rev 143934)
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=800">
<style>
html { font-size: 16px; }
-body { width: 800px; margin: 0; }
+body { width: 800px; margin: 0; overflow-y: hidden; }
pre { margin: 0; }
</style>
Modified: branches/chromium/1410/Source/WebCore/page/FrameView.cpp (143933 => 143934)
--- branches/chromium/1410/Source/WebCore/page/FrameView.cpp 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/Source/WebCore/page/FrameView.cpp 2013-02-25 17:05:25 UTC (rev 143934)
@@ -449,6 +449,17 @@
if (newRect == oldRect)
return;
+#if ENABLE(TEXT_AUTOSIZING)
+ // Autosized font sizes depend on the width of the viewing area.
+ if (newRect.width() != oldRect.width()) {
+ Page* page = m_frame ? m_frame->page() : 0;
+ if (page && page->mainFrame() == m_frame && page->settings()->textAutosizingEnabled()) {
+ for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
+ m_frame->document()->textAutosizer()->recalculateMultipliers();
+ }
+ }
+#endif
+
ScrollView::setFrameRect(newRect);
updateScrollableAreaSet();
Modified: branches/chromium/1410/Source/WebCore/page/Settings.cpp (143933 => 143934)
--- branches/chromium/1410/Source/WebCore/page/Settings.cpp 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/Source/WebCore/page/Settings.cpp 2013-02-25 17:05:25 UTC (rev 143934)
@@ -41,6 +41,7 @@
#include "PageCache.h"
#include "ResourceHandle.h"
#include "StorageMap.h"
+#include "TextAutosizer.h"
#include <limits>
using namespace std;
@@ -363,6 +364,11 @@
void Settings::setTextAutosizingFontScaleFactor(float fontScaleFactor)
{
m_textAutosizingFontScaleFactor = fontScaleFactor;
+
+ // FIXME: I wonder if this needs to traverse frames like in WebViewImpl::resize, or whether there is only one document per Settings instance?
+ for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext())
+ frame->document()->textAutosizer()->recalculateMultipliers();
+
m_page->setNeedsRecalcStyleInAllFrames();
}
Modified: branches/chromium/1410/Source/WebCore/rendering/TextAutosizer.cpp (143933 => 143934)
--- branches/chromium/1410/Source/WebCore/rendering/TextAutosizer.cpp 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/Source/WebCore/rendering/TextAutosizer.cpp 2013-02-25 17:05:25 UTC (rev 143934)
@@ -91,6 +91,16 @@
{
}
+void TextAutosizer::recalculateMultipliers()
+{
+ RenderObject* renderer = m_document->renderer();
+ while (renderer) {
+ if (renderer->style() && renderer->style()->textAutosizingMultiplier() != 1)
+ setMultiplier(renderer, 1);
+ renderer = renderer->nextInPreOrder();
+ }
+}
+
bool TextAutosizer::processSubtree(RenderObject* layoutRoot)
{
// FIXME: Text Autosizing should only be enabled when m_document->page()->mainFrame()->view()->useFixedLayout()
@@ -189,7 +199,7 @@
RenderObject* descendant = nextInPreOrderSkippingDescendantsOfContainers(subtreeRoot, subtreeRoot);
while (descendant) {
if (descendant->isText()) {
- if (localMultiplier != descendant->style()->textAutosizingMultiplier()) {
+ if (localMultiplier != 1 && descendant->style()->textAutosizingMultiplier() == 1) {
setMultiplier(descendant, localMultiplier);
setMultiplier(descendant->parent(), localMultiplier); // Parent does line spacing.
}
Modified: branches/chromium/1410/Source/WebCore/rendering/TextAutosizer.h (143933 => 143934)
--- branches/chromium/1410/Source/WebCore/rendering/TextAutosizer.h 2013-02-25 16:59:20 UTC (rev 143933)
+++ branches/chromium/1410/Source/WebCore/rendering/TextAutosizer.h 2013-02-25 17:05:25 UTC (rev 143934)
@@ -50,6 +50,7 @@
virtual ~TextAutosizer();
bool processSubtree(RenderObject* layoutRoot);
+ void recalculateMultipliers();
static float computeAutosizedFontSize(float specifiedSize, float multiplier);