| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 #include "core/CoreExport.h" | 25 #include "core/CoreExport.h" |
| 26 #include "core/layout/LayoutBox.h" | 26 #include "core/layout/LayoutBox.h" |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 class CORE_EXPORT LayoutReplaced : public LayoutBox { | 30 class CORE_EXPORT LayoutReplaced : public LayoutBox { |
| 31 public: | 31 public: |
| 32 LayoutReplaced(Element*); | 32 LayoutReplaced(Element*); |
| 33 LayoutReplaced(Element*, const LayoutSize& intrinsicSize); | 33 LayoutReplaced(Element*, const LayoutSize& intrinsicSize); |
| 34 virtual ~LayoutReplaced(); | 34 ~LayoutReplaced() override; |
| 35 | 35 |
| 36 virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = Com
puteActual) const override; | 36 LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActu
al) const override; |
| 37 virtual LayoutUnit computeReplacedLogicalHeight() const override; | 37 LayoutUnit computeReplacedLogicalHeight() const override; |
| 38 | 38 |
| 39 bool hasReplacedLogicalHeight() const; | 39 bool hasReplacedLogicalHeight() const; |
| 40 LayoutRect replacedContentRect(const LayoutSize* overriddenIntrinsicSize = n
ullptr) const; | 40 LayoutRect replacedContentRect(const LayoutSize* overriddenIntrinsicSize = n
ullptr) const; |
| 41 | 41 |
| 42 virtual bool needsPreferredWidthsRecalculation() const override; | 42 bool needsPreferredWidthsRecalculation() const override; |
| 43 | 43 |
| 44 // These values are specified to be 300 and 150 pixels in the CSS 2.1 spec. | 44 // These values are specified to be 300 and 150 pixels in the CSS 2.1 spec. |
| 45 // http://www.w3.org/TR/CSS2/visudet.html#inline-replaced-width | 45 // http://www.w3.org/TR/CSS2/visudet.html#inline-replaced-width |
| 46 static const int defaultWidth; | 46 static const int defaultWidth; |
| 47 static const int defaultHeight; | 47 static const int defaultHeight; |
| 48 virtual bool canHaveChildren() const override { return false; } | 48 bool canHaveChildren() const override { return false; } |
| 49 bool shouldPaint(const PaintInfo&, const LayoutPoint&) const; | 49 bool shouldPaint(const PaintInfo&, const LayoutPoint&) const; |
| 50 virtual void paintReplaced(const PaintInfo&, const LayoutPoint&) { } | 50 virtual void paintReplaced(const PaintInfo&, const LayoutPoint&) { } |
| 51 LayoutRect localSelectionRect(bool checkWhetherSelected = true) const; // Th
is is in local coordinates, but it's a physical rect (so the top left corner is
physical top left). | 51 LayoutRect localSelectionRect(bool checkWhetherSelected = true) const; // Th
is is in local coordinates, but it's a physical rect (so the top left corner is
physical top left). |
| 52 | 52 |
| 53 virtual void paint(const PaintInfo&, const LayoutPoint&) override; | 53 void paint(const PaintInfo&, const LayoutPoint&) override; |
| 54 | 54 |
| 55 bool isSelected() const; | 55 bool isSelected() const; |
| 56 | 56 |
| 57 protected: | 57 protected: |
| 58 virtual void willBeDestroyed() override; | 58 void willBeDestroyed() override; |
| 59 | 59 |
| 60 virtual void layout() override; | 60 void layout() override; |
| 61 | 61 |
| 62 virtual LayoutSize intrinsicSize() const override final { return m_intrinsic
Size; } | 62 LayoutSize intrinsicSize() const final { return m_intrinsicSize; } |
| 63 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub
le& intrinsicRatio) const override; | 63 void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intr
insicRatio) const override; |
| 64 | 64 |
| 65 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
utUnit& maxLogicalWidth) const override final; | 65 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit&
maxLogicalWidth) const final; |
| 66 | 66 |
| 67 virtual LayoutUnit intrinsicContentLogicalHeight() const { return intrinsicL
ogicalHeight(); } | 67 virtual LayoutUnit intrinsicContentLogicalHeight() const { return intrinsicL
ogicalHeight(); } |
| 68 | 68 |
| 69 virtual LayoutUnit minimumReplacedHeight() const { return LayoutUnit(); } | 69 virtual LayoutUnit minimumReplacedHeight() const { return LayoutUnit(); } |
| 70 | 70 |
| 71 virtual void setSelectionState(SelectionState) override final; | 71 void setSelectionState(SelectionState) final; |
| 72 | 72 |
| 73 virtual void styleDidChange(StyleDifference, const ComputedStyle* oldStyle)
override; | 73 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override
; |
| 74 | 74 |
| 75 void setIntrinsicSize(const LayoutSize& intrinsicSize) { m_intrinsicSize = i
ntrinsicSize; } | 75 void setIntrinsicSize(const LayoutSize& intrinsicSize) { m_intrinsicSize = i
ntrinsicSize; } |
| 76 virtual void intrinsicSizeChanged(); | 76 virtual void intrinsicSizeChanged(); |
| 77 | 77 |
| 78 virtual LayoutBox* embeddedContentBox() const { return nullptr; } | 78 virtual LayoutBox* embeddedContentBox() const { return nullptr; } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 virtual void computePreferredLogicalWidths() override final; | 81 void computePreferredLogicalWidths() final; |
| 82 | 82 |
| 83 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxMo
delObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr)
const override; | 83 LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObjec
t* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const ov
erride; |
| 84 | 84 |
| 85 virtual PositionWithAffinity positionForPoint(const LayoutPoint&) override f
inal; | 85 PositionWithAffinity positionForPoint(const LayoutPoint&) final; |
| 86 | 86 |
| 87 virtual bool canBeSelectionLeaf() const override { return true; } | 87 bool canBeSelectionLeaf() const override { return true; } |
| 88 | 88 |
| 89 virtual LayoutRect selectionRectForPaintInvalidation(const LayoutBoxModelObj
ect* paintInvalidationContainer) const override final; | 89 LayoutRect selectionRectForPaintInvalidation(const LayoutBoxModelObject* pai
ntInvalidationContainer) const final; |
| 90 void computeAspectRatioInformationForLayoutBox(LayoutBox*, FloatSize& constr
ainedSize, double& intrinsicRatio) const; | 90 void computeAspectRatioInformationForLayoutBox(LayoutBox*, FloatSize& constr
ainedSize, double& intrinsicRatio) const; |
| 91 | 91 |
| 92 mutable LayoutSize m_intrinsicSize; | 92 mutable LayoutSize m_intrinsicSize; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 } | 95 } |
| 96 | 96 |
| 97 #endif | 97 #endif |
| OLD | NEW |