RenderBR.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Library General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Library General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Library General Public License
  15. * along with this library; see the file COPYING.LIB. If not, write to
  16. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. *
  19. */
  20. #ifndef RenderBR_h
  21. #define RenderBR_h
  22. #include "RenderText.h"
  23. /*
  24. * The whole class here is a hack to get <br> working, as long as we don't have support for
  25. * CSS2 :before and :after pseudo elements
  26. */
  27. namespace WebCore {
  28. class Position;
  29. class RenderBR : public RenderText {
  30. public:
  31. explicit RenderBR(Node*);
  32. virtual ~RenderBR();
  33. virtual const char* renderName() const { return "RenderBR"; }
  34. virtual LayoutRect selectionRectForRepaint(const RenderLayerModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/) OVERRIDE { return LayoutRect(); }
  35. virtual float width(unsigned /*from*/, unsigned /*len*/, const Font&, float /*xPos*/, HashSet<const SimpleFontData*>* = 0 /*fallbackFonts*/ , GlyphOverflow* = 0) const { return 0; }
  36. virtual float width(unsigned /*from*/, unsigned /*len*/, float /*xpos*/, bool = false /*firstLine*/, HashSet<const SimpleFontData*>* = 0 /*fallbackFonts*/, GlyphOverflow* = 0) const { return 0; }
  37. int lineHeight(bool firstLine) const;
  38. // overrides
  39. virtual bool isBR() const { return true; }
  40. virtual int caretMinOffset() const;
  41. virtual int caretMaxOffset() const;
  42. virtual VisiblePosition positionForPoint(const LayoutPoint&);
  43. protected:
  44. virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
  45. private:
  46. mutable int m_lineHeight;
  47. };
  48. inline RenderBR* toRenderBR(RenderObject* object)
  49. {
  50. ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isBR());
  51. return static_cast<RenderBR*>(object);
  52. }
  53. inline const RenderBR* toRenderBR(const RenderObject* object)
  54. {
  55. ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isBR());
  56. return static_cast<const RenderBR*>(object);
  57. }
  58. // This will catch anyone doing an unnecessary cast.
  59. void toRenderBR(const RenderBR*);
  60. } // namespace WebCore
  61. #endif // RenderBR_h