diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/RenderSelectionInfo.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/rendering/RenderSelectionInfo.h')
-rw-r--r-- | Source/WebCore/rendering/RenderSelectionInfo.h | 60 |
1 files changed, 16 insertions, 44 deletions
diff --git a/Source/WebCore/rendering/RenderSelectionInfo.h b/Source/WebCore/rendering/RenderSelectionInfo.h index 67365c63f..c88df5c96 100644 --- a/Source/WebCore/rendering/RenderSelectionInfo.h +++ b/Source/WebCore/rendering/RenderSelectionInfo.h @@ -22,58 +22,42 @@ * */ -#ifndef RenderSelectionInfo_h -#define RenderSelectionInfo_h +#pragma once -#include "IntRect.h" -#include "RenderBox.h" +#include "GapRects.h" +#include "RenderBlock.h" +#include "RenderObject.h" namespace WebCore { class RenderSelectionInfoBase { WTF_MAKE_NONCOPYABLE(RenderSelectionInfoBase); WTF_MAKE_FAST_ALLOCATED; public: - RenderSelectionInfoBase() - : m_object(0) - , m_repaintContainer(0) - , m_state(RenderObject::SelectionNone) - { - } - - explicit RenderSelectionInfoBase(RenderObject* o) - : m_object(o) - , m_repaintContainer(o->containerForRepaint()) - , m_state(o->selectionState()) - { - } - - RenderObject* object() const { return m_object; } + explicit RenderSelectionInfoBase(RenderObject& renderer); RenderLayerModelObject* repaintContainer() const { return m_repaintContainer; } RenderObject::SelectionState state() const { return m_state; } protected: - RenderObject* m_object; + void repaintRectangle(const LayoutRect& repaintRect); + + RenderObject& m_renderer; RenderLayerModelObject* m_repaintContainer; + +private: RenderObject::SelectionState m_state; }; // This struct is used when the selection changes to cache the old and new state of the selection for each RenderObject. class RenderSelectionInfo : public RenderSelectionInfoBase { public: - RenderSelectionInfo(RenderObject* o, bool clipToVisibleContent) - : RenderSelectionInfoBase(o) - , m_rect(o->canUpdateSelectionOnRootLineBoxes() ? o->selectionRectForRepaint(m_repaintContainer, clipToVisibleContent) : LayoutRect()) - { - } - - void repaint() - { - m_object->repaintUsingContainer(m_repaintContainer, enclosingIntRect(m_rect)); - } + RenderSelectionInfo(RenderObject& renderer, bool clipToVisibleContent); + void repaint(); + const Vector<LayoutRect>& collectedSelectionRects() const { return m_collectedSelectionRects; } LayoutRect rect() const { return m_rect; } private: + Vector<LayoutRect> m_collectedSelectionRects; // relative to repaint container LayoutRect m_rect; // relative to repaint container }; @@ -81,18 +65,9 @@ private: // This struct is used when the selection changes to cache the old and new state of the selection for each RenderBlock. class RenderBlockSelectionInfo : public RenderSelectionInfoBase { public: - explicit RenderBlockSelectionInfo(RenderBlock* b) - : RenderSelectionInfoBase(b) - , m_rects(b->canUpdateSelectionOnRootLineBoxes() ? block()->selectionGapRectsForRepaint(m_repaintContainer) : GapRects()) - { - } + explicit RenderBlockSelectionInfo(RenderBlock& renderer); - void repaint() - { - m_object->repaintUsingContainer(m_repaintContainer, enclosingIntRect(m_rects)); - } - - RenderBlock* block() const { return toRenderBlock(m_object); } + void repaint(); GapRects rects() const { return m_rects; } private: @@ -100,6 +75,3 @@ private: }; } // namespace WebCore - - -#endif // RenderSelectionInfo_h |