| 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" | |
| 29 #include "platform/FrameViewBase.h" | |
| 30 | 28 |
| 31 namespace blink { | 29 namespace blink { |
| 32 | 30 |
| 31 class FrameOrPlugin; |
| 32 class FrameViewBase; |
| 33 class PluginView; |
| 34 |
| 33 // LayoutObject for frames via LayoutFrame and LayoutIFrame, and plugins via | 35 // LayoutObject for frames via LayoutFrame and LayoutIFrame, and plugins via |
| 34 // LayoutEmbeddedObject. | 36 // LayoutEmbeddedObject. |
| 35 class CORE_EXPORT LayoutPart : public LayoutReplaced { | 37 class CORE_EXPORT LayoutPart : public LayoutReplaced { |
| 36 public: | 38 public: |
| 37 explicit LayoutPart(Element*); | 39 explicit LayoutPart(Element*); |
| 38 ~LayoutPart() override; | 40 ~LayoutPart() override; |
| 39 | 41 |
| 40 bool RequiresAcceleratedCompositing() const; | 42 bool RequiresAcceleratedCompositing() const; |
| 41 | 43 |
| 42 bool NeedsPreferredWidthsRecalculation() const final; | 44 bool NeedsPreferredWidthsRecalculation() const final; |
| 43 | 45 |
| 44 bool NodeAtPoint(HitTestResult&, | 46 bool NodeAtPoint(HitTestResult&, |
| 45 const HitTestLocation& location_in_container, | 47 const HitTestLocation& location_in_container, |
| 46 const LayoutPoint& accumulated_offset, | 48 const LayoutPoint& accumulated_offset, |
| 47 HitTestAction) override; | 49 HitTestAction) override; |
| 48 | 50 |
| 49 void Ref() { ++ref_count_; } | 51 void Ref() { ++ref_count_; } |
| 50 void Deref(); | 52 void Deref(); |
| 51 | 53 |
| 52 FrameViewBase* GetFrameViewBase() const; | 54 FrameViewBase* GetFrameViewBase() const; |
| 53 PluginView* Plugin() const; | 55 PluginView* Plugin() const; |
| 54 // TODO(joelhockey): This method will be removed once FrameViewBase | 56 FrameOrPlugin* GetFrameOrPlugin() const; |
| 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; | |
| 59 | 57 |
| 60 LayoutRect ReplacedContentRect() const final; | 58 LayoutRect ReplacedContentRect() const final; |
| 61 | 59 |
| 62 void UpdateOnWidgetChange(); | 60 void UpdateOnWidgetChange(); |
| 63 void UpdateGeometry(); | 61 void UpdateGeometry(); |
| 64 | 62 |
| 65 bool IsLayoutPart() const final { return true; } | 63 bool IsLayoutPart() const final { return true; } |
| 66 virtual void PaintContents(const PaintInfo&, const LayoutPoint&) const; | 64 virtual void PaintContents(const PaintInfo&, const LayoutPoint&) const; |
| 67 | 65 |
| 68 bool IsThrottledFrameView() const; | 66 bool IsThrottledFrameView() const; |
| 69 | 67 |
| 70 protected: | 68 protected: |
| 71 PaintLayerType LayerTypeRequired() const override; | 69 PaintLayerType LayerTypeRequired() const override; |
| 72 | 70 |
| 73 void StyleDidChange(StyleDifference, const ComputedStyle* old_style) final; | 71 void StyleDidChange(StyleDifference, const ComputedStyle* old_style) final; |
| 74 void GetLayout() override; | 72 void GetLayout() override; |
| 75 void Paint(const PaintInfo&, const LayoutPoint&) const override; | 73 void Paint(const PaintInfo&, const LayoutPoint&) const override; |
| 76 CursorDirective GetCursor(const LayoutPoint&, Cursor&) const final; | 74 CursorDirective GetCursor(const LayoutPoint&, Cursor&) const final; |
| 77 | 75 |
| 78 // Overridden to invalidate the child frame if any. | 76 // Overridden to invalidate the child frame if any. |
| 79 void InvalidatePaintOfSubtreesIfNeeded( | 77 void InvalidatePaintOfSubtreesIfNeeded( |
| 80 const PaintInvalidationState&) override; | 78 const PaintInvalidationState&) override; |
| 81 | 79 |
| 82 private: | 80 private: |
| 83 void UpdateGeometryInternal(FrameViewBase&); | 81 void UpdateGeometryInternal(FrameOrPlugin&); |
| 84 CompositingReasons AdditionalCompositingReasons() const override; | 82 CompositingReasons AdditionalCompositingReasons() const override; |
| 85 | 83 |
| 86 void WillBeDestroyed() final; | 84 void WillBeDestroyed() final; |
| 87 void Destroy() final; | 85 void Destroy() final; |
| 88 | 86 |
| 89 bool NodeAtPointOverFrameViewBase( | 87 bool NodeAtPointOverFrameViewBase( |
| 90 HitTestResult&, | 88 HitTestResult&, |
| 91 const HitTestLocation& location_in_container, | 89 const HitTestLocation& location_in_container, |
| 92 const LayoutPoint& accumulated_offset, | 90 const LayoutPoint& accumulated_offset, |
| 93 HitTestAction); | 91 HitTestAction); |
| 94 | 92 |
| 95 int ref_count_; | 93 int ref_count_; |
| 96 }; | 94 }; |
| 97 | 95 |
| 98 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutPart, IsLayoutPart()); | 96 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutPart, IsLayoutPart()); |
| 99 | 97 |
| 100 } // namespace blink | 98 } // namespace blink |
| 101 | 99 |
| 102 #endif // LayoutPart_h | 100 #endif // LayoutPart_h |
| OLD | NEW |