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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 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) 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. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
4 * All right reserved. 4 * All right reserved.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 bool isLeftToRightDirection, 387 bool isLeftToRightDirection,
388 BidiRun* trailingSpaceRun, 388 BidiRun* trailingSpaceRun,
389 LayoutUnit& logicalLeft, 389 LayoutUnit& logicalLeft,
390 LayoutUnit totalLogicalWidth, 390 LayoutUnit totalLogicalWidth,
391 LayoutUnit availableLogicalWidth) { 391 LayoutUnit availableLogicalWidth) {
392 // The direction of the block should determine what happens with wide lines. 392 // The direction of the block should determine what happens with wide lines.
393 // In particular with RTL blocks, wide lines should still spill out to the 393 // In particular with RTL blocks, wide lines should still spill out to the
394 // left. 394 // left.
395 if (isLeftToRightDirection) { 395 if (isLeftToRightDirection) {
396 if (totalLogicalWidth > availableLogicalWidth && trailingSpaceRun) 396 if (totalLogicalWidth > availableLogicalWidth && trailingSpaceRun)
397 trailingSpaceRun->m_box->setLogicalWidth(std::max( 397 trailingSpaceRun->m_box->setLogicalWidth(
398 LayoutUnit(), trailingSpaceRun->m_box->logicalWidth() - 398 std::max(LayoutUnit(),
399 totalLogicalWidth + availableLogicalWidth)); 399 trailingSpaceRun->m_box->logicalWidth() - totalLogicalWidth +
400 availableLogicalWidth));
400 return; 401 return;
401 } 402 }
402 403
403 if (trailingSpaceRun) 404 if (trailingSpaceRun)
404 trailingSpaceRun->m_box->setLogicalWidth(LayoutUnit()); 405 trailingSpaceRun->m_box->setLogicalWidth(LayoutUnit());
405 else if (totalLogicalWidth > availableLogicalWidth) 406 else if (totalLogicalWidth > availableLogicalWidth)
406 logicalLeft -= (totalLogicalWidth - availableLogicalWidth); 407 logicalLeft -= (totalLogicalWidth - availableLogicalWidth);
407 } 408 }
408 409
409 static void updateLogicalWidthForRightAlignedBlock( 410 static void updateLogicalWidthForRightAlignedBlock(
(...skipping 10 matching lines...) Expand all
420 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); 421 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth();
421 trailingSpaceRun->m_box->setLogicalWidth(LayoutUnit()); 422 trailingSpaceRun->m_box->setLogicalWidth(LayoutUnit());
422 } 423 }
423 if (totalLogicalWidth < availableLogicalWidth) 424 if (totalLogicalWidth < availableLogicalWidth)
424 logicalLeft += availableLogicalWidth - totalLogicalWidth; 425 logicalLeft += availableLogicalWidth - totalLogicalWidth;
425 return; 426 return;
426 } 427 }
427 428
428 if (totalLogicalWidth > availableLogicalWidth && trailingSpaceRun) { 429 if (totalLogicalWidth > availableLogicalWidth && trailingSpaceRun) {
429 trailingSpaceRun->m_box->setLogicalWidth( 430 trailingSpaceRun->m_box->setLogicalWidth(
430 std::max(LayoutUnit(), trailingSpaceRun->m_box->logicalWidth() - 431 std::max(LayoutUnit(),
431 totalLogicalWidth + availableLogicalWidth)); 432 trailingSpaceRun->m_box->logicalWidth() - totalLogicalWidth +
433 availableLogicalWidth));
432 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); 434 totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth();
433 } else { 435 } else {
434 logicalLeft += availableLogicalWidth - totalLogicalWidth; 436 logicalLeft += availableLogicalWidth - totalLogicalWidth;
435 } 437 }
436 } 438 }
437 439
438 static void updateLogicalWidthForCenterAlignedBlock( 440 static void updateLogicalWidthForCenterAlignedBlock(
439 bool isLeftToRightDirection, 441 bool isLeftToRightDirection,
440 BidiRun* trailingSpaceRun, 442 BidiRun* trailingSpaceRun,
441 LayoutUnit& logicalLeft, 443 LayoutUnit& logicalLeft,
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 // affected the available width. 1198 // affected the available width.
1197 // Restore the pagination info for this line. 1199 // Restore the pagination info for this line.
1198 lineBox->setIsFirstAfterPageBreak(true); 1200 lineBox->setIsFirstAfterPageBreak(true);
1199 lineBox->setPaginationStrut(paginationStrutFromDeletedLine); 1201 lineBox->setPaginationStrut(paginationStrutFromDeletedLine);
1200 paginationStrutFromDeletedLine = LayoutUnit(); 1202 paginationStrutFromDeletedLine = LayoutUnit();
1201 } else { 1203 } else {
1202 LayoutUnit adjustment; 1204 LayoutUnit adjustment;
1203 adjustLinePositionForPagination(*lineBox, adjustment); 1205 adjustLinePositionForPagination(*lineBox, adjustment);
1204 if (adjustment) { 1206 if (adjustment) {
1205 LayoutUnit oldLineWidth = availableLogicalWidthForLine( 1207 LayoutUnit oldLineWidth = availableLogicalWidthForLine(
1206 oldLogicalHeight, layoutState.lineInfo().isFirstLine() 1208 oldLogicalHeight,
1207 ? IndentText 1209 layoutState.lineInfo().isFirstLine() ? IndentText
1208 : DoNotIndentText); 1210 : DoNotIndentText);
1209 lineBox->moveInBlockDirection(adjustment); 1211 lineBox->moveInBlockDirection(adjustment);
1210 if (availableLogicalWidthForLine( 1212 if (availableLogicalWidthForLine(
1211 oldLogicalHeight + adjustment, 1213 oldLogicalHeight + adjustment,
1212 layoutState.lineInfo().isFirstLine() 1214 layoutState.lineInfo().isFirstLine()
1213 ? IndentText 1215 ? IndentText
1214 : DoNotIndentText) != oldLineWidth) { 1216 : DoNotIndentText) != oldLineWidth) {
1215 // We have to delete this line, remove all floats that got 1217 // We have to delete this line, remove all floats that got
1216 // added, and let line layout re-run. We had just calculated the 1218 // added, and let line layout re-run. We had just calculated the
1217 // pagination strut for this line, and we need to stow it away, 1219 // pagination strut for this line, and we need to stow it away,
1218 // so that we can re-apply it when the new line has been 1220 // so that we can re-apply it when the new line has been
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 lastLineAnnotationsAdjustment = 1980 lastLineAnnotationsAdjustment =
1979 lastRootBox() 1981 lastRootBox()
1980 ->computeOverAnnotationAdjustment(lowestAllowedPosition) 1982 ->computeOverAnnotationAdjustment(lowestAllowedPosition)
1981 .toInt(); 1983 .toInt();
1982 } 1984 }
1983 1985
1984 // Now add in the bottom border/padding. 1986 // Now add in the bottom border/padding.
1985 setLogicalHeight(logicalHeight() + lastLineAnnotationsAdjustment + afterEdge); 1987 setLogicalHeight(logicalHeight() + lastLineAnnotationsAdjustment + afterEdge);
1986 1988
1987 if (!firstLineBox() && hasLineIfEmpty()) 1989 if (!firstLineBox() && hasLineIfEmpty())
1988 setLogicalHeight(logicalHeight() + 1990 setLogicalHeight(
1989 lineHeight(true, isHorizontalWritingMode() ? HorizontalLine 1991 logicalHeight() +
1990 : VerticalLine, 1992 lineHeight(true,
1991 PositionOfInteriorLineBoxes)); 1993 isHorizontalWritingMode() ? HorizontalLine : VerticalLine,
1994 PositionOfInteriorLineBoxes));
1992 1995
1993 // See if we have any lines that spill out of our block. If we do, then we 1996 // See if we have any lines that spill out of our block. If we do, then we
1994 // will possibly need to truncate text. 1997 // will possibly need to truncate text.
1995 if (hasTextOverflow) 1998 if (hasTextOverflow)
1996 checkLinesForTextOverflow(); 1999 checkLinesForTextOverflow();
1997 2000
1998 // Ensure the new line boxes will be painted. 2001 // Ensure the new line boxes will be painted.
1999 if (isFullLayout && firstLineBox()) 2002 if (isFullLayout && firstLineBox())
2000 setShouldDoFullPaintInvalidation(); 2003 setShouldDoFullPaintInvalidation();
2001 } 2004 }
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
2512 2515
2513 bool LayoutBlockFlow::paintedOutputOfObjectHasNoEffectRegardlessOfSize() const { 2516 bool LayoutBlockFlow::paintedOutputOfObjectHasNoEffectRegardlessOfSize() const {
2514 // LayoutBlockFlow is in charge of paint invalidation of the first line. 2517 // LayoutBlockFlow is in charge of paint invalidation of the first line.
2515 if (firstLineBox()) 2518 if (firstLineBox())
2516 return false; 2519 return false;
2517 2520
2518 return LayoutBlock::paintedOutputOfObjectHasNoEffectRegardlessOfSize(); 2521 return LayoutBlock::paintedOutputOfObjectHasNoEffectRegardlessOfSize();
2519 } 2522 }
2520 2523
2521 } // namespace blink 2524 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698