OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Simon Hausmann <hausmann@kde.org> | 3 * (C) 2000 Simon Hausmann <hausmann@kde.org> |
4 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. | 4 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #ifndef LayoutPart_h | 23 #ifndef LayoutPart_h |
24 #define LayoutPart_h | 24 #define LayoutPart_h |
25 | 25 |
26 #include "core/CoreExport.h" | 26 #include "core/CoreExport.h" |
27 #include "core/layout/LayoutReplaced.h" | 27 #include "core/layout/LayoutReplaced.h" |
| 28 #include "core/plugins/PluginView.h" |
28 #include "platform/FrameViewBase.h" | 29 #include "platform/FrameViewBase.h" |
29 | 30 |
30 namespace blink { | 31 namespace blink { |
31 | 32 |
32 // LayoutObject for frames via LayoutFrame and LayoutIFrame, and plugins via | 33 // LayoutObject for frames via LayoutFrame and LayoutIFrame, and plugins via |
33 // LayoutEmbeddedObject. | 34 // LayoutEmbeddedObject. |
34 class CORE_EXPORT LayoutPart : public LayoutReplaced { | 35 class CORE_EXPORT LayoutPart : public LayoutReplaced { |
35 public: | 36 public: |
36 explicit LayoutPart(Element*); | 37 explicit LayoutPart(Element*); |
37 ~LayoutPart() override; | 38 ~LayoutPart() override; |
38 | 39 |
39 bool requiresAcceleratedCompositing() const; | 40 bool requiresAcceleratedCompositing() const; |
40 | 41 |
41 bool needsPreferredWidthsRecalculation() const final; | 42 bool needsPreferredWidthsRecalculation() const final; |
42 | 43 |
43 bool nodeAtPoint(HitTestResult&, | 44 bool nodeAtPoint(HitTestResult&, |
44 const HitTestLocation& locationInContainer, | 45 const HitTestLocation& locationInContainer, |
45 const LayoutPoint& accumulatedOffset, | 46 const LayoutPoint& accumulatedOffset, |
46 HitTestAction) override; | 47 HitTestAction) override; |
47 | 48 |
48 void ref() { ++m_refCount; } | 49 void ref() { ++m_refCount; } |
49 void deref(); | 50 void deref(); |
50 | 51 |
51 FrameViewBase* frameViewBase() const; | 52 FrameViewBase* frameViewBase() const; |
| 53 PluginView* plugin() const; |
| 54 // TODO(joelhockey): This method will be removed once FrameViewBase |
| 55 // class is removed. New abstract base classes will be defined |
| 56 // for when polymorphism is required for plugins and frames and |
| 57 // other methods provided. |
| 58 FrameViewBase* pluginOrFrame() const; |
52 | 59 |
53 LayoutRect replacedContentRect() const final; | 60 LayoutRect replacedContentRect() const final; |
54 | 61 |
55 void updateOnWidgetChange(); | 62 void updateOnWidgetChange(); |
56 void updateGeometry(); | 63 void updateGeometry(); |
57 | 64 |
58 bool isLayoutPart() const final { return true; } | 65 bool isLayoutPart() const final { return true; } |
59 virtual void paintContents(const PaintInfo&, const LayoutPoint&) const; | 66 virtual void paintContents(const PaintInfo&, const LayoutPoint&) const; |
60 | 67 |
61 bool isThrottledFrameView() const; | 68 bool isThrottledFrameView() const; |
62 | 69 |
63 protected: | 70 protected: |
64 PaintLayerType layerTypeRequired() const override; | 71 PaintLayerType layerTypeRequired() const override; |
65 | 72 |
66 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) final; | 73 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) final; |
67 void layout() override; | 74 void layout() override; |
68 void paint(const PaintInfo&, const LayoutPoint&) const override; | 75 void paint(const PaintInfo&, const LayoutPoint&) const override; |
69 CursorDirective getCursor(const LayoutPoint&, Cursor&) const final; | 76 CursorDirective getCursor(const LayoutPoint&, Cursor&) const final; |
70 | 77 |
71 // Overridden to invalidate the child frame if any. | 78 // Overridden to invalidate the child frame if any. |
72 void invalidatePaintOfSubtreesIfNeeded( | 79 void invalidatePaintOfSubtreesIfNeeded( |
73 const PaintInvalidationState&) override; | 80 const PaintInvalidationState&) override; |
74 | 81 |
75 private: | 82 private: |
76 void updateGeometryInternal(); | 83 void updateGeometryInternal(FrameViewBase&); |
77 CompositingReasons additionalCompositingReasons() const override; | 84 CompositingReasons additionalCompositingReasons() const override; |
78 | 85 |
79 void willBeDestroyed() final; | 86 void willBeDestroyed() final; |
80 void destroy() final; | 87 void destroy() final; |
81 | 88 |
82 bool nodeAtPointOverFrameViewBase(HitTestResult&, | 89 bool nodeAtPointOverFrameViewBase(HitTestResult&, |
83 const HitTestLocation& locationInContainer, | 90 const HitTestLocation& locationInContainer, |
84 const LayoutPoint& accumulatedOffset, | 91 const LayoutPoint& accumulatedOffset, |
85 HitTestAction); | 92 HitTestAction); |
86 | 93 |
87 int m_refCount; | 94 int m_refCount; |
88 }; | 95 }; |
89 | 96 |
90 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutPart, isLayoutPart()); | 97 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutPart, isLayoutPart()); |
91 | 98 |
92 } // namespace blink | 99 } // namespace blink |
93 | 100 |
94 #endif // LayoutPart_h | 101 #endif // LayoutPart_h |
OLD | NEW |