| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 5 * Copyright (C) 2003-2013 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003-2013 Apple Inc. All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * Copyright (C) 2013 Google Inc. All rights reserved. | 7 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
| 10 * modification, are permitted provided that the following conditions are | 10 * modification, are permitted provided that the following conditions are |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 static LayoutBlockFlow* createAnonymous(Document*); | 92 static LayoutBlockFlow* createAnonymous(Document*); |
| 93 | 93 |
| 94 bool isLayoutBlockFlow() const final { return true; } | 94 bool isLayoutBlockFlow() const final { return true; } |
| 95 | 95 |
| 96 void layoutBlock(bool relayoutChildren) override; | 96 void layoutBlock(bool relayoutChildren) override; |
| 97 | 97 |
| 98 void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = f
alse) override; | 98 void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = f
alse) override; |
| 99 | 99 |
| 100 void deleteLineBoxTree() final; | 100 void deleteLineBoxTree() final; |
| 101 | 101 |
| 102 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, IndentTextOrNot
indentText, LayoutUnit logicalHeight = 0) const | 102 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, IndentTextOrNot
indentText, LayoutUnit logicalHeight = LayoutUnit()) const |
| 103 { | 103 { |
| 104 return max<LayoutUnit>(0, logicalRightOffsetForLine(position, indentText
, logicalHeight) - logicalLeftOffsetForLine(position, indentText, logicalHeight)
); | 104 return (logicalRightOffsetForLine(position, indentText, logicalHeight) -
logicalLeftOffsetForLine(position, indentText, logicalHeight)).clampToZero(); |
| 105 } | 105 } |
| 106 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, IndentTextOrNot in
dentText, LayoutUnit logicalHeight = 0) const | 106 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, IndentTextOrNot in
dentText, LayoutUnit logicalHeight = LayoutUnit()) const |
| 107 { | 107 { |
| 108 return logicalRightOffsetForLine(position, logicalRightOffsetForContent(
), indentText, logicalHeight); | 108 return logicalRightOffsetForLine(position, logicalRightOffsetForContent(
), indentText, logicalHeight); |
| 109 } | 109 } |
| 110 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, IndentTextOrNot ind
entText, LayoutUnit logicalHeight = 0) const | 110 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, IndentTextOrNot ind
entText, LayoutUnit logicalHeight = LayoutUnit()) const |
| 111 { | 111 { |
| 112 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(),
indentText, logicalHeight); | 112 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(),
indentText, logicalHeight); |
| 113 } | 113 } |
| 114 LayoutUnit startOffsetForLine(LayoutUnit position, IndentTextOrNot indentTex
t, LayoutUnit logicalHeight = 0) const | 114 LayoutUnit startOffsetForLine(LayoutUnit position, IndentTextOrNot indentTex
t, LayoutUnit logicalHeight = LayoutUnit()) const |
| 115 { | 115 { |
| 116 return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(posi
tion, indentText, logicalHeight) | 116 return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(posi
tion, indentText, logicalHeight) |
| 117 : logicalWidth() - logicalRightOffsetForLine(position, indentText, l
ogicalHeight); | 117 : logicalWidth() - logicalRightOffsetForLine(position, indentText, l
ogicalHeight); |
| 118 } | 118 } |
| 119 LayoutUnit endOffsetForLine(LayoutUnit position, IndentTextOrNot indentText,
LayoutUnit logicalHeight = 0) const | 119 LayoutUnit endOffsetForLine(LayoutUnit position, IndentTextOrNot indentText,
LayoutUnit logicalHeight = LayoutUnit()) const |
| 120 { | 120 { |
| 121 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(pos
ition, indentText, logicalHeight) | 121 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(pos
ition, indentText, logicalHeight) |
| 122 : logicalWidth() - logicalRightOffsetForLine(position, indentText, l
ogicalHeight); | 122 : logicalWidth() - logicalRightOffsetForLine(position, indentText, l
ogicalHeight); |
| 123 } | 123 } |
| 124 | 124 |
| 125 // FIXME-BLOCKFLOW: Move this into LayoutBlockFlow once there are no calls | 125 // FIXME-BLOCKFLOW: Move this into LayoutBlockFlow once there are no calls |
| 126 // in LayoutBlock. http://crbug.com/393945, http://crbug.com/302024 | 126 // in LayoutBlock. http://crbug.com/393945, http://crbug.com/302024 |
| 127 using LayoutBlock::lineBoxes; | 127 using LayoutBlock::lineBoxes; |
| 128 using LayoutBlock::firstLineBox; | 128 using LayoutBlock::firstLineBox; |
| 129 using LayoutBlock::lastLineBox; | 129 using LayoutBlock::lastLineBox; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 , m_multiColumnFlowThread(nullptr) | 440 , m_multiColumnFlowThread(nullptr) |
| 441 , m_lineBreakToAvoidWidow(-1) | 441 , m_lineBreakToAvoidWidow(-1) |
| 442 , m_didBreakAtLineToAvoidWidow(false) | 442 , m_didBreakAtLineToAvoidWidow(false) |
| 443 , m_discardMarginBefore(false) | 443 , m_discardMarginBefore(false) |
| 444 , m_discardMarginAfter(false) | 444 , m_discardMarginAfter(false) |
| 445 { | 445 { |
| 446 } | 446 } |
| 447 | 447 |
| 448 static LayoutUnit positiveMarginBeforeDefault(const LayoutBlockFlow* blo
ck) | 448 static LayoutUnit positiveMarginBeforeDefault(const LayoutBlockFlow* blo
ck) |
| 449 { | 449 { |
| 450 return std::max<LayoutUnit>(block->marginBefore(), 0); | 450 return block->marginBefore().clampToZero(); |
| 451 } | 451 } |
| 452 static LayoutUnit negativeMarginBeforeDefault(const LayoutBlockFlow* blo
ck) | 452 static LayoutUnit negativeMarginBeforeDefault(const LayoutBlockFlow* blo
ck) |
| 453 { | 453 { |
| 454 return std::max<LayoutUnit>(-block->marginBefore(), 0); | 454 return (-block->marginBefore()).clampToZero(); |
| 455 } | 455 } |
| 456 static LayoutUnit positiveMarginAfterDefault(const LayoutBlockFlow* bloc
k) | 456 static LayoutUnit positiveMarginAfterDefault(const LayoutBlockFlow* bloc
k) |
| 457 { | 457 { |
| 458 return std::max<LayoutUnit>(block->marginAfter(), 0); | 458 return block->marginAfter().clampToZero(); |
| 459 } | 459 } |
| 460 static LayoutUnit negativeMarginAfterDefault(const LayoutBlockFlow* bloc
k) | 460 static LayoutUnit negativeMarginAfterDefault(const LayoutBlockFlow* bloc
k) |
| 461 { | 461 { |
| 462 return std::max<LayoutUnit>(-block->marginAfter(), 0); | 462 return (-block->marginAfter()).clampToZero(); |
| 463 } | 463 } |
| 464 | 464 |
| 465 MarginValues m_margins; | 465 MarginValues m_margins; |
| 466 LayoutUnit m_paginationStrutPropagatedFromChild; | 466 LayoutUnit m_paginationStrutPropagatedFromChild; |
| 467 | 467 |
| 468 LayoutMultiColumnFlowThread* m_multiColumnFlowThread; | 468 LayoutMultiColumnFlowThread* m_multiColumnFlowThread; |
| 469 | 469 |
| 470 int m_lineBreakToAvoidWidow; | 470 int m_lineBreakToAvoidWidow; |
| 471 bool m_didBreakAtLineToAvoidWidow : 1; | 471 bool m_didBreakAtLineToAvoidWidow : 1; |
| 472 bool m_discardMarginBefore : 1; | 472 bool m_discardMarginBefore : 1; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 | 586 |
| 587 // END METHODS DEFINED IN LayoutBlockFlowLine | 587 // END METHODS DEFINED IN LayoutBlockFlowLine |
| 588 | 588 |
| 589 }; | 589 }; |
| 590 | 590 |
| 591 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, isLayoutBlockFlow()); | 591 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, isLayoutBlockFlow()); |
| 592 | 592 |
| 593 } // namespace blink | 593 } // namespace blink |
| 594 | 594 |
| 595 #endif // LayoutBlockFlow_h | 595 #endif // LayoutBlockFlow_h |
| OLD | NEW |