| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | |
| 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | |
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | |
| 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | |
| 7 * | |
| 8 * This library is free software; you can redistribute it and/or | |
| 9 * modify it under the terms of the GNU Library General Public | |
| 10 * License as published by the Free Software Foundation; either | |
| 11 * version 2 of the License, or (at your option) any later version. | |
| 12 * | |
| 13 * This library is distributed in the hope that it will be useful, | |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 16 * Library General Public License for more details. | |
| 17 * | |
| 18 * You should have received a copy of the GNU Library General Public License | |
| 19 * along with this library; see the file COPYING.LIB. If not, write to | |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
| 21 * Boston, MA 02110-1301, USA. | |
| 22 * | |
| 23 */ | |
| 24 | |
| 25 #ifndef SKY_ENGINE_CORE_RENDERING_RENDERSELECTIONINFO_H_ | |
| 26 #define SKY_ENGINE_CORE_RENDERING_RENDERSELECTIONINFO_H_ | |
| 27 | |
| 28 #include "sky/engine/core/rendering/RenderBox.h" | |
| 29 #include "sky/engine/platform/geometry/IntRect.h" | |
| 30 | |
| 31 namespace blink { | |
| 32 | |
| 33 class RenderSelectionInfoBase { | |
| 34 WTF_MAKE_NONCOPYABLE(RenderSelectionInfoBase); WTF_MAKE_FAST_ALLOCATED; | |
| 35 public: | |
| 36 RenderSelectionInfoBase() | |
| 37 : m_object(nullptr) | |
| 38 , m_paintInvalidationContainer(nullptr) | |
| 39 , m_state(RenderObject::SelectionNone) | |
| 40 { | |
| 41 } | |
| 42 | |
| 43 RenderSelectionInfoBase(RenderObject* o) | |
| 44 : m_object(o) | |
| 45 , m_paintInvalidationContainer(o->containerForPaintInvalidation()) | |
| 46 , m_state(o->selectionState()) | |
| 47 { | |
| 48 } | |
| 49 | |
| 50 RenderObject* object() const { return m_object; } | |
| 51 const RenderLayerModelObject* paintInvalidationContainer() const { return m_
paintInvalidationContainer; } | |
| 52 RenderObject::SelectionState state() const { return m_state; } | |
| 53 | |
| 54 protected: | |
| 55 RawPtr<RenderObject> m_object; | |
| 56 RawPtr<const RenderLayerModelObject> m_paintInvalidationContainer; | |
| 57 RenderObject::SelectionState m_state; | |
| 58 }; | |
| 59 | |
| 60 // FIXME(sky): Remove this class. | |
| 61 // This struct is used when the selection changes to cache the old and new state
of the selection for each RenderObject. | |
| 62 class RenderSelectionInfo final : public RenderSelectionInfoBase { | |
| 63 public: | |
| 64 RenderSelectionInfo(RenderObject* o, bool clipToVisibleContent) | |
| 65 : RenderSelectionInfoBase(o) | |
| 66 { | |
| 67 if (o->canUpdateSelectionOnRootLineBoxes()) { | |
| 68 m_rect = o->selectionRectForPaintInvalidation(m_paintInvalidationCon
tainer, clipToVisibleContent); | |
| 69 } else { | |
| 70 m_rect = LayoutRect(); | |
| 71 } | |
| 72 } | |
| 73 | |
| 74 void invalidatePaint() | |
| 75 { | |
| 76 } | |
| 77 | |
| 78 LayoutRect rect() const { return m_rect; } | |
| 79 | |
| 80 private: | |
| 81 LayoutRect m_rect; // relative to paint invalidation container | |
| 82 }; | |
| 83 | |
| 84 // FIXME(sky): Remove this class. | |
| 85 // This struct is used when the selection changes to cache the old and new state
of the selection for each RenderBlock. | |
| 86 class RenderBlockSelectionInfo final : public RenderSelectionInfoBase { | |
| 87 public: | |
| 88 RenderBlockSelectionInfo(RenderBlock* b) | |
| 89 : RenderSelectionInfoBase(b) | |
| 90 { | |
| 91 if (b->canUpdateSelectionOnRootLineBoxes()) | |
| 92 m_rects = block()->selectionGapRectsForPaintInvalidation(m_paintInva
lidationContainer); | |
| 93 else | |
| 94 m_rects = GapRects(); | |
| 95 } | |
| 96 | |
| 97 void invalidatePaint() | |
| 98 { | |
| 99 } | |
| 100 | |
| 101 RenderBlock* block() const { return toRenderBlock(m_object); } | |
| 102 GapRects rects() const { return m_rects; } | |
| 103 | |
| 104 private: | |
| 105 GapRects m_rects; // relative to paint invalidation container | |
| 106 }; | |
| 107 | |
| 108 } // namespace blink | |
| 109 | |
| 110 | |
| 111 #endif // SKY_ENGINE_CORE_RENDERING_RENDERSELECTIONINFO_H_ | |
| OLD | NEW |