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

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

Issue 2725933002: Fix LayoutUnit snapping of widths in line breaker (Closed)
Patch Set: Add test cases for m_uncommittedWidth and !m_uncommittedWidth Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h ('k') | no next file » | 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) 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 void shrinkAvailableWidthForNewFloatIfNeeded(const FloatingObject&); 80 void shrinkAvailableWidthForNewFloatIfNeeded(const FloatingObject&);
81 void addUncommittedWidth(float delta) { m_uncommittedWidth += delta; } 81 void addUncommittedWidth(float delta) { m_uncommittedWidth += delta; }
82 void commit(); 82 void commit();
83 void applyOverhang(LineLayoutRubyRun, 83 void applyOverhang(LineLayoutRubyRun,
84 LineLayoutItem startLayoutItem, 84 LineLayoutItem startLayoutItem,
85 LineLayoutItem endLayoutItem); 85 LineLayoutItem endLayoutItem);
86 void fitBelowFloats(bool isFirstLine = false); 86 void fitBelowFloats(bool isFirstLine = false);
87 void setTrailingWhitespaceWidth(float width) { 87 void setTrailingWhitespaceWidth(float width) {
88 m_trailingWhitespaceWidth = width; 88 m_trailingWhitespaceWidth = width;
89 } 89 }
90 void snapUncommittedWidth() { 90 void snapAtNodeBoundary() {
91 m_uncommittedWidth = 91 if (!m_uncommittedWidth) {
92 LayoutUnit::fromFloatCeil(m_uncommittedWidth).toFloat(); 92 m_committedWidth = LayoutUnit::fromFloatCeil(m_committedWidth).toFloat();
93 } else {
94 m_uncommittedWidth =
95 LayoutUnit::fromFloatCeil(m_committedWidth + m_uncommittedWidth)
96 .toFloat() -
97 m_committedWidth;
98 }
93 } 99 }
94 100
95 IndentTextOrNot indentText() const { return m_indentText; } 101 IndentTextOrNot indentText() const { return m_indentText; }
96 102
97 private: 103 private:
98 void computeAvailableWidthFromLeftAndRight(); 104 void computeAvailableWidthFromLeftAndRight();
99 void updateLineDimension(LayoutUnit newLineTop, 105 void updateLineDimension(LayoutUnit newLineTop,
100 LayoutUnit newLineWidth, 106 LayoutUnit newLineWidth,
101 const LayoutUnit& newLineLeft, 107 const LayoutUnit& newLineLeft,
102 const LayoutUnit& newLineRight); 108 const LayoutUnit& newLineRight);
103 void wrapNextToShapeOutside(bool isFirstLine); 109 void wrapNextToShapeOutside(bool isFirstLine);
104 110
105 LineLayoutBlockFlow m_block; 111 LineLayoutBlockFlow m_block;
106 float m_uncommittedWidth; 112 float m_uncommittedWidth;
107 float m_committedWidth; 113 float m_committedWidth;
108 // The amount by which |m_availableWidth| has been inflated to account for 114 // The amount by which |m_availableWidth| has been inflated to account for
109 // possible contraction due to ruby overhang. 115 // possible contraction due to ruby overhang.
110 float m_overhangWidth; 116 float m_overhangWidth;
111 float m_trailingWhitespaceWidth; 117 float m_trailingWhitespaceWidth;
112 LayoutUnit m_left; 118 LayoutUnit m_left;
113 LayoutUnit m_right; 119 LayoutUnit m_right;
114 LayoutUnit m_availableWidth; 120 LayoutUnit m_availableWidth;
115 bool m_isFirstLine; 121 bool m_isFirstLine;
116 IndentTextOrNot m_indentText; 122 IndentTextOrNot m_indentText;
117 }; 123 };
118 124
119 } // namespace blink 125 } // namespace blink
120 126
121 #endif // LineWidth_h 127 #endif // LineWidth_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698