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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.h

Issue 1648573002: Transition to explicit constructors in LayoutUnit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moar tweaks! Created 4 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) 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
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 max<LayoutUnit>(LayoutUnit(), logicalRightOffsetForLine(position, indentText, logicalHeight) - logicalLeftOffsetForLine(position, indentText, log icalHeight));
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 , m_multiColumnFlowThread(nullptr) 460 , m_multiColumnFlowThread(nullptr)
461 , m_lineBreakToAvoidWidow(-1) 461 , m_lineBreakToAvoidWidow(-1)
462 , m_didBreakAtLineToAvoidWidow(false) 462 , m_didBreakAtLineToAvoidWidow(false)
463 , m_discardMarginBefore(false) 463 , m_discardMarginBefore(false)
464 , m_discardMarginAfter(false) 464 , m_discardMarginAfter(false)
465 { 465 {
466 } 466 }
467 467
468 static LayoutUnit positiveMarginBeforeDefault(const LayoutBlockFlow* blo ck) 468 static LayoutUnit positiveMarginBeforeDefault(const LayoutBlockFlow* blo ck)
469 { 469 {
470 return std::max<LayoutUnit>(block->marginBefore(), 0); 470 return std::max<LayoutUnit>(block->marginBefore(), LayoutUnit());
eae 2016/01/29 03:38:11 No need for template specification if you specify
leviw_travelin_and_unemployed 2016/01/29 03:47:27 Makes sense.
471 } 471 }
472 static LayoutUnit negativeMarginBeforeDefault(const LayoutBlockFlow* blo ck) 472 static LayoutUnit negativeMarginBeforeDefault(const LayoutBlockFlow* blo ck)
473 { 473 {
474 return std::max<LayoutUnit>(-block->marginBefore(), 0); 474 return std::max<LayoutUnit>(-block->marginBefore(), LayoutUnit());
475 } 475 }
476 static LayoutUnit positiveMarginAfterDefault(const LayoutBlockFlow* bloc k) 476 static LayoutUnit positiveMarginAfterDefault(const LayoutBlockFlow* bloc k)
477 { 477 {
478 return std::max<LayoutUnit>(block->marginAfter(), 0); 478 return std::max<LayoutUnit>(block->marginAfter(), LayoutUnit());
479 } 479 }
480 static LayoutUnit negativeMarginAfterDefault(const LayoutBlockFlow* bloc k) 480 static LayoutUnit negativeMarginAfterDefault(const LayoutBlockFlow* bloc k)
481 { 481 {
482 return std::max<LayoutUnit>(-block->marginAfter(), 0); 482 return std::max<LayoutUnit>(-block->marginAfter(), LayoutUnit());
483 } 483 }
484 484
485 MarginValues m_margins; 485 MarginValues m_margins;
486 LayoutUnit m_paginationStrutPropagatedFromChild; 486 LayoutUnit m_paginationStrutPropagatedFromChild;
487 487
488 LayoutMultiColumnFlowThread* m_multiColumnFlowThread; 488 LayoutMultiColumnFlowThread* m_multiColumnFlowThread;
489 489
490 int m_lineBreakToAvoidWidow; 490 int m_lineBreakToAvoidWidow;
491 bool m_didBreakAtLineToAvoidWidow : 1; 491 bool m_didBreakAtLineToAvoidWidow : 1;
492 bool m_discardMarginBefore : 1; 492 bool m_discardMarginBefore : 1;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 606
607 // END METHODS DEFINED IN LayoutBlockFlowLine 607 // END METHODS DEFINED IN LayoutBlockFlowLine
608 608
609 }; 609 };
610 610
611 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, isLayoutBlockFlow()); 611 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBlockFlow, isLayoutBlockFlow());
612 612
613 } // namespace blink 613 } // namespace blink
614 614
615 #endif // LayoutBlockFlow_h 615 #endif // LayoutBlockFlow_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698