Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: Source/core/rendering/RenderIFrame.cpp

Issue 138443013: Remove iframe@seamless (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Include remove tests Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 26 matching lines...) Expand all
37 37
38 using namespace HTMLNames; 38 using namespace HTMLNames;
39 39
40 RenderIFrame::RenderIFrame(Element* element) 40 RenderIFrame::RenderIFrame(Element* element)
41 : RenderPart(element) 41 : RenderPart(element)
42 { 42 {
43 } 43 }
44 44
45 bool RenderIFrame::shouldComputeSizeAsReplaced() const 45 bool RenderIFrame::shouldComputeSizeAsReplaced() const
46 { 46 {
47 // When we're seamless, we use normal block/box sizing code except when inli ne. 47 return true;
48 return !isSeamless();
49 } 48 }
50 49
51 bool RenderIFrame::isInlineBlockOrInlineTable() const 50 bool RenderIFrame::isInlineBlockOrInlineTable() const
52 { 51 {
53 return isSeamless() && isInline(); 52 return isInline();
54 }
55
56 LayoutUnit RenderIFrame::minPreferredLogicalWidth() const
57 {
58 if (!isSeamless())
59 return RenderPart::minPreferredLogicalWidth();
60
61 RenderView* childRoot = contentRootRenderer();
62 if (!childRoot)
63 return 0;
64
65 return childRoot->minPreferredLogicalWidth() + borderAndPaddingLogicalWidth( );
66 }
67
68 LayoutUnit RenderIFrame::maxPreferredLogicalWidth() const
69 {
70 if (!isSeamless())
71 return RenderPart::maxPreferredLogicalWidth();
72
73 RenderView* childRoot = contentRootRenderer();
74 if (!childRoot)
75 return 0;
76
77 return childRoot->maxPreferredLogicalWidth() + borderAndPaddingLogicalWidth( );
78 }
79
80 bool RenderIFrame::isSeamless() const
81 {
82 return node() && node()->hasTagName(iframeTag) && toHTMLIFrameElement(node() )->shouldDisplaySeamlessly();
83 } 53 }
84 54
85 LayerType RenderIFrame::layerTypeRequired() const 55 LayerType RenderIFrame::layerTypeRequired() const
86 { 56 {
87 LayerType type = RenderPart::layerTypeRequired(); 57 LayerType type = RenderPart::layerTypeRequired();
88 if (type != NoLayer) 58 if (type != NoLayer)
89 return type; 59 return type;
90 60
91 if (style()->resize() != RESIZE_NONE) 61 if (style()->resize() != RESIZE_NONE)
92 return NormalLayer; 62 return NormalLayer;
93 63
94 return NoLayer; 64 return NoLayer;
95 } 65 }
96 66
97 RenderView* RenderIFrame::contentRootRenderer() const 67 RenderView* RenderIFrame::contentRootRenderer() const
98 { 68 {
99 // FIXME: Is this always a valid cast? What about plugins? 69 // FIXME: Is this always a valid cast? What about plugins?
100 ASSERT(!widget() || widget()->isFrameView()); 70 ASSERT(!widget() || widget()->isFrameView());
101 FrameView* childFrameView = toFrameView(widget()); 71 FrameView* childFrameView = toFrameView(widget());
102 return childFrameView ? childFrameView->frame().contentRenderer() : 0; 72 return childFrameView ? childFrameView->frame().contentRenderer() : 0;
103 } 73 }
104 74
105 void RenderIFrame::layoutSeamlessly()
106 {
107 updateLogicalWidth();
108 // FIXME: Containers set their height to 0 before laying out their kids (as we're doing here)
109 // however, this causes FrameView::layout() to add vertical scrollbars, inco rrectly inflating
110 // the resulting contentHeight(). We'll need to make FrameView::layout() sma rter.
111 setLogicalHeight(0);
112 updateWidgetPosition(); // Tell the Widget about our new width/height (it wi ll also layout the child document).
113
114 // Laying out our kids is normally responsible for adjusting our height, so we set it here.
115 // Replaced elements normally do not respect padding, but seamless elements should: we'll add
116 // both padding and border to the child's logical height here.
117 FrameView* childFrameView = toFrameView(widget());
118 if (childFrameView) // Widget should never be null during layout(), but just in case.
119 setLogicalHeight(childFrameView->contentsHeight() + borderTop() + border Bottom() + paddingTop() + paddingBottom());
120 updateLogicalHeight();
121
122 updateWidgetPosition(); // Notify the Widget of our final height.
123
124 // Assert that the child document did a complete layout.
125 RenderView* childRoot = childFrameView ? childFrameView->frame().contentRend erer() : 0;
126 ASSERT(!childFrameView || !childFrameView->layoutPending());
127 ASSERT_UNUSED(childRoot, !childRoot || !childRoot->needsLayout());
128 }
129
130 void RenderIFrame::layout() 75 void RenderIFrame::layout()
131 { 76 {
132 ASSERT(needsLayout()); 77 ASSERT(needsLayout());
133 78
134 LayoutRectRecorder recorder(*this); 79 LayoutRectRecorder recorder(*this);
135 if (isSeamless()) { 80 updateLogicalWidth();
136 layoutSeamlessly(); 81 // No kids to layout as a replaced element.
137 // Do not return so as to share the layer and overflow updates below. 82 updateLogicalHeight();
138 } else {
139 updateLogicalWidth();
140 // No kids to layout as a replaced element.
141 updateLogicalHeight();
142 }
143 83
144 m_overflow.clear(); 84 m_overflow.clear();
145 addVisualEffectOverflow(); 85 addVisualEffectOverflow();
146 updateLayerTransform(); 86 updateLayerTransform();
147 87
148 clearNeedsLayout(); 88 clearNeedsLayout();
149 } 89 }
150 90
151 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698