12012-05-16 Eric Seidel <eric@webkit.org>
2
3 Add seamless layout code (and pass all the remaining seamless tests)
4 https://bugs.webkit.org/show_bug.cgi?id=86608
5
6 Reviewed by NOBODY (OOPS!).
7
8 This patch contains all the layout changes needed for seamless iframes.
9 Seamless iframes piggy-back a bit on the existing frame-flattening
10 logic, however seamless is different from frame-flattening in a few ways:
11 - Frame flattening can only ever make an iframe larger (seamless just behaves like a normal div).
12 - Frame flattening disables scrollbars (seamless frames behave like normal overflow: auto divs).
13 - Seamless only has to work with iframes (flattening works with frame/frameset as well).
14 - Seamless support shrink-wrap negotation when the iframe is inline.
15
16 This is a somewhat complicated patch and I wouldn't be surprised to go several rounds here.
17 I'm most interested in feedback regarding the tests, to make sure that I've covered all
18 the interesting cases.
19
20 Test: fast/frames/seamless/seamless-percent-height.html
21
22 * css/StyleResolver.cpp:
23 (WebCore::StyleResolver::adjustRenderStyle): map inline -> inline-block for seamless iframes.
24 * dom/Document.cpp:
25 (WebCore::Document::scheduleStyleRecalc):
26 - Seamless iframes don't manage their own style recalc.
27 (WebCore::Document::recalcStyle):
28 - Similarly, recalcStyle lets the parent manage style resolves.
29 * html/HTMLIFrameElement.idl:
30 - Expose the seamless attribute now that our implementation is complete.
31 * page/FrameView.cpp:
32 (WebCore::FrameView::scheduleRelayout): Do the cheaper check first.
33 (WebCore::FrameView::isInChildFrameWithFrameFlattening): Make frameview layout abort child layouts like how frame flattening does.
34 * rendering/RenderBox.h:
35 (WebCore::RenderBox::stretchesToViewport): Disable the stretch-to-viewport quirk for seamless iframes (it makes no sense and breaks the layout code).
36 * rendering/RenderIFrame.cpp:
37 (WebCore::RenderIFrame::computeLogicalHeight):
38 - This function is needed for the child document to participate in the normal block shrink-wrap algorithm.
39 Thankfully all the shrink-wrap logic is in RenderBox instead of RenderBlock. In the future we may make
40 RenderIframe a RenderBlock for the seamless case. We may just split RenderIframe into two renderers.
41 (WebCore::RenderIFrame::computeLogicalWidth):
42 (WebCore::RenderIFrame::shouldComputeSizeAsReplaced):
43 - seamless iframes behave like blocks, not inline replaced elements.
44 (WebCore):
45 (WebCore::RenderIFrame::isInlineBlockOrInlineTable):
46 - Behave like an inline-block when marked inline.
47 (WebCore::RenderIFrame::minPreferredLogicalWidth):
48 - When asked for our pref widths, return those of our child document.
49 (WebCore::RenderIFrame::maxPreferredLogicalWidth):
50 (WebCore::RenderIFrame::isSeamless): helper function
51 (WebCore::RenderIFrame::contentRootRenderer): helper function
52 (WebCore::RenderIFrame::flattenFrame): seamless iframes never use the frame-flattening feature.
53 (WebCore::RenderIFrame::layout):
54 * rendering/RenderIFrame.h:
55 (WebCore):
56 (RenderIFrame):
57