OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Nokia Inc. All rights reserved. | 2 * Copyright (C) 2011 Nokia Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 * | 5 * |
5 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
9 * | 10 * |
10 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 14 * Library General Public License for more details. |
14 * | 15 * |
15 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
19 * | 20 * |
20 */ | 21 */ |
21 | 22 |
22 #ifndef RenderQuote_h | 23 #ifndef RenderQuote_h |
23 #define RenderQuote_h | 24 #define RenderQuote_h |
24 | 25 |
25 #include "core/rendering/RenderText.h" | 26 #include "core/rendering/RenderText.h" |
26 #include "core/rendering/style/QuotesData.h" | |
27 #include "core/rendering/style/RenderStyle.h" | |
28 #include "core/rendering/style/RenderStyleConstants.h" | |
29 | 27 |
30 namespace WebCore { | 28 namespace WebCore { |
31 | 29 |
32 class Document; | |
33 | |
34 class RenderQuote FINAL : public RenderText { | 30 class RenderQuote FINAL : public RenderText { |
35 public: | 31 public: |
36 RenderQuote(Document*, const QuoteType); | 32 RenderQuote(Document*, QuoteType); |
37 virtual ~RenderQuote(); | 33 virtual ~RenderQuote(); |
38 void attachQuote(); | 34 void attachQuote(); |
39 | 35 |
40 private: | 36 private: |
41 void detachQuote(); | 37 void detachQuote(); |
42 | 38 |
43 virtual void willBeDestroyed() OVERRIDE; | 39 virtual void willBeDestroyed() OVERRIDE; |
44 virtual const char* renderName() const OVERRIDE { return "RenderQuote"; }; | 40 virtual const char* renderName() const OVERRIDE { return "RenderQuote"; } |
45 virtual bool isQuote() const OVERRIDE { return true; }; | 41 virtual bool isQuote() const OVERRIDE { return true; }; |
46 virtual PassRefPtr<StringImpl> originalText() const OVERRIDE; | 42 virtual PassRefPtr<StringImpl> originalText() const OVERRIDE; |
47 virtual void styleDidChange(StyleDifference, const RenderStyle*) OVERRIDE; | 43 virtual void styleDidChange(StyleDifference, const RenderStyle*) OVERRIDE; |
48 virtual void willBeRemovedFromTree() OVERRIDE; | 44 virtual void willBeRemovedFromTree() OVERRIDE; |
49 | 45 |
50 const QuotesData* quotesData() const; | |
51 void updateDepth(); | 46 void updateDepth(); |
52 bool isAttached() { return m_attached; } | |
53 | 47 |
54 QuoteType m_type; | 48 QuoteType m_type; |
55 int m_depth; | 49 int m_depth; |
56 RenderQuote* m_next; | 50 RenderQuote* m_next; |
57 RenderQuote* m_previous; | 51 RenderQuote* m_previous; |
58 bool m_attached; | 52 bool m_isAttached; |
59 }; | 53 }; |
60 | 54 |
61 inline RenderQuote* toRenderQuote(RenderObject* object) | 55 inline RenderQuote* toRenderQuote(RenderObject* object) |
62 { | 56 { |
63 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isQuote()); | 57 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isQuote()); |
64 return static_cast<RenderQuote*>(object); | 58 return static_cast<RenderQuote*>(object); |
65 } | 59 } |
66 | 60 |
67 // This will catch anyone doing an unnecessary cast. | 61 // This will catch anyone doing an unnecessary cast. |
68 void toRenderQuote(const RenderQuote*); | 62 void toRenderQuote(const RenderQuote*); |
69 | 63 |
70 } // namespace WebCore | 64 } // namespace WebCore |
71 | 65 |
72 #endif // RenderQuote_h | 66 #endif // RenderQuote_h |
OLD | NEW |