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

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

Issue 689733003: Remove most of FloatingObject. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // FIXME: this should only be set from clearNeedsLayout crbug.com/361250 507 // FIXME: this should only be set from clearNeedsLayout crbug.com/361250
508 child->setLayoutDidGetCalled(true); 508 child->setLayoutDidGetCalled(true);
509 509
510 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child); 510 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child);
511 511
512 if (child->isOutOfFlowPositioned()) { 512 if (child->isOutOfFlowPositioned()) {
513 child->containingBlock()->insertPositionedObject(child); 513 child->containingBlock()->insertPositionedObject(child);
514 adjustPositionedBlock(child, marginInfo); 514 adjustPositionedBlock(child, marginInfo);
515 continue; 515 continue;
516 } 516 }
517 if (child->isFloating()) {
518 insertFloatingObject(child);
519 adjustFloatingBlock(marginInfo);
520 continue;
521 }
522 517
523 // Lay out the child. 518 // Lay out the child.
524 layoutBlockChild(child, marginInfo, previousFloatLogicalBottom); 519 layoutBlockChild(child, marginInfo, previousFloatLogicalBottom);
525 lastNormalFlowChild = child; 520 lastNormalFlowChild = child;
526 } 521 }
527 522
528 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and 523 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and
529 // determining the correct collapsed bottom margin information. 524 // determining the correct collapsed bottom margin information.
530 handleAfterSideOfBlock(lastNormalFlowChild, beforeEdge, afterEdge, marginInf o); 525 handleAfterSideOfBlock(lastNormalFlowChild, beforeEdge, afterEdge, marginInf o);
531 } 526 }
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 RootInlineBox* RenderBlockFlow::createAndAppendRootInlineBox() 1143 RootInlineBox* RenderBlockFlow::createAndAppendRootInlineBox()
1149 { 1144 {
1150 RootInlineBox* rootBox = createRootInlineBox(); 1145 RootInlineBox* rootBox = createRootInlineBox();
1151 m_lineBoxes.appendLineBox(rootBox); 1146 m_lineBoxes.appendLineBox(rootBox);
1152 1147
1153 return rootBox; 1148 return rootBox;
1154 } 1149 }
1155 1150
1156 void RenderBlockFlow::deleteLineBoxTree() 1151 void RenderBlockFlow::deleteLineBoxTree()
1157 { 1152 {
1158 if (containsFloats())
1159 m_floatingObjects->clearLineBoxTreePointers();
1160
1161 m_lineBoxes.deleteLineBoxTree(); 1153 m_lineBoxes.deleteLineBoxTree();
1162 } 1154 }
1163 1155
1164 void RenderBlockFlow::markAllDescendantsWithFloatsForLayout(RenderBox* floatToRe move, bool inLayout) 1156 void RenderBlockFlow::markAllDescendantsWithFloatsForLayout(RenderBox* floatToRe move, bool inLayout)
1165 { 1157 {
1166 // FIXME(sky): Remove this. 1158 // FIXME(sky): Remove this.
1167 } 1159 }
1168 1160
1169 void RenderBlockFlow::markSiblingsWithFloatsForLayout(RenderBox* floatToRemove) 1161 void RenderBlockFlow::markSiblingsWithFloatsForLayout(RenderBox* floatToRemove)
1170 { 1162 {
1171 // FIXME(sky): Remove this. 1163 // FIXME(sky): Remove this.
1172 } 1164 }
1173 1165
1174 LayoutUnit RenderBlockFlow::getClearDelta(RenderBox* child, LayoutUnit logicalTo p) 1166 LayoutUnit RenderBlockFlow::getClearDelta(RenderBox* child, LayoutUnit logicalTo p)
1175 { 1167 {
1176 // FIXME(sky): Remove this. 1168 // FIXME(sky): Remove this.
1177 return 0; 1169 return 0;
1178 } 1170 }
1179 1171
1180 void RenderBlockFlow::createFloatingObjects()
1181 {
1182 // FIXME(sky): Remove this.
1183 }
1184
1185 void RenderBlockFlow::styleWillChange(StyleDifference diff, const RenderStyle& n ewStyle) 1172 void RenderBlockFlow::styleWillChange(StyleDifference diff, const RenderStyle& n ewStyle)
1186 { 1173 {
1187 RenderStyle* oldStyle = style(); 1174 RenderStyle* oldStyle = style();
1188 s_canPropagateFloatIntoSibling = oldStyle ? !isFloatingOrOutOfFlowPositioned () && !avoidsFloats() : false; 1175 s_canPropagateFloatIntoSibling = oldStyle ? !isFloatingOrOutOfFlowPositioned () && !avoidsFloats() : false;
1189 if (oldStyle && parent() && diff.needsFullLayout() && oldStyle->position() ! = newStyle.position() 1176 if (oldStyle && parent() && diff.needsFullLayout() && oldStyle->position() ! = newStyle.position()
1190 && containsFloats() && !isFloating() && !isOutOfFlowPositioned() && newS tyle.hasOutOfFlowPosition()) 1177 && containsFloats() && !isFloating() && !isOutOfFlowPositioned() && newS tyle.hasOutOfFlowPosition())
1191 markAllDescendantsWithFloatsForLayout(); 1178 markAllDescendantsWithFloatsForLayout();
1192 1179
1193 RenderBlock::styleWillChange(diff, newStyle); 1180 RenderBlock::styleWillChange(diff, newStyle);
1194 } 1181 }
1195 1182
1196 void RenderBlockFlow::styleDidChange(StyleDifference diff, const RenderStyle* ol dStyle) 1183 void RenderBlockFlow::styleDidChange(StyleDifference diff, const RenderStyle* ol dStyle)
1197 { 1184 {
1185 // FIXME(sky): Remove this.
1198 RenderBlock::styleDidChange(diff, oldStyle); 1186 RenderBlock::styleDidChange(diff, oldStyle);
1199
1200 // After our style changed, if we lose our ability to propagate floats into next sibling
1201 // blocks, then we need to find the top most parent containing that overhang ing float and
1202 // then mark its descendants with floats for layout and clear all floats fro m its next
1203 // sibling blocks that exist in our floating objects list. See bug 56299 and 62875.
1204 bool canPropagateFloatIntoSibling = !isFloatingOrOutOfFlowPositioned() && !a voidsFloats();
1205 if (diff.needsFullLayout() && s_canPropagateFloatIntoSibling && !canPropagat eFloatIntoSibling && hasOverhangingFloats()) {
1206 RenderBlockFlow* parentBlockFlow = this;
1207 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
1208 FloatingObjectSetIterator end = floatingObjectSet.end();
1209
1210 for (RenderObject* curr = parent(); curr && !curr->isRenderView(); curr = curr->parent()) {
1211 if (curr->isRenderBlockFlow()) {
1212 RenderBlockFlow* currBlock = toRenderBlockFlow(curr);
1213
1214 if (currBlock->hasOverhangingFloats()) {
1215 for (FloatingObjectSetIterator it = floatingObjectSet.begin( ); it != end; ++it) {
1216 RenderBox* renderer = (*it)->renderer();
1217 if (currBlock->hasOverhangingFloat(renderer)) {
1218 parentBlockFlow = currBlock;
1219 break;
1220 }
1221 }
1222 }
1223 }
1224 }
1225
1226 parentBlockFlow->markAllDescendantsWithFloatsForLayout();
1227 parentBlockFlow->markSiblingsWithFloatsForLayout();
1228 }
1229 } 1187 }
1230 1188
1231 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou tUnit logicalTop) 1189 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou tUnit logicalTop)
1232 { 1190 {
1233 if (child->style()->isOriginalDisplayInlineType()) 1191 if (child->style()->isOriginalDisplayInlineType())
1234 setStaticInlinePositionForChild(child, startAlignedOffsetForLine(logical Top, false)); 1192 setStaticInlinePositionForChild(child, startAlignedOffsetForLine(logical Top, false));
1235 else 1193 else
1236 setStaticInlinePositionForChild(child, startOffsetForContent()); 1194 setStaticInlinePositionForChild(child, startOffsetForContent());
1237 } 1195 }
1238 1196
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 1254
1297 m_paintInvalidationLogicalTop = 0; 1255 m_paintInvalidationLogicalTop = 0;
1298 m_paintInvalidationLogicalBottom = 0; 1256 m_paintInvalidationLogicalBottom = 0;
1299 } 1257 }
1300 1258
1301 void RenderBlockFlow::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paint Offset, bool preservePhase) 1259 void RenderBlockFlow::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paint Offset, bool preservePhase)
1302 { 1260 {
1303 // FIXME(sky): Remove this. 1261 // FIXME(sky): Remove this.
1304 } 1262 }
1305 1263
1306 void RenderBlockFlow::clipOutFloatingObjects(RenderBlock* rootBlock, const Paint Info* paintInfo, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock)
1307 {
1308 // FIXME(sky): Remove this.
1309 }
1310
1311 void RenderBlockFlow::clearFloats(EClear clear) 1264 void RenderBlockFlow::clearFloats(EClear clear)
1312 { 1265 {
1313 // FIXME(sky): Remove this. 1266 // FIXME(sky): Remove this.
1314 } 1267 }
1315 1268
1316 bool RenderBlockFlow::containsFloat(RenderBox* renderer) const
1317 {
1318 // FIXME(sky): Remove this.
1319 return false;
1320 }
1321
1322 void RenderBlockFlow::removeFloatingObjects()
1323 {
1324 // FIXME(sky): Remove this.
1325 }
1326
1327 LayoutPoint RenderBlockFlow::flipFloatForWritingModeForChild(const FloatingObjec t* child, const LayoutPoint& point) const 1269 LayoutPoint RenderBlockFlow::flipFloatForWritingModeForChild(const FloatingObjec t* child, const LayoutPoint& point) const
1328 { 1270 {
1329 // FIXME(sky): Remove this. 1271 // FIXME(sky): Remove this.
1330 return LayoutPoint(); 1272 return LayoutPoint();
1331 } 1273 }
1332 1274
1333 LayoutUnit RenderBlockFlow::logicalLeftOffsetForPositioningFloat(LayoutUnit logi calTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemainin g) const 1275 LayoutUnit RenderBlockFlow::logicalLeftOffsetForPositioningFloat(LayoutUnit logi calTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemainin g) const
1334 { 1276 {
1335 // FIXME(sky): Remove this. 1277 // FIXME(sky): Remove this.
1336 LayoutUnit offset = fixedOffset; 1278 LayoutUnit offset = fixedOffset;
(...skipping 26 matching lines...) Expand all
1363 1305
1364 return right; 1306 return right;
1365 } 1307 }
1366 1308
1367 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject * floatingObject, LayoutUnit logicalTopOffset) const 1309 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject * floatingObject, LayoutUnit logicalTopOffset) const
1368 { 1310 {
1369 // FIXME(sky): Remove this. 1311 // FIXME(sky): Remove this.
1370 return LayoutPoint(); 1312 return LayoutPoint();
1371 } 1313 }
1372 1314
1373 FloatingObject* RenderBlockFlow::insertFloatingObject(RenderBox* floatBox)
1374 {
1375 return 0;
1376 }
1377
1378 void RenderBlockFlow::removeFloatingObject(RenderBox* floatBox)
1379 {
1380 // FIXME(sky): Remove this.
1381 }
1382
1383 void RenderBlockFlow::removeFloatingObjectsBelow(FloatingObject* lastFloat, int logicalOffset)
1384 {
1385 // FIXME(sky): Remove this.
1386 }
1387
1388 bool RenderBlockFlow::positionNewFloats() 1315 bool RenderBlockFlow::positionNewFloats()
1389 { 1316 {
1390 // FIXME(sky): Remove this. 1317 // FIXME(sky): Remove this.
1391 return false; 1318 return false;
1392 } 1319 }
1393 1320
1394 bool RenderBlockFlow::hasOverhangingFloat(RenderBox* renderer) 1321 bool RenderBlockFlow::hasOverhangingFloat(RenderBox* renderer)
1395 { 1322 {
1396 // FIXME(sky): Remove this. 1323 // FIXME(sky): Remove this.
1397 return false; 1324 return false;
1398 } 1325 }
1399 1326
1400 void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit logic alLeftOffset, LayoutUnit logicalTopOffset) 1327 void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit logic alLeftOffset, LayoutUnit logicalTopOffset)
1401 { 1328 {
1402 // FIXME(sky): Remove this. 1329 // FIXME(sky): Remove this.
1403 } 1330 }
1404 1331
1405 void RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool makeChil dPaintOtherFloats) 1332 void RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool makeChil dPaintOtherFloats)
1406 { 1333 {
1407 // FIXME(sky): Remove this. 1334 // FIXME(sky): Remove this.
1408 } 1335 }
1409 1336
1410 LayoutUnit RenderBlockFlow::lowestFloatLogicalBottom(FloatingObject::Type floatT ype) const
1411 {
1412 // FIXME(sky): Remove this.
1413 return 0;
1414 }
1415
1416 LayoutUnit RenderBlockFlow::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight , ShapeOutsideFloatOffsetMode offsetMode) const
1417 {
1418 // FIXME(sky): Remove this.
1419 return logicalHeight;
1420 }
1421
1422 bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult & result, const HitTestLocation& locationInContainer, const LayoutPoint& accumul atedOffset) 1337 bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult & result, const HitTestLocation& locationInContainer, const LayoutPoint& accumul atedOffset)
1423 { 1338 {
1424 // FIXME(sky): Remove this. 1339 // FIXME(sky): Remove this.
1425 return false; 1340 return false;
1426 } 1341 }
1427 1342
1428 void RenderBlockFlow::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutU nit& right) const 1343 void RenderBlockFlow::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutU nit& right) const
1429 { 1344 {
1430 // We don't deal with relative positioning. Our assumption is that you shrin k to fit the lines without accounting 1345 // We don't deal with relative positioning. Our assumption is that you shrin k to fit the lines without accounting
1431 // for either overflow or translations via relative positioning. 1346 // for either overflow or translations via relative positioning.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 if (newContentWidth == oldWidth) 1387 if (newContentWidth == oldWidth)
1473 return; 1388 return;
1474 1389
1475 setOverrideLogicalContentWidth(newContentWidth); 1390 setOverrideLogicalContentWidth(newContentWidth);
1476 layoutBlock(false); 1391 layoutBlock(false);
1477 clearOverrideLogicalContentWidth(); 1392 clearOverrideLogicalContentWidth();
1478 } 1393 }
1479 1394
1480 LayoutUnit RenderBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const 1395 LayoutUnit RenderBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const
1481 { 1396 {
1482 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) 1397 // FIXME(sky): remove this.
1483 return m_floatingObjects->logicalLeftOffset(fixedOffset, logicalTop, log icalHeight);
1484
1485 return fixedOffset; 1398 return fixedOffset;
1486 } 1399 }
1487 1400
1488 LayoutUnit RenderBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop , LayoutUnit fixedOffset, LayoutUnit logicalHeight) const 1401 LayoutUnit RenderBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop , LayoutUnit fixedOffset, LayoutUnit logicalHeight) const
1489 { 1402 {
1490 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) 1403 // FIXME(sky): remove this.
1491 return m_floatingObjects->logicalRightOffset(fixedOffset, logicalTop, lo gicalHeight);
1492
1493 return fixedOffset; 1404 return fixedOffset;
1494 } 1405 }
1495 1406
1496 GapRects RenderBlockFlow::inlineSelectionGaps(RenderBlock* rootBlock, const Layo utPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 1407 GapRects RenderBlockFlow::inlineSelectionGaps(RenderBlock* rootBlock, const Layo utPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
1497 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLog icalRight, const PaintInfo* paintInfo) 1408 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLog icalRight, const PaintInfo* paintInfo)
1498 { 1409 {
1499 GapRects result; 1410 GapRects result;
1500 1411
1501 bool containsStart = selectionState() == SelectionStart || selectionState() == SelectionBoth; 1412 bool containsStart = selectionState() == SelectionStart || selectionState() == SelectionBoth;
1502 1413
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() 1501 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
1591 { 1502 {
1592 if (m_rareData) 1503 if (m_rareData)
1593 return *m_rareData; 1504 return *m_rareData;
1594 1505
1595 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); 1506 m_rareData = adoptPtr(new RenderBlockFlowRareData(this));
1596 return *m_rareData; 1507 return *m_rareData;
1597 } 1508 }
1598 1509
1599 } // namespace blink 1510 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlockFlow.h ('k') | sky/engine/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698