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

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

Issue 1318713003: Make classes and structures in core/layout fast-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 | « Source/core/layout/line/LineLayoutState.h ('k') | Source/core/layout/line/TrailingObjects.h » ('j') | 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 14 matching lines...) Expand all
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 * OF THE POSSIBILITY OF SUCH DAMAGE. 27 * OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #ifndef LineWidth_h 30 #ifndef LineWidth_h
31 #define LineWidth_h 31 #define LineWidth_h
32 32
33 #include "core/layout/api/LineLayoutBlockFlow.h" 33 #include "core/layout/api/LineLayoutBlockFlow.h"
34 #include "platform/LayoutUnit.h" 34 #include "platform/LayoutUnit.h"
35 #include "wtf/Allocator.h"
35 36
36 namespace blink { 37 namespace blink {
37 38
38 class FloatingObject; 39 class FloatingObject;
39 class LineLayoutRubyRun; 40 class LineLayoutRubyRun;
40 41
41 enum IndentTextOrNot { DoNotIndentText, IndentText }; 42 enum IndentTextOrNot { DoNotIndentText, IndentText };
42 enum WhitespaceTreatment { ExcludeWhitespace, IncludeWhitespace }; 43 enum WhitespaceTreatment { ExcludeWhitespace, IncludeWhitespace };
43 44
44 class LineWidth { 45 class LineWidth {
46 STACK_ALLOCATED();
45 public: 47 public:
46 LineWidth(LineLayoutBlockFlow, bool isFirstLine, IndentTextOrNot shouldInden tText); 48 LineWidth(LineLayoutBlockFlow, bool isFirstLine, IndentTextOrNot shouldInden tText);
47 49
48 bool fitsOnLine() const { return currentWidth() <= (m_availableWidth + Layou tUnit::epsilon()); } 50 bool fitsOnLine() const { return currentWidth() <= (m_availableWidth + Layou tUnit::epsilon()); }
49 bool fitsOnLine(float extra) const { return currentWidth() + extra <= (m_ava ilableWidth + LayoutUnit::epsilon()); } 51 bool fitsOnLine(float extra) const { return currentWidth() + extra <= (m_ava ilableWidth + LayoutUnit::epsilon()); }
50 bool fitsOnLine(float extra, WhitespaceTreatment whitespaceTreatment) const 52 bool fitsOnLine(float extra, WhitespaceTreatment whitespaceTreatment) const
51 { 53 {
52 return currentWidth() - (whitespaceTreatment == ExcludeWhitespace ? trai lingWhitespaceWidth() : 0) + extra <= (m_availableWidth + LayoutUnit::epsilon()) ; 54 return currentWidth() - (whitespaceTreatment == ExcludeWhitespace ? trai lingWhitespaceWidth() : 0) + extra <= (m_availableWidth + LayoutUnit::epsilon()) ;
53 } 55 }
54 56
(...skipping 27 matching lines...) Expand all
82 float m_left; 84 float m_left;
83 float m_right; 85 float m_right;
84 float m_availableWidth; 86 float m_availableWidth;
85 bool m_isFirstLine; 87 bool m_isFirstLine;
86 IndentTextOrNot m_shouldIndentText; 88 IndentTextOrNot m_shouldIndentText;
87 }; 89 };
88 90
89 } 91 }
90 92
91 #endif // LineWidth_h 93 #endif // LineWidth_h
OLDNEW
« no previous file with comments | « Source/core/layout/line/LineLayoutState.h ('k') | Source/core/layout/line/TrailingObjects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698