Source/WebCore/ChangeLog

 12013-01-08 Mike West <mkwst@chromium.org>
 2
 3 <iframe seamless> using display: inline or float, (shrink-wrapping) are too tall
 4 https://bugs.webkit.org/show_bug.cgi?id=87707
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Seamless documents currently render incorrectly when their content fills
 9 the width of the container into which they're placed. Because FrameView
 10 assumes that the container's size is properly set before the first pass
 11 of layout, vertical scrollbars are incorrectly forced onto seamless
 12 content, because seamless sets the container's height to 0 before
 13 handing it off to FrameView for layout. The scrollbars make the
 14 available width for the seamless document ~15px smaller than it should
 15 be, resulting in content getting bumped to the next line.
 16
 17 The relevant distinction between scrollbar negotiation in RenderBlock
 18 and FrameView/ScrollView is that RenderBlock waits until after the first
 19 pass of layout before applying scrollbars to the content. This patch
 20 special-cases ScrollView::updateScrollbars to do more or less the same,
 21 avoiding the forced scrollbars on the first pass of layout when the
 22 document being rendered is a) seamless, and b) has a full visible height
 23 of 0.
 24
 25 The change should be covered by rebaselines for the newly-passing
 26 results in fast/frame/seamless-{float,inline}.html
 27
 28 * page/FrameView.cpp:
 29 (WebCore::FrameView::layout):
 30 If we're rendering a seamless document, don't force vertical
 31 scrollbars on the initial layout.
 32 (WebCore::FrameView::isSeamlessDocument):
 33 (WebCore):
 34 * page/FrameView.h:
 35 (FrameView):
 36 Overrides ScrollView's new isSeamlessDocument method to expose the
 37 frame's document's seamless state.
 38 * platform/ScrollView.cpp:
 39 (WebCore::ScrollView::updateScrollbars):
 40 If we're rendering a seamless document, and the full visible height
 41 is 0, then don't force a vertical scrollbar.
 42 (WebCore::ScrollView::setContentsSize):
 43 If we're rendering a seamless document, and the full visible height
 44 is 0, then don't call out to update scrollbars.
 45 * platform/ScrollView.h:
 46 (ScrollView):
 47 (WebCore::ScrollView::isSeamlessDocument):
 48 A new method, overridden by FrameView in order to allow us to make
 49 reasonable decisions in ScrollView::updateScrollbars.
 50
1512013-01-08 Chris Fleizach <cfleizach@apple.com>
252
353 AX: native popup buttons should not use textUnderElement for their title

Source/WebCore/page/FrameView.cpp

@@void FrameView::setContentsSize(const IntSize& size)
556556
557557 ScrollView::setContentsSize(size);
558558 ScrollView::contentsResized();
559 
 559
560560 Page* page = frame() ? frame()->page() : 0;
561561 if (!page)
562562 return;

@@void FrameView::layout(bool allowSubtree)
11651165 m_lastZoomFactor = root->style()->zoom();
11661166
11671167 // Set the initial vMode to AlwaysOn if we're auto.
1168  if (vMode == ScrollbarAuto)
 1168 if (vMode == ScrollbarAuto && !isSeamlessDocument())
11691169 setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
11701170 // Set the initial hMode to AlwaysOff if we're auto.
11711171 if (hMode == ScrollbarAuto)
11721172 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear.
1173 
11741173 setScrollbarModes(hMode, vMode);
11751174 setScrollbarsSuppressed(false, true);
11761175 } else

@@bool FrameView::isFlippedDocument() const
38113810 return root->style()->isFlippedBlocksWritingMode();
38123811}
38133812
 3813bool FrameView::isSeamlessDocument() const
 3814{
 3815 if (frame() && frame()->document())
 3816 return frame()->document()->shouldDisplaySeamlesslyWithParent();
 3817 return false;
 3818}
 3819
38143820void FrameView::notifyWidgetsInAllFrames(WidgetNotification notification)
38153821{
38163822 for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext(m_frame.get())) {

Source/WebCore/page/FrameView.h

@@protected:
387387
388388 virtual bool isVerticalDocument() const;
389389 virtual bool isFlippedDocument() const;
 390 virtual bool isSeamlessDocument() const;
390391
391392private:
392393 explicit FrameView(Frame*);

Source/WebCore/platform/ScrollView.cpp

@@void ScrollView::setContentsSize(const IntSize& newSize)
302302 if (contentsSize() == newSize)
303303 return;
304304 m_contentsSize = newSize;
 305
 306 // Seamless documents begin with a heights of 0; we special case that here in order to
 307 // correctly render documents that don't actually need scrollbars.
 308 IntSize fullVisibleSize = visibleContentRect(true /*includeScrollbars*/).size();
 309 if (isSeamlessDocument() && !fullVisibleSize.height())
 310 return;
 311
305312 if (platformWidget())
306313 platformSetContentsSize();
307314 else

@@void ScrollView::updateScrollbars(const IntSize& desiredOffset)
511518 newHasVerticalScrollbar = docSize.height() > visibleHeight();
512519 if (newHasVerticalScrollbar && !m_updateScrollbarsPass && docSize.width() <= fullVisibleSize.width() && docSize.height() <= fullVisibleSize.height())
513520 newHasVerticalScrollbar = false;
 521 // Seamless documents begin with a heights of 0; we special case that here in order to
 522 // correctly render documents that don't actually need scrollbars.
 523 if (newHasVerticalScrollbar && isSeamlessDocument() && !fullVisibleSize.height())
 524 newHasVerticalScrollbar = false;
514525 }
515526
516527 // If we ever turn one scrollbar off, always turn the other one off too. Never ever

Source/WebCore/platform/ScrollView.h

@@protected:
313313 virtual bool isVerticalDocument() const { return true; }
314314 virtual bool isFlippedDocument() const { return false; }
315315
 316 // Subclassed by FrameView to check the seamlessness of the document.
 317 virtual bool isSeamlessDocument() const { return false; }
 318
316319 // Called to update the scrollbars to accurately reflect the state of the view.
317320 void updateScrollbars(const IntSize& desiredOffset);
318321

LayoutTests/ChangeLog

 12013-01-08 Mike West <mkwst@chromium.org>
 2
 3 <iframe seamless> using display: inline or float, (shrink-wrapping) are too tall
 4 https://bugs.webkit.org/show_bug.cgi?id=87707
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * fast/frames/seamless/seamless-float-expected.txt:
 9 * fast/frames/seamless/seamless-inline-expected.txt:
 10 Rebaseline the now-passing bits of these tests.
 11
1122013-01-08 Ryosuke Niwa <rniwa@webkit.org>
213
314 Add a crashing test expectation to a test added in r139029.

LayoutTests/fast/frames/seamless/seamless-float-expected.txt

11Test that floated seamless iframes 'shrink-wrap' their contents, as floated divs would.
22PASS window.getComputedStyle(iframe1).width is "150px"
3 FAIL window.getComputedStyle(iframe1).height should be 50px. Was 100px.
 3PASS window.getComputedStyle(iframe1).height is "50px"
44PASS window.getComputedStyle(iframe2).width is "100px"
55PASS window.getComputedStyle(iframe2).height is "100px"
66

LayoutTests/fast/frames/seamless/seamless-inline-expected.txt

@@Test that inline seamless iframes 'shrink-wrap' their contents like inline-block
22PASS window.getComputedStyle(iframe1).display is "inline-block"
33PASS window.getComputedStyle(iframe2).display is "inline-block"
44PASS window.getComputedStyle(iframe1).width is "150px"
5 FAIL window.getComputedStyle(iframe1).height should be 50px. Was 100px.
6 FAIL window.getComputedStyle(parent1).height should be 50px. Was 100px.
 5PASS window.getComputedStyle(iframe1).height is "50px"
 6PASS window.getComputedStyle(parent1).height is "50px"
77PASS window.getComputedStyle(iframe2).width is "100px"
88PASS window.getComputedStyle(iframe2).height is "100px"
99PASS window.getComputedStyle(parent2).height is "150px"