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

Side by Side Diff: sky/engine/core/rendering/RenderBlockFlow.cpp

Issue 944073006: Remove the concept of staticly positioned absolutes. (Closed) Base URL: git@github.com:domokit/mojo.git@position
Patch Set: Created 5 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 RenderBox* lastNormalFlowChild = 0; 137 RenderBox* lastNormalFlowChild = 0;
138 138
139 while (next) { 139 while (next) {
140 RenderBox* child = next; 140 RenderBox* child = next;
141 next = child->nextSiblingBox(); 141 next = child->nextSiblingBox();
142 142
143 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child); 143 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child);
144 144
145 if (child->isOutOfFlowPositioned()) { 145 if (child->isOutOfFlowPositioned()) {
146 child->containingBlock()->insertPositionedObject(child); 146 child->containingBlock()->insertPositionedObject(child);
147 adjustPositionedBlock(child);
148 continue; 147 continue;
149 } 148 }
150 149
151 // Lay out the child. 150 // Lay out the child.
152 layoutBlockChild(child); 151 layoutBlockChild(child);
153 lastNormalFlowChild = child; 152 lastNormalFlowChild = child;
154 } 153 }
155 154
156 // Negative margins can cause our height to shrink below our minimal height (border/padding). 155 // Negative margins can cause our height to shrink below our minimal height (border/padding).
157 // If this happens, ensure that the computed height is increased to the mini mal height. 156 // If this happens, ensure that the computed height is increased to the mini mal height.
158 setLogicalHeight(std::max(logicalHeight() + afterEdge, beforeEdge + afterEdg e)); 157 setLogicalHeight(std::max(logicalHeight() + afterEdge, beforeEdge + afterEdg e));
159 } 158 }
160 159
161 void RenderBlockFlow::adjustPositionedBlock(RenderBox* child)
162 {
163 bool hasStaticBlockPosition = child->style()->hasStaticBlockPosition();
164
165 LayoutUnit logicalTop = logicalHeight();
166 updateStaticInlinePositionForChild(child);
167
168 RenderLayer* childLayer = child->layer();
169 if (childLayer->staticBlockPosition() != logicalTop) {
170 childLayer->setStaticBlockPosition(logicalTop);
171 if (hasStaticBlockPosition)
172 child->setChildNeedsLayout(MarkOnlyThis);
173 }
174 }
175
176 RootInlineBox* RenderBlockFlow::createAndAppendRootInlineBox() 160 RootInlineBox* RenderBlockFlow::createAndAppendRootInlineBox()
177 { 161 {
178 RootInlineBox* rootBox = createRootInlineBox(); 162 RootInlineBox* rootBox = createRootInlineBox();
179 m_lineBoxes.appendLineBox(rootBox); 163 m_lineBoxes.appendLineBox(rootBox);
180 164
181 return rootBox; 165 return rootBox;
182 } 166 }
183 167
184 void RenderBlockFlow::deleteLineBoxTree() 168 void RenderBlockFlow::deleteLineBoxTree()
185 { 169 {
186 m_lineBoxes.deleteLineBoxTree(); 170 m_lineBoxes.deleteLineBoxTree();
187 } 171 }
188 172
189 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child)
190 {
191 if (child->style()->isOriginalDisplayInlineType())
192 setStaticInlinePositionForChild(child, startAlignedOffsetForLine(false)) ;
193 else
194 setStaticInlinePositionForChild(child, startOffsetForContent());
195 }
196
197 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox* child, LayoutUn it inlinePosition)
198 {
199 child->layer()->setStaticInlinePosition(inlinePosition);
200 }
201
202 void RenderBlockFlow::addChild(RenderObject* newChild, RenderObject* beforeChild ) 173 void RenderBlockFlow::addChild(RenderObject* newChild, RenderObject* beforeChild )
203 { 174 {
204 RenderBlock::addChild(newChild, beforeChild); 175 RenderBlock::addChild(newChild, beforeChild);
205 } 176 }
206 177
207 LayoutUnit RenderBlockFlow::logicalLeftSelectionOffset(RenderBlock* rootBlock, L ayoutUnit position) 178 LayoutUnit RenderBlockFlow::logicalLeftSelectionOffset(RenderBlock* rootBlock, L ayoutUnit position)
208 { 179 {
209 LayoutUnit logicalLeft = logicalLeftOffsetForLine(false); 180 LayoutUnit logicalLeft = logicalLeftOffsetForLine(false);
210 if (logicalLeft == logicalLeftOffsetForContent()) 181 if (logicalLeft == logicalLeftOffsetForContent())
211 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position); 182 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 float logicalLeft = logicalLeftOffsetForLine(false).toFloat(); 319 float logicalLeft = logicalLeftOffsetForLine(false).toFloat();
349 float availableLogicalWidth = logicalRightOffsetForLine(false) - logicalLeft ; 320 float availableLogicalWidth = logicalRightOffsetForLine(false) - logicalLeft ;
350 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 321 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
351 322
352 if (!style()->isLeftToRightDirection()) 323 if (!style()->isLeftToRightDirection())
353 return logicalWidth() - logicalLeft; 324 return logicalWidth() - logicalLeft;
354 return logicalLeft; 325 return logicalLeft;
355 } 326 }
356 327
357 } // namespace blink 328 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698