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