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

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

Issue 688213002: First pass at removing dead vertical writing mode code. (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
« no previous file with comments | « sky/engine/core/rendering/RenderBlockFlow.cpp ('k') | sky/engine/core/rendering/RenderBox.h » ('j') | 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 bool constructedNewBox = false; 106 bool constructedNewBox = false;
107 bool allowedToConstructNewBox = !hasDefaultLineBoxContain || !inlineFlow || inlineFlow->alwaysCreateLineBoxes(); 107 bool allowedToConstructNewBox = !hasDefaultLineBoxContain || !inlineFlow || inlineFlow->alwaysCreateLineBoxes();
108 bool canUseExistingParentBox = parentBox && !parentIsConstructedOrHaveNe xt(parentBox); 108 bool canUseExistingParentBox = parentBox && !parentIsConstructedOrHaveNe xt(parentBox);
109 if (allowedToConstructNewBox && !canUseExistingParentBox) { 109 if (allowedToConstructNewBox && !canUseExistingParentBox) {
110 // We need to make a new box for this render object. Once 110 // We need to make a new box for this render object. Once
111 // made, we need to place it at the end of the current line. 111 // made, we need to place it at the end of the current line.
112 InlineBox* newBox = createInlineBoxForRenderer(obj, obj == this); 112 InlineBox* newBox = createInlineBoxForRenderer(obj, obj == this);
113 ASSERT_WITH_SECURITY_IMPLICATION(newBox->isInlineFlowBox()); 113 ASSERT_WITH_SECURITY_IMPLICATION(newBox->isInlineFlowBox());
114 parentBox = toInlineFlowBox(newBox); 114 parentBox = toInlineFlowBox(newBox);
115 parentBox->setFirstLineStyleBit(lineInfo.isFirstLine()); 115 parentBox->setFirstLineStyleBit(lineInfo.isFirstLine());
116 parentBox->setIsHorizontal(isHorizontalWritingMode()); 116 // FIXME(sky): Remove
117 parentBox->setIsHorizontal(true);
117 if (!hasDefaultLineBoxContain) 118 if (!hasDefaultLineBoxContain)
118 parentBox->clearDescendantsHaveSameLineHeightAndBaseline(); 119 parentBox->clearDescendantsHaveSameLineHeightAndBaseline();
119 constructedNewBox = true; 120 constructedNewBox = true;
120 } 121 }
121 122
122 if (constructedNewBox || canUseExistingParentBox) { 123 if (constructedNewBox || canUseExistingParentBox) {
123 if (!result) 124 if (!result)
124 result = parentBox; 125 result = parentBox;
125 126
126 // If we have hit the block itself, then |box| represents the root 127 // If we have hit the block itself, then |box| represents the root
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 margins += adjustFloatForSubPixelLayout(endMargin.value()); 1056 margins += adjustFloatForSubPixelLayout(endMargin.value());
1056 childMin += margins.ceilToFloat(); 1057 childMin += margins.ceilToFloat();
1057 childMax += margins.ceilToFloat(); 1058 childMax += margins.ceilToFloat();
1058 } 1059 }
1059 } 1060 }
1060 1061
1061 if (!child->isRenderInline() && !child->isText()) { 1062 if (!child->isRenderInline() && !child->isText()) {
1062 // Case (2). Inline replaced elements and floats. 1063 // Case (2). Inline replaced elements and floats.
1063 // Go ahead and terminate the current line as far as 1064 // Go ahead and terminate the current line as far as
1064 // minwidth is concerned. 1065 // minwidth is concerned.
1065 LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogicalWi dth; 1066 LayoutUnit childMinPreferredLogicalWidth = child->minPreferredLogica lWidth();
1066 if (child->isBox() && child->isHorizontalWritingMode() != isHorizont alWritingMode()) { 1067 LayoutUnit childMaxPreferredLogicalWidth = child->maxPreferredLogica lWidth();
1067 RenderBox* childBox = toRenderBox(child);
1068 LogicalExtentComputedValues computedValues;
1069 childBox->computeLogicalHeight(childBox->borderAndPaddingLogical Height(), 0, computedValues);
1070 childMinPreferredLogicalWidth = childMaxPreferredLogicalWidth = computedValues.m_extent;
1071 } else {
1072 childMinPreferredLogicalWidth = child->minPreferredLogicalWidth( );
1073 childMaxPreferredLogicalWidth = child->maxPreferredLogicalWidth( );
1074 }
1075 childMin += childMinPreferredLogicalWidth.ceilToFloat(); 1068 childMin += childMinPreferredLogicalWidth.ceilToFloat();
1076 childMax += childMaxPreferredLogicalWidth.ceilToFloat(); 1069 childMax += childMaxPreferredLogicalWidth.ceilToFloat();
1077 1070
1078 bool clearPreviousFloat; 1071 bool clearPreviousFloat;
1079 if (child->isFloating()) { 1072 if (child->isFloating()) {
1080 clearPreviousFloat = (prevFloat 1073 clearPreviousFloat = (prevFloat
1081 && ((prevFloat->style()->floating() == LeftFloat && (childSt yle->clear() & CLEFT)) 1074 && ((prevFloat->style()->floating() == LeftFloat && (childSt yle->clear() & CLEFT))
1082 || (prevFloat->style()->floating() == RightFloat && (chi ldStyle->clear() & CRIGHT)))); 1075 || (prevFloat->style()->floating() == RightFloat && (chi ldStyle->clear() & CRIGHT))));
1083 prevFloat = child; 1076 prevFloat = child;
1084 } else { 1077 } else {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 if (!style()->isFlippedLinesWritingMode()) 1321 if (!style()->isFlippedLinesWritingMode())
1329 lastLineAnnotationsAdjustment = lastRootBox()->computeUnderAnnotatio nAdjustment(lowestAllowedPosition); 1322 lastLineAnnotationsAdjustment = lastRootBox()->computeUnderAnnotatio nAdjustment(lowestAllowedPosition);
1330 else 1323 else
1331 lastLineAnnotationsAdjustment = lastRootBox()->computeOverAnnotation Adjustment(lowestAllowedPosition); 1324 lastLineAnnotationsAdjustment = lastRootBox()->computeOverAnnotation Adjustment(lowestAllowedPosition);
1332 } 1325 }
1333 1326
1334 // Now add in the bottom border/padding. 1327 // Now add in the bottom border/padding.
1335 setLogicalHeight(logicalHeight() + lastLineAnnotationsAdjustment + afterEdge ); 1328 setLogicalHeight(logicalHeight() + lastLineAnnotationsAdjustment + afterEdge );
1336 1329
1337 if (!firstLineBox() && hasLineIfEmpty()) 1330 if (!firstLineBox() && hasLineIfEmpty())
1338 setLogicalHeight(logicalHeight() + lineHeight(true, isHorizontalWritingM ode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)); 1331 setLogicalHeight(logicalHeight() + lineHeight(true, HorizontalLine, Posi tionOfInteriorLineBoxes));
1339 1332
1340 // See if we have any lines that spill out of our block. If we do, then we will possibly need to 1333 // See if we have any lines that spill out of our block. If we do, then we will possibly need to
1341 // truncate text. 1334 // truncate text.
1342 if (hasTextOverflow) 1335 if (hasTextOverflow)
1343 checkLinesForTextOverflow(); 1336 checkLinesForTextOverflow();
1344 1337
1345 // Ensure the new line boxes will be painted. 1338 // Ensure the new line boxes will be painted.
1346 if (isFullLayout && firstLineBox()) 1339 if (isFullLayout && firstLineBox())
1347 setShouldDoFullPaintInvalidation(true); 1340 setShouldDoFullPaintInvalidation(true);
1348 } 1341 }
1349 1342
1350 void RenderBlockFlow::checkFloatsInCleanLine(RootInlineBox* line, Vector<FloatWi thRect>& floats, size_t& floatIndex, bool& encounteredNewFloat, bool& dirtiedByF loat) 1343 void RenderBlockFlow::checkFloatsInCleanLine(RootInlineBox* line, Vector<FloatWi thRect>& floats, size_t& floatIndex, bool& encounteredNewFloat, bool& dirtiedByF loat)
1351 { 1344 {
1352 Vector<RenderBox*>* cleanLineFloats = line->floatsPtr(); 1345 Vector<RenderBox*>* cleanLineFloats = line->floatsPtr();
1353 if (!cleanLineFloats) 1346 if (!cleanLineFloats)
1354 return; 1347 return;
1355 1348
1356 Vector<RenderBox*>::iterator end = cleanLineFloats->end(); 1349 Vector<RenderBox*>::iterator end = cleanLineFloats->end();
1357 for (Vector<RenderBox*>::iterator it = cleanLineFloats->begin(); it != end; ++it) { 1350 for (Vector<RenderBox*>::iterator it = cleanLineFloats->begin(); it != end; ++it) {
1358 RenderBox* floatingBox = *it; 1351 RenderBox* floatingBox = *it;
1359 floatingBox->layoutIfNeeded(); 1352 floatingBox->layoutIfNeeded();
1360 LayoutSize newSize(floatingBox->width() + floatingBox->marginWidth(), fl oatingBox->height() + floatingBox->marginHeight()); 1353 LayoutSize newSize(floatingBox->width() + floatingBox->marginWidth(), fl oatingBox->height() + floatingBox->marginHeight());
1361 if (floats[floatIndex].object != floatingBox) { 1354 if (floats[floatIndex].object != floatingBox) {
1362 encounteredNewFloat = true; 1355 encounteredNewFloat = true;
1363 return; 1356 return;
1364 } 1357 }
1365 1358
1366 if (floats[floatIndex].rect.size() != newSize) { 1359 if (floats[floatIndex].rect.size() != newSize) {
1367 LayoutUnit floatTop = isHorizontalWritingMode() ? floats[floatIndex] .rect.y() : floats[floatIndex].rect.x(); 1360 LayoutUnit floatTop = floats[floatIndex].rect.y();
1368 LayoutUnit floatHeight = isHorizontalWritingMode() ? std::max(floats [floatIndex].rect.height(), newSize.height()) 1361 LayoutUnit floatHeight = std::max(floats[floatIndex].rect.height(), newSize.height());
1369 : std::max(floats[floatIndex].rect.width(), newSize.width());
1370 floatHeight = std::min(floatHeight, LayoutUnit::max() - floatTop); 1362 floatHeight = std::min(floatHeight, LayoutUnit::max() - floatTop);
1371 line->markDirty(); 1363 line->markDirty();
1372 markLinesDirtyInBlockRange(line->lineBottomWithLeading(), floatTop + floatHeight, line); 1364 markLinesDirtyInBlockRange(line->lineBottomWithLeading(), floatTop + floatHeight, line);
1373 floats[floatIndex].rect.setSize(newSize); 1365 floats[floatIndex].rect.setSize(newSize);
1374 dirtiedByFloat = true; 1366 dirtiedByFloat = true;
1375 } 1367 }
1376 floatIndex++; 1368 floatIndex++;
1377 } 1369 }
1378 } 1370 }
1379 1371
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat (); 1640 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat ();
1649 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 1641 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
1650 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 1642 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
1651 1643
1652 if (!style()->isLeftToRightDirection()) 1644 if (!style()->isLeftToRightDirection())
1653 return logicalWidth() - logicalLeft; 1645 return logicalWidth() - logicalLeft;
1654 return logicalLeft; 1646 return logicalLeft;
1655 } 1647 }
1656 1648
1657 } 1649 }
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlockFlow.cpp ('k') | sky/engine/core/rendering/RenderBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698