| 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 RenderSelectionInfo_h | |
| 26 #define RenderSelectionInfo_h | |
| 27 | |
| 28 #include "core/rendering/RenderBox.h" | |
| 29 #include "platform/geometry/IntRect.h" | |
| 30 | |
| 31 namespace blink { | |
| 32 | |
| 33 class RenderSelectionInfoBase : public NoBaseWillBeGarbageCollected<RenderSelect
ionInfoBase> { | |
| 34 WTF_MAKE_NONCOPYABLE(RenderSelectionInfoBase); WTF_MAKE_FAST_ALLOCATED_WILL_
BE_REMOVED; | |
| 35 public: | |
| 36 RenderSelectionInfoBase(RenderObject* o) | |
| 37 : m_object(o) | |
| 38 , m_paintInvalidationContainer(o->isRooted() ? o->containerForPaintInval
idation() : nullptr) | |
| 39 , m_state(o->selectionState()) | |
| 40 { | |
| 41 } | |
| 42 | |
| 43 void trace(Visitor* visitor) | |
| 44 { | |
| 45 visitor->trace(m_object); | |
| 46 visitor->trace(m_paintInvalidationContainer); | |
| 47 } | |
| 48 | |
| 49 RenderObject* object() const { return m_object.get(); } | |
| 50 | |
| 51 protected: | |
| 52 RawPtrWillBeMember<RenderObject> m_object; | |
| 53 RawPtrWillBeMember<const RenderLayerModelObject> m_paintInvalidationContaine
r; | |
| 54 RenderObject::SelectionState m_state; | |
| 55 }; | |
| 56 | |
| 57 // This struct is used when the selection changes to cache the old and new state
of the selection for each RenderObject. | |
| 58 class RenderSelectionInfo final : public RenderSelectionInfoBase { | |
| 59 public: | |
| 60 RenderSelectionInfo(RenderObject* o) | |
| 61 : RenderSelectionInfoBase(o) | |
| 62 { | |
| 63 if (m_paintInvalidationContainer && o->canUpdateSelectionOnRootLineBoxes
()) { | |
| 64 m_rect = o->selectionRectForPaintInvalidation(m_paintInvalidationCon
tainer); | |
| 65 // FIXME: groupedMapping() leaks the squashing abstraction. See Rend
erBlockSelectionInfo for more details. | |
| 66 if (m_paintInvalidationContainer->layer()->groupedMapping()) | |
| 67 RenderLayer::mapRectToPaintBackingCoordinates(m_paintInvalidatio
nContainer, m_rect); | |
| 68 } else { | |
| 69 m_rect = LayoutRect(); | |
| 70 } | |
| 71 } | |
| 72 | |
| 73 LayoutRect absoluteSelectionRect() const | |
| 74 { | |
| 75 if (!m_paintInvalidationContainer) | |
| 76 return LayoutRect(); | |
| 77 | |
| 78 FloatQuad absQuad = m_paintInvalidationContainer->localToAbsoluteQuad(Fl
oatRect(m_rect)); | |
| 79 return absQuad.enclosingBoundingBox(); | |
| 80 } | |
| 81 | |
| 82 private: | |
| 83 LayoutRect m_rect; // relative to paint invalidation container | |
| 84 }; | |
| 85 | |
| 86 } // namespace blink | |
| 87 | |
| 88 | |
| 89 #endif // RenderSelectionInfo_h | |
| OLD | NEW |