Changeset 143356 in webkit
- Timestamp:
- Feb 19, 2013 10:57:31 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r143352 r143356 1 2013-02-19 Tim Volodine <timvolodine@chromium.org> 2 3 Text Autosizing: prevent oscillation of font sizes during autosizing 4 https://bugs.webkit.org/show_bug.cgi?id=108205 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Added overflow-y:hidden to some existing tests, since previously those tests 9 would start off with incorrect multipliers (because mainFrame->view()-layoutSize() 10 is initially 785 instead of 800 as ScrollView wrongly guesses a scrollbar will 11 be needed), and then the multipliers would get corrected on a subsequent layout. 12 Now that we don't allow the multiplier to change after being set, it needs to be 13 right first time. 14 Also added specific oscillation test triggered by javascript. 15 16 * fast/text-autosizing/constrained-height-body-expected.html: 17 * fast/text-autosizing/constrained-height-body.html: 18 * fast/text-autosizing/constrained-then-float-ancestors-expected.html: 19 * fast/text-autosizing/constrained-then-float-ancestors.html: 20 * fast/text-autosizing/constrained-then-position-fixed-ancestors-expected.html: 21 * fast/text-autosizing/constrained-then-position-fixed-ancestors.html: 22 * fast/text-autosizing/nested-em-line-height-expected.html: 23 * fast/text-autosizing/nested-em-line-height.html: 24 * fast/text-autosizing/oscillation-javascript-fontsize-change-expected.html: Added. 25 * fast/text-autosizing/oscillation-javascript-fontsize-change.html: Added. 26 * fast/text-autosizing/simple-paragraph-expected.html: 27 * fast/text-autosizing/simple-paragraph.html: 28 * fast/text-autosizing/span-child-expected.html: 29 * fast/text-autosizing/span-child.html: 30 * fast/text-autosizing/unwrappable-blocks-expected.html: 31 * fast/text-autosizing/unwrappable-blocks.html: 32 * fast/text-autosizing/unwrappable-inlines-expected.html: 33 * fast/text-autosizing/unwrappable-inlines.html: 34 1 35 2013-02-19 Youenn Fablet <youennf@gmail.com> 2 36 -
trunk/LayoutTests/fast/text-autosizing/constrained-height-body-expected.html
r129195 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 </style> 10 10 -
trunk/LayoutTests/fast/text-autosizing/constrained-height-body.html
r129195 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 </style> 10 10 -
trunk/LayoutTests/fast/text-autosizing/constrained-then-float-ancestors-expected.html
r129195 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 </style> 10 10 -
trunk/LayoutTests/fast/text-autosizing/constrained-then-float-ancestors.html
r129195 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 </style> 10 10 -
trunk/LayoutTests/fast/text-autosizing/constrained-then-position-fixed-ancestors-expected.html
r129195 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 </style> 10 10 -
trunk/LayoutTests/fast/text-autosizing/constrained-then-position-fixed-ancestors.html
r129195 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 </style> 10 10 -
trunk/LayoutTests/fast/text-autosizing/nested-em-line-height-expected.html
r128500 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 </style> 10 10 -
trunk/LayoutTests/fast/text-autosizing/nested-em-line-height.html
r128500 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 </style> 10 10 -
trunk/LayoutTests/fast/text-autosizing/simple-paragraph-expected.html
r128500 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 </style> 10 10 -
trunk/LayoutTests/fast/text-autosizing/simple-paragraph.html
r128500 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 </style> 10 10 -
trunk/LayoutTests/fast/text-autosizing/span-child-expected.html
r128500 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 </style> 10 10 -
trunk/LayoutTests/fast/text-autosizing/span-child.html
r128500 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 </style> 10 10 -
trunk/LayoutTests/fast/text-autosizing/unwrappable-blocks-expected.html
r137738 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 pre { margin: 0; } 10 10 </style> -
trunk/LayoutTests/fast/text-autosizing/unwrappable-blocks.html
r137738 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 pre { margin: 0; } 10 10 </style> -
trunk/LayoutTests/fast/text-autosizing/unwrappable-inlines-expected.html
r137738 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 pre { margin: 0; } 10 10 </style> -
trunk/LayoutTests/fast/text-autosizing/unwrappable-inlines.html
r137738 r143356 6 6 <style> 7 7 html { font-size: 16px; } 8 body { width: 800px; margin: 0; }8 body { width: 800px; margin: 0; overflow-y: hidden; } 9 9 pre { margin: 0; } 10 10 </style> -
trunk/Source/WebCore/ChangeLog
r143352 r143356 1 2013-02-19 Tim Volodine <timvolodine@chromium.org> 2 3 Text Autosizing: prevent oscillation of font sizes during autosizing 4 https://bugs.webkit.org/show_bug.cgi?id=108205 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 On some websites autosized font-sizes oscillate due to layouts caused by 9 hovering or incremental page loading (and on other sites font sizes do 10 eventually stabilize, but it takes many layouts before they reach a steady 11 size). To prevent all these cases, we no longer allow the autosizing 12 multiplier to change after it has been set (to a value other than 1). 13 14 This won't always give exactly the same results, but testing on 2000 top 15 sites shows that this makes little difference in practice, and it prevents 16 these very jarring cases. As a happy side-effect, this speeds up layouts 17 as font sizes change less. 18 19 Test: fast/text-autosizing/oscillation-javascript-fontsize-change.html 20 21 * page/FrameView.cpp: 22 (WebCore::FrameView::setFrameRect): 23 * page/Settings.cpp: 24 (WebCore::Settings::setTextAutosizingFontScaleFactor): 25 * rendering/TextAutosizer.cpp: 26 (WebCore::TextAutosizer::recalculateMultipliers): 27 (WebCore): 28 (WebCore::TextAutosizer::processContainer): 29 * rendering/TextAutosizer.h: 30 (TextAutosizer): 31 1 32 2013-02-19 Youenn Fablet <youennf@gmail.com> 2 33 -
trunk/Source/WebCore/page/FrameView.cpp
r143295 r143356 445 445 return; 446 446 447 #if ENABLE(TEXT_AUTOSIZING) 448 // Autosized font sizes depend on the width of the viewing area. 449 if (newRect.width() != oldRect.width()) { 450 Page* page = m_frame ? m_frame->page() : 0; 451 if (page && page->mainFrame() == m_frame && page->settings()->textAutosizingEnabled()) { 452 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) 453 m_frame->document()->textAutosizer()->recalculateMultipliers(); 454 } 455 } 456 #endif 457 447 458 ScrollView::setFrameRect(newRect); 448 459 -
trunk/Source/WebCore/page/Settings.cpp
r142654 r143356 43 43 #include "ResourceHandle.h" 44 44 #include "StorageMap.h" 45 #include "TextAutosizer.h" 45 46 #include <limits> 46 47 … … 365 366 { 366 367 m_textAutosizingFontScaleFactor = fontScaleFactor; 368 369 // FIXME: I wonder if this needs to traverse frames like in WebViewImpl::resize, or whether there is only one document per Settings instance? 370 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) 371 frame->document()->textAutosizer()->recalculateMultipliers(); 372 367 373 m_page->setNeedsRecalcStyleInAllFrames(); 368 374 } -
trunk/Source/WebCore/rendering/TextAutosizer.cpp
r143318 r143356 92 92 } 93 93 94 void TextAutosizer::recalculateMultipliers() 95 { 96 RenderObject* renderer = m_document->renderer(); 97 while (renderer) { 98 if (renderer->style() && renderer->style()->textAutosizingMultiplier() != 1) 99 setMultiplier(renderer, 1); 100 renderer = renderer->nextInPreOrder(); 101 } 102 } 103 94 104 bool TextAutosizer::processSubtree(RenderObject* layoutRoot) 95 105 { … … 190 200 while (descendant) { 191 201 if (descendant->isText()) { 192 if (localMultiplier != descendant->style()->textAutosizingMultiplier()) {202 if (localMultiplier != 1 && descendant->style()->textAutosizingMultiplier() == 1) { 193 203 setMultiplier(descendant, localMultiplier); 194 204 setMultiplier(descendant->parent(), localMultiplier); // Parent does line spacing. -
trunk/Source/WebCore/rendering/TextAutosizer.h
r143318 r143356 51 51 52 52 bool processSubtree(RenderObject* layoutRoot); 53 void recalculateMultipliers(); 53 54 54 55 static float computeAutosizedFontSize(float specifiedSize, float multiplier);
Note: See TracChangeset
for help on using the changeset viewer.