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

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

Issue 1651703002: More explicit LayoutUnit conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@evenMoarConstructors
Patch Set: Traits vs Properties vs Pandas 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) 2013 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2013 Adobe Systems Incorporated. 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 startOverhang = std::min<int>(startOverhang, m_committedWidth); 113 startOverhang = std::min<int>(startOverhang, m_committedWidth);
114 m_availableWidth += startOverhang; 114 m_availableWidth += startOverhang;
115 115
116 endOverhang = std::max(std::min<int>(endOverhang, m_availableWidth - current Width()), 0); 116 endOverhang = std::max(std::min<int>(endOverhang, m_availableWidth - current Width()), 0);
117 m_availableWidth += endOverhang; 117 m_availableWidth += endOverhang;
118 m_overhangWidth += startOverhang + endOverhang; 118 m_overhangWidth += startOverhang + endOverhang;
119 } 119 }
120 120
121 inline static float availableWidthAtOffset(LineLayoutBlockFlow block, const Layo utUnit& offset, IndentTextOrNot indentText, float& newLineLeft, 121 inline static float availableWidthAtOffset(LineLayoutBlockFlow block, const Layo utUnit& offset, IndentTextOrNot indentText, float& newLineLeft,
122 float& newLineRight, const LayoutUnit& lineHeight = 0) 122 float& newLineRight, const LayoutUnit& lineHeight = LayoutUnit())
123 { 123 {
124 newLineLeft = block.logicalLeftOffsetForLine(offset, indentText, lineHeight) .toFloat(); 124 newLineLeft = block.logicalLeftOffsetForLine(offset, indentText, lineHeight) .toFloat();
125 newLineRight = block.logicalRightOffsetForLine(offset, indentText, lineHeigh t).toFloat(); 125 newLineRight = block.logicalRightOffsetForLine(offset, indentText, lineHeigh t).toFloat();
126 return std::max(0.0f, newLineRight - newLineLeft); 126 return std::max(0.0f, newLineRight - newLineLeft);
127 } 127 }
128 128
129 void LineWidth::updateLineDimension(LayoutUnit newLineTop, LayoutUnit newLineWid th, const float& newLineLeft, const float& newLineRight) 129 void LineWidth::updateLineDimension(LayoutUnit newLineTop, LayoutUnit newLineWid th, const float& newLineLeft, const float& newLineRight)
130 { 130 {
131 if (newLineWidth <= m_availableWidth) 131 if (newLineWidth <= m_availableWidth)
132 return; 132 return;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 189 }
190 updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLi neRight); 190 updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLi neRight);
191 } 191 }
192 192
193 void LineWidth::computeAvailableWidthFromLeftAndRight() 193 void LineWidth::computeAvailableWidthFromLeftAndRight()
194 { 194 {
195 m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth; 195 m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth;
196 } 196 }
197 197
198 } // namespace blink 198 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/line/EllipsisBox.h ('k') | third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698