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

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

Issue 23533013: Have RenderView's enclosingSeamlessRenderer() take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 #ifndef NDEBUG 130 #ifndef NDEBUG
131 void RenderView::checkLayoutState(const LayoutState& state) 131 void RenderView::checkLayoutState(const LayoutState& state)
132 { 132 {
133 ASSERT(layoutDeltaMatches(LayoutSize())); 133 ASSERT(layoutDeltaMatches(LayoutSize()));
134 ASSERT(!m_layoutStateDisableCount); 134 ASSERT(!m_layoutStateDisableCount);
135 ASSERT(m_layoutState == &state); 135 ASSERT(m_layoutState == &state);
136 } 136 }
137 #endif 137 #endif
138 138
139 static RenderBox* enclosingSeamlessRenderer(Document* doc) 139 static RenderBox* enclosingSeamlessRenderer(const Document& doc)
140 { 140 {
141 if (!doc) 141 Element* ownerElement = doc.seamlessParentIFrame();
142 return 0;
143 Element* ownerElement = doc->seamlessParentIFrame();
144 if (!ownerElement) 142 if (!ownerElement)
145 return 0; 143 return 0;
146 return ownerElement->renderBox(); 144 return ownerElement->renderBox();
147 } 145 }
148 146
149 void RenderView::addChild(RenderObject* newChild, RenderObject* beforeChild) 147 void RenderView::addChild(RenderObject* newChild, RenderObject* beforeChild)
150 { 148 {
151 // Seamless iframes are considered part of an enclosing render flow thread f rom the parent document. This is necessary for them to look 149 // Seamless iframes are considered part of an enclosing render flow thread f rom the parent document. This is necessary for them to look
152 // up regions in the parent document during layout. 150 // up regions in the parent document during layout.
153 if (newChild && !newChild->isRenderFlowThread()) { 151 if (newChild && !newChild->isRenderFlowThread()) {
154 RenderBox* seamlessBox = enclosingSeamlessRenderer(&document()); 152 RenderBox* seamlessBox = enclosingSeamlessRenderer(document());
155 if (seamlessBox && seamlessBox->flowThreadContainingBlock()) 153 if (seamlessBox && seamlessBox->flowThreadContainingBlock())
156 newChild->setFlowThreadState(seamlessBox->flowThreadState()); 154 newChild->setFlowThreadState(seamlessBox->flowThreadState());
157 } 155 }
158 RenderBlock::addChild(newChild, beforeChild); 156 RenderBlock::addChild(newChild, beforeChild);
159 } 157 }
160 158
161 bool RenderView::initializeLayoutState(LayoutState& state) 159 bool RenderView::initializeLayoutState(LayoutState& state)
162 { 160 {
163 bool isSeamlessAncestorInFlowThread = false; 161 bool isSeamlessAncestorInFlowThread = false;
164 162
165 // FIXME: May be better to push a clip and avoid issuing offscreen repaints. 163 // FIXME: May be better to push a clip and avoid issuing offscreen repaints.
166 state.m_clipped = false; 164 state.m_clipped = false;
167 165
168 // Check the writing mode of the seamless ancestor. It has to match our docu ment's writing mode, or we won't inherit any 166 // Check the writing mode of the seamless ancestor. It has to match our docu ment's writing mode, or we won't inherit any
169 // pagination information. 167 // pagination information.
170 RenderBox* seamlessAncestor = enclosingSeamlessRenderer(&document()); 168 RenderBox* seamlessAncestor = enclosingSeamlessRenderer(document());
171 LayoutState* seamlessLayoutState = seamlessAncestor ? seamlessAncestor->view ()->layoutState() : 0; 169 LayoutState* seamlessLayoutState = seamlessAncestor ? seamlessAncestor->view ()->layoutState() : 0;
172 bool shouldInheritPagination = seamlessLayoutState && !m_pageLogicalHeight & & seamlessAncestor->style()->writingMode() == style()->writingMode(); 170 bool shouldInheritPagination = seamlessLayoutState && !m_pageLogicalHeight & & seamlessAncestor->style()->writingMode() == style()->writingMode();
173 171
174 state.m_pageLogicalHeight = shouldInheritPagination ? seamlessLayoutState->m _pageLogicalHeight : m_pageLogicalHeight; 172 state.m_pageLogicalHeight = shouldInheritPagination ? seamlessLayoutState->m _pageLogicalHeight : m_pageLogicalHeight;
175 state.m_pageLogicalHeightChanged = shouldInheritPagination ? seamlessLayoutS tate->m_pageLogicalHeightChanged : m_pageLogicalHeightChanged; 173 state.m_pageLogicalHeightChanged = shouldInheritPagination ? seamlessLayoutS tate->m_pageLogicalHeightChanged : m_pageLogicalHeightChanged;
176 state.m_isPaginated = state.m_pageLogicalHeight; 174 state.m_isPaginated = state.m_pageLogicalHeight;
177 if (state.m_isPaginated && shouldInheritPagination) { 175 if (state.m_isPaginated && shouldInheritPagination) {
178 // Set up the correct pagination offset. We can use a negative offset in order to push the top of the RenderView into its correct place 176 // Set up the correct pagination offset. We can use a negative offset in order to push the top of the RenderView into its correct place
179 // on a page. We can take the iframe's offset from the logical top of th e first page and make the negative into the pagination offset within the child 177 // on a page. We can take the iframe's offset from the logical top of th e first page and make the negative into the pagination offset within the child
180 // view. 178 // view.
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 #endif 1149 #endif
1152 1150
1153 if (layoutState) 1151 if (layoutState)
1154 layoutState->m_isPaginated = m_fragmenting; 1152 layoutState->m_isPaginated = m_fragmenting;
1155 1153
1156 if (m_flowThreadState != RenderObject::NotInsideFlowThread) 1154 if (m_flowThreadState != RenderObject::NotInsideFlowThread)
1157 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState); 1155 m_root->setFlowThreadStateIncludingDescendants(m_flowThreadState);
1158 } 1156 }
1159 1157
1160 } // namespace WebCore 1158 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698