1 | /** |
2 | * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 | * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 | * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. |
5 | * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
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 | #include "config.h" |
25 | #include "BidiRun.h" |
26 | #include "InlineBox.h" |
27 | #include <wtf/RefCountedLeakCounter.h> |
28 | #include <wtf/StdLibExtras.h> |
29 | |
30 | namespace WebCore { |
31 | |
32 | DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, bidiRunCounter, ("BidiRun" )); |
33 | |
34 | BidiRun::BidiRun(unsigned start, unsigned stop, RenderObject& renderer, BidiContext* context, UCharDirection dir) |
35 | : BidiCharacterRun(start, stop, context, dir) |
36 | , m_renderer(renderer) |
37 | , m_box(nullptr) |
38 | { |
39 | #ifndef NDEBUG |
40 | bidiRunCounter.increment(); |
41 | #endif |
42 | ASSERT(!is<RenderText>(m_renderer) || static_cast<unsigned>(stop) <= downcast<RenderText>(m_renderer).text().length()); |
43 | // Stored in base class to save space. |
44 | m_hasHyphen = false; |
45 | } |
46 | |
47 | BidiRun::~BidiRun() |
48 | { |
49 | #ifndef NDEBUG |
50 | bidiRunCounter.decrement(); |
51 | #endif |
52 | } |
53 | |
54 | std::unique_ptr<BidiRun> BidiRun::takeNext() |
55 | { |
56 | std::unique_ptr<BidiCharacterRun> next = BidiCharacterRun::takeNext(); |
57 | BidiCharacterRun* raw = next.release(); |
58 | std::unique_ptr<BidiRun> result = std::unique_ptr<BidiRun>(static_cast<BidiRun*>(raw)); |
59 | return result; |
60 | } |
61 | |
62 | } |
63 | |