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