1 /*
2  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3  * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
4  *               All right reserved.
5  * Copyright (C) 2010 Google Inc. All rights reserved.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  *
22  */
23 
24 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LINE_LINE_BREAKER_H_
25 #define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LINE_LINE_BREAKER_H_
26 
27 #include "third_party/blink/renderer/core/layout/api/line_layout_block_flow.h"
28 #include "third_party/blink/renderer/core/layout/line/inline_iterator.h"
29 #include "third_party/blink/renderer/core/layout/line/line_info.h"
30 #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
31 #include "third_party/blink/renderer/platform/wtf/vector.h"
32 
33 namespace blink {
34 
35 enum WhitespacePosition { kLeadingWhitespace, kTrailingWhitespace };
36 
37 struct LayoutTextInfo;
38 
39 class LineBreaker {
40   STACK_ALLOCATED();
41 
42  public:
43   friend class BreakingContext;
LineBreaker(LineLayoutBlockFlow block)44   LineBreaker(LineLayoutBlockFlow block) : block_(block) { Reset(); }
45 
46   InlineIterator NextLineBreak(InlineBidiResolver&,
47                                LineInfo&,
48                                LayoutTextInfo&,
49                                WordMeasurements&);
50 
LineWasHyphenated()51   bool LineWasHyphenated() { return hyphenated_; }
PositionedObjects()52   const Vector<LineLayoutBox>& PositionedObjects() {
53     return positioned_objects_;
54   }
Clear()55   EClear Clear() { return clear_; }
56 
57  private:
58   void Reset();
59 
60   void SkipLeadingWhitespace(InlineBidiResolver&, LineInfo&, LineWidth&);
61 
62   LineLayoutBlockFlow block_;
63   bool hyphenated_;
64   EClear clear_;
65   Vector<LineLayoutBox> positioned_objects_;
66 };
67 
68 }  // namespace blink
69 
70 #endif  // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LINE_LINE_BREAKER_H_
71