Changeset 126058 in webkit
- Timestamp:
- Aug 20, 2012 1:23:31 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r126054 r126058 1 2012-08-20 John Mellor <johnme@chromium.org> 2 3 Text Autosizing: Only take into account block width <= document layout width. 4 https://bugs.webkit.org/show_bug.cgi?id=93862 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Added 4 tests: a block wider than the main frame, iframes both narrower 9 than and wider than the main frame, both also containing wide blocks, 10 and a narrow iframe expanded by frame flattening. 11 12 I verified experimentally that narrow-iframe-flattened.html passes, by 13 enabling frame flattening in Settings.cpp, but unfortunately it won't 14 get run by any bots since the only platform which currently enables 15 Text Autosizing (Chromium), doesn't enable frame flattening (or have 16 the DRT methods required to test it). 17 18 * fast/text-autosizing/font-scale-factor-expected.html: 19 * fast/text-autosizing/font-scale-factor.html: 20 * fast/text-autosizing/narrow-iframe-expected.html: Added. 21 * fast/text-autosizing/narrow-iframe-flattened-expected.html: Added. 22 * fast/text-autosizing/narrow-iframe-flattened.html: Added. 23 * fast/text-autosizing/narrow-iframe.html: Added. 24 * fast/text-autosizing/wide-block-expected.html: Added. 25 * fast/text-autosizing/wide-block.html: Added. 26 * fast/text-autosizing/wide-iframe-expected.html: Added. 27 * fast/text-autosizing/wide-iframe.html: Added. 28 * platform/chromium/TestExpectations: 29 * platform/win/Skipped: 30 * platform/wincairo/Skipped: 31 1 32 2012-08-20 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> 2 33 -
trunk/LayoutTests/fast/text-autosizing/font-scale-factor-expected.html
r125925 r126058 7 7 width: 800px; 8 8 margin: 0px; 9 overflow: hidden; 9 10 } 10 11 </style> -
trunk/LayoutTests/fast/text-autosizing/font-scale-factor.html
r125925 r126058 7 7 width: 800px; 8 8 margin: 0px; 9 overflow: hidden; /* Vertical scrollbar makes it harder to write expected.html */ 9 10 } 10 11 </style> -
trunk/LayoutTests/platform/chromium/TestExpectations
r126051 r126058 765 765 // Tests for frameset flattening. Relevant only on mobile browsers. 766 766 WONTFIX SKIP : fast/frames/flattening = TIMEOUT 767 WONTFIX SKIP : fast/text-autosizing/narrow-iframe-flattened.html = IMAGE 767 768 WONTFIX SKIP : http/tests/misc/iframe-flattening-3level-nesting-with-blocking-resource.html = TIMEOUT 768 769 -
trunk/LayoutTests/platform/win/Skipped
r125794 r126058 960 960 # https://bugs.webkit.org/show_bug.cgi?id=32717 961 961 fast/frames/flattening/ 962 fast/text-autosizing/narrow-iframe-flattened.html 962 963 963 964 # https://bugs.webkit.org/show_bug.cgi?id=34933 -
trunk/LayoutTests/platform/wincairo/Skipped
r125794 r126058 1477 1477 # https://bugs.webkit.org/show_bug.cgi?id=32717 1478 1478 fast/frames/flattening/ 1479 fast/text-autosizing/narrow-iframe-flattened.html 1479 1480 1480 1481 # https://bugs.webkit.org/show_bug.cgi?id=34933 -
trunk/Source/WebCore/ChangeLog
r126057 r126058 1 2012-08-20 John Mellor <johnme@chromium.org> 2 3 Text Autosizing: Only take into account block width <= document layout width. 4 https://bugs.webkit.org/show_bug.cgi?id=93862 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Instead of calculating the textAutosizingMultiplier purely based on the 9 width of each block, we now work out the maximum width of the block 10 that could be displayed onscreen at any one time, and use that value. 11 This avoids excessive text size multiplication (there's no point making 12 text bigger than this, since you wouldn't be able to zoom out far 13 enough to read it!). 14 15 To determine the maximum onscreen block width, we take the minimum of 16 the block width and the layoutWidth of the narrowest non-flattened 17 ancestor frame. Flattened frames are ignored since they don't impose a 18 hard limit on the maximum width that can be displayed, instead they can 19 stretch to fit their contents. Note that on mobile the layoutWidth of 20 the main frame is the fixed layout width aka viewport width. 21 22 In practice this caps the maximum multiplier to a value that depends 23 on the metrics of the device. For example on a Nexus S (480 x 800px 24 and 1.5x devicePixelRatio) with a 980px default fixed layout width, 25 this limits the multiplier to: 980 / (480/1.5) = 3.0625 26 27 Most pages won't have blocks that actually hit this cap, or they will 28 only slightly exceed it (so their multiplier will only be slightly 29 reduced). For example it's not uncommon for desktop pages to be 30 slightly wider than 980px, but they would have to additionally have 31 text that spans the full width of the page for this to affect them, and 32 even then it would merely slightly decrease their multiplier). 33 34 This will have more dramatic effects on the rare desktop pages which 35 give a width=device-width (or similar) mobile viewport tag (on ports 36 which support viewports). A follow-up patch will hopefully address this 37 by wrapping the text in such excessively wide blocks to the layoutWidth. 38 39 Tests: fast/text-autosizing/narrow-iframe-flattened.html 40 fast/text-autosizing/narrow-iframe.html 41 fast/text-autosizing/wide-block.html 42 fast/text-autosizing/wide-iframe.html 43 44 * page/FrameView.cpp: 45 (WebCore::FrameView::isInChildFrameWithFrameFlattening): 46 47 Made public and const, so can be used from TextAutosizer. 48 49 * rendering/TextAutosizer.cpp: 50 (WebCore::TextAutosizer::processSubtree): 51 52 Computes the minimum layout width of the parent frames, as described 53 above. 54 55 (WebCore::TextAutosizer::processBlock): 56 57 Limits used block width to this min layout width. 58 1 59 2012-08-20 Hans Wennborg <hans@chromium.org> 2 60 -
trunk/Source/WebCore/page/FrameView.cpp
r125700 r126058 2933 2933 } 2934 2934 2935 bool FrameView::isInChildFrameWithFrameFlattening() 2935 bool FrameView::isInChildFrameWithFrameFlattening() const 2936 2936 { 2937 2937 if (!parent() || !m_frame->ownerElement()) -
trunk/Source/WebCore/page/FrameView.h
r125700 r126058 256 256 257 257 Color documentBackgroundColor() const; 258 259 bool isInChildFrameWithFrameFlattening() const; 258 260 259 261 static double currentPaintTimeStamp() { return sCurrentPaintTimeStamp; } // returns 0 if not painting … … 431 433 FrameView* parentFrameView() const; 432 434 433 bool isInChildFrameWithFrameFlattening();434 435 bool doLayoutWithFrameFlattening(bool allowSubtree); 435 436 -
trunk/Source/WebCore/rendering/TextAutosizer.cpp
r125925 r126058 51 51 return false; 52 52 53 Frame* mainFrame = m_document->page()->mainFrame(); 54 55 // Window area, in logical (density-independent) pixels. 53 56 IntSize windowSize = m_document->settings()->textAutosizingWindowSizeOverride(); 54 57 if (windowSize.isEmpty()) { 55 Frame* mainFrame = m_document->page()->mainFrame();56 58 bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOverride(mainFrame); 57 59 windowSize = mainFrame->view()->visibleContentRect(includeScrollbars).size(); // FIXME: Check that this is always in logical (density-independent) pixels (see wkbug.com/87440). 60 } 61 62 // Largest area of block that can be visible at once (assuming the main 63 // frame doesn't get scaled to less than overview scale), in CSS pixels. 64 IntSize minLayoutSize = mainFrame->view()->layoutSize(); 65 for (Frame* frame = m_document->frame(); frame; frame = frame->tree()->parent()) { 66 if (!frame->view()->isInChildFrameWithFrameFlattening()) 67 minLayoutSize = minLayoutSize.shrunkTo(frame->view()->layoutSize()); 58 68 } 59 69 … … 61 71 if (isNotAnAutosizingContainer(descendant)) 62 72 continue; 63 processBox(toRenderBox(descendant), windowSize );73 processBox(toRenderBox(descendant), windowSize, minLayoutSize); 64 74 } 65 75 … … 67 77 } 68 78 69 void TextAutosizer::processBox(RenderBox* box, const IntSize& windowSize )79 void TextAutosizer::processBox(RenderBox* box, const IntSize& windowSize, const IntSize& layoutSize) 70 80 { 71 int windowLogicalWidth = box->isHorizontalWritingMode() ? windowSize.width() : windowSize.height(); 72 float multiplier = static_cast<float>(box->logicalWidth()) / windowLogicalWidth; // FIXME: This is overly simplistic. 81 int logicalWindowWidth = box->isHorizontalWritingMode() ? windowSize.width() : windowSize.height(); 82 int logicalLayoutWidth = box->isHorizontalWritingMode() ? layoutSize.width() : layoutSize.height(); 83 // Ignore box width in excess of the layout width, to avoid extreme multipliers. 84 float logicalBoxWidth = std::min<float>(box->logicalWidth(), logicalLayoutWidth); 85 86 float multiplier = logicalBoxWidth / logicalWindowWidth; 73 87 multiplier *= m_document->settings()->textAutosizingFontScaleFactor(); 74 88 -
trunk/Source/WebCore/rendering/TextAutosizer.h
r125925 r126058 55 55 explicit TextAutosizer(Document*); 56 56 57 void processBox(RenderBox*, const IntSize& windowSize );57 void processBox(RenderBox*, const IntSize& windowSize, const IntSize& layoutSize); 58 58 void setMultiplier(RenderObject*, float); 59 59
Note: See TracChangeset
for help on using the changeset viewer.