OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 | 662 |
663 // "Box decoration background" includes all box decorations and backgrounds | 663 // "Box decoration background" includes all box decorations and backgrounds |
664 // that are painted as the background of the object. It includes borders, | 664 // that are painted as the background of the object. It includes borders, |
665 // box-shadows, background-color and background-image, etc. | 665 // box-shadows, background-color and background-image, etc. |
666 enum BoxDecorationBackgroundState { | 666 enum BoxDecorationBackgroundState { |
667 NoBoxDecorationBackground, | 667 NoBoxDecorationBackground, |
668 HasBoxDecorationBackgroundObscurationStatusInvalid, | 668 HasBoxDecorationBackgroundObscurationStatusInvalid, |
669 HasBoxDecorationBackgroundKnownToBeObscured, | 669 HasBoxDecorationBackgroundKnownToBeObscured, |
670 HasBoxDecorationBackgroundMayBeVisible, | 670 HasBoxDecorationBackgroundMayBeVisible, |
671 }; | 671 }; |
672 bool hasBoxDecorationBackground() const { return m_bitfields.boxDecorationBa
ckgroundState() != NoBoxDecorationBackground; } | 672 bool hasBoxDecorationBackground() const { return m_bitfields.getBoxDecoratio
nBackgroundState() != NoBoxDecorationBackground; } |
673 bool boxDecorationBackgroundIsKnownToBeObscured() const; | 673 bool boxDecorationBackgroundIsKnownToBeObscured() const; |
674 bool mustInvalidateFillLayersPaintOnHeightChange(const FillLayer&) const; | 674 bool mustInvalidateFillLayersPaintOnHeightChange(const FillLayer&) const; |
675 bool hasBackground() const { return style()->hasBackground(); } | 675 bool hasBackground() const { return style()->hasBackground(); } |
676 | 676 |
677 bool needsLayoutBecauseOfChildren() const { return needsLayout() && !selfNee
dsLayout() && !needsPositionedMovementLayout() && !needsSimplifiedNormalFlowLayo
ut(); } | 677 bool needsLayoutBecauseOfChildren() const { return needsLayout() && !selfNee
dsLayout() && !needsPositionedMovementLayout() && !needsSimplifiedNormalFlowLayo
ut(); } |
678 | 678 |
679 bool needsLayout() const | 679 bool needsLayout() const |
680 { | 680 { |
681 return m_bitfields.selfNeedsLayout() || m_bitfields.normalChildNeedsLayo
ut() || m_bitfields.posChildNeedsLayout() | 681 return m_bitfields.selfNeedsLayout() || m_bitfields.normalChildNeedsLayo
ut() || m_bitfields.posChildNeedsLayout() |
682 || m_bitfields.needsSimplifiedNormalFlowLayout() || m_bitfields.need
sPositionedMovementLayout(); | 682 || m_bitfields.needsSimplifiedNormalFlowLayout() || m_bitfields.need
sPositionedMovementLayout(); |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 | 1121 |
1122 bool isFloatingOrOutOfFlowPositioned() const { return (isFloating() || isOut
OfFlowPositioned()); } | 1122 bool isFloatingOrOutOfFlowPositioned() const { return (isFloating() || isOut
OfFlowPositioned()); } |
1123 | 1123 |
1124 bool isTransparent() const { return style()->hasOpacity(); } | 1124 bool isTransparent() const { return style()->hasOpacity(); } |
1125 float opacity() const { return style()->opacity(); } | 1125 float opacity() const { return style()->opacity(); } |
1126 | 1126 |
1127 bool hasReflection() const { return m_bitfields.hasReflection(); } | 1127 bool hasReflection() const { return m_bitfields.hasReflection(); } |
1128 | 1128 |
1129 // The current selection state for an object. For blocks, the state refers
to the state of the leaf | 1129 // The current selection state for an object. For blocks, the state refers
to the state of the leaf |
1130 // descendants (as described above in the SelectionState enum declaration). | 1130 // descendants (as described above in the SelectionState enum declaration). |
1131 SelectionState selectionState() const { return m_bitfields.selectionState();
} | 1131 SelectionState getSelectionState() const { return m_bitfields.getSelectionSt
ate(); } |
1132 virtual void setSelectionState(SelectionState state) { m_bitfields.setSelect
ionState(state); } | 1132 virtual void setSelectionState(SelectionState state) { m_bitfields.setSelect
ionState(state); } |
1133 inline void setSelectionStateIfNeeded(SelectionState); | 1133 inline void setSelectionStateIfNeeded(SelectionState); |
1134 bool canUpdateSelectionOnRootLineBoxes() const; | 1134 bool canUpdateSelectionOnRootLineBoxes() const; |
1135 | 1135 |
1136 // A single rectangle that encompasses all of the selected objects within th
is object. Used to determine the tightest | 1136 // A single rectangle that encompasses all of the selected objects within th
is object. Used to determine the tightest |
1137 // possible bounding box for the selection. The rect returned is in the coor
dinate space of the paint invalidation container's backing. | 1137 // possible bounding box for the selection. The rect returned is in the coor
dinate space of the paint invalidation container's backing. |
1138 virtual LayoutRect selectionRectForPaintInvalidation(const LayoutBoxModelObj
ect* /* paintInvalidationContainer */) const { return LayoutRect(); } | 1138 virtual LayoutRect selectionRectForPaintInvalidation(const LayoutBoxModelObj
ect* /* paintInvalidationContainer */) const { return LayoutRect(); } |
1139 | 1139 |
1140 // View coordinates means the coordinate space of |view()|. | 1140 // View coordinates means the coordinate space of |view()|. |
1141 LayoutRect selectionRectInViewCoordinates() const; | 1141 LayoutRect selectionRectInViewCoordinates() const; |
1142 | 1142 |
1143 virtual bool canBeSelectionLeaf() const { return false; } | 1143 virtual bool canBeSelectionLeaf() const { return false; } |
1144 bool hasSelectedChildren() const { return selectionState() != SelectionNone;
} | 1144 bool hasSelectedChildren() const { return getSelectionState() != SelectionNo
ne; } |
1145 | 1145 |
1146 bool isSelectable() const; | 1146 bool isSelectable() const; |
1147 // Obtains the selection colors that should be used when painting a selectio
n. | 1147 // Obtains the selection colors that should be used when painting a selectio
n. |
1148 Color selectionBackgroundColor() const; | 1148 Color selectionBackgroundColor() const; |
1149 Color selectionForegroundColor(const GlobalPaintFlags) const; | 1149 Color selectionForegroundColor(const GlobalPaintFlags) const; |
1150 Color selectionEmphasisMarkColor(const GlobalPaintFlags) const; | 1150 Color selectionEmphasisMarkColor(const GlobalPaintFlags) const; |
1151 | 1151 |
1152 /** | 1152 /** |
1153 * Returns the local coordinates of the caret within this layout object. | 1153 * Returns the local coordinates of the caret within this layout object. |
1154 * @param caretOffset zero-based offset determining position within the layo
ut object. | 1154 * @param caretOffset zero-based offset determining position within the layo
ut object. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 class MutableForPainting { | 1336 class MutableForPainting { |
1337 public: | 1337 public: |
1338 void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutOb
ject.setPreviousPaintOffset(paintOffset); } | 1338 void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutOb
ject.setPreviousPaintOffset(paintOffset); } |
1339 | 1339 |
1340 private: | 1340 private: |
1341 friend class LayoutObject; | 1341 friend class LayoutObject; |
1342 MutableForPainting(const LayoutObject& layoutObject) : m_layoutObject(co
nst_cast<LayoutObject&>(layoutObject)) { } | 1342 MutableForPainting(const LayoutObject& layoutObject) : m_layoutObject(co
nst_cast<LayoutObject&>(layoutObject)) { } |
1343 | 1343 |
1344 LayoutObject& m_layoutObject; | 1344 LayoutObject& m_layoutObject; |
1345 }; | 1345 }; |
1346 MutableForPainting mutableForPainting() const { return MutableForPainting(*t
his); } | 1346 MutableForPainting getMutableForPainting() const { return MutableForPainting
(*this); } |
1347 | 1347 |
1348 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true);
} | 1348 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true);
} |
1349 // Clears the IsScrollAnchorObject bit, unless any ScrollAnchor still refers
to us. | 1349 // Clears the IsScrollAnchorObject bit, unless any ScrollAnchor still refers
to us. |
1350 void maybeClearIsScrollAnchorObject(); | 1350 void maybeClearIsScrollAnchorObject(); |
1351 | 1351 |
1352 protected: | 1352 protected: |
1353 enum LayoutObjectType { | 1353 enum LayoutObjectType { |
1354 LayoutObjectBr, | 1354 LayoutObjectBr, |
1355 LayoutObjectCanvas, | 1355 LayoutObjectCanvas, |
1356 LayoutObjectFieldset, | 1356 LayoutObjectFieldset, |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1848 bool isInFlowPositioned() const { return m_positionedState == IsRelative
lyPositioned || m_positionedState == IsStickyPositioned; } | 1848 bool isInFlowPositioned() const { return m_positionedState == IsRelative
lyPositioned || m_positionedState == IsStickyPositioned; } |
1849 bool isPositioned() const { return m_positionedState != IsStaticallyPosi
tioned; } | 1849 bool isPositioned() const { return m_positionedState != IsStaticallyPosi
tioned; } |
1850 | 1850 |
1851 void setPositionedState(int positionState) | 1851 void setPositionedState(int positionState) |
1852 { | 1852 { |
1853 // This mask maps FixedPosition and AbsolutePosition to IsOutOfFlowP
ositioned, saving one bit. | 1853 // This mask maps FixedPosition and AbsolutePosition to IsOutOfFlowP
ositioned, saving one bit. |
1854 m_positionedState = static_cast<PositionedState>(positionState & 0x3
); | 1854 m_positionedState = static_cast<PositionedState>(positionState & 0x3
); |
1855 } | 1855 } |
1856 void clearPositionedState() { m_positionedState = StaticPosition; } | 1856 void clearPositionedState() { m_positionedState = StaticPosition; } |
1857 | 1857 |
1858 ALWAYS_INLINE SelectionState selectionState() const { return static_cast
<SelectionState>(m_selectionState); } | 1858 ALWAYS_INLINE SelectionState getSelectionState() const { return static_c
ast<SelectionState>(m_selectionState); } |
1859 ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { m_
selectionState = selectionState; } | 1859 ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { m_
selectionState = selectionState; } |
1860 | 1860 |
1861 ALWAYS_INLINE BoxDecorationBackgroundState boxDecorationBackgroundState(
) const { return static_cast<BoxDecorationBackgroundState>(m_boxDecorationBackgr
oundState); } | 1861 ALWAYS_INLINE BoxDecorationBackgroundState getBoxDecorationBackgroundSta
te() const { return static_cast<BoxDecorationBackgroundState>(m_boxDecorationBac
kgroundState); } |
1862 ALWAYS_INLINE void setBoxDecorationBackgroundState(BoxDecorationBackgrou
ndState s) const { m_boxDecorationBackgroundState = s; } | 1862 ALWAYS_INLINE void setBoxDecorationBackgroundState(BoxDecorationBackgrou
ndState s) const { m_boxDecorationBackgroundState = s; } |
1863 | 1863 |
1864 PaintInvalidationReason fullPaintInvalidationReason() const { return sta
tic_cast<PaintInvalidationReason>(m_fullPaintInvalidationReason); } | 1864 PaintInvalidationReason fullPaintInvalidationReason() const { return sta
tic_cast<PaintInvalidationReason>(m_fullPaintInvalidationReason); } |
1865 void setFullPaintInvalidationReason(PaintInvalidationReason reason) { m_
fullPaintInvalidationReason = reason; } | 1865 void setFullPaintInvalidationReason(PaintInvalidationReason reason) { m_
fullPaintInvalidationReason = reason; } |
1866 }; | 1866 }; |
1867 | 1867 |
1868 #undef ADD_BOOLEAN_BITFIELD | 1868 #undef ADD_BOOLEAN_BITFIELD |
1869 | 1869 |
1870 LayoutObjectBitfields m_bitfields; | 1870 LayoutObjectBitfields m_bitfields; |
1871 | 1871 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2031 if (parentLayoutObject->isSVGHiddenContainer()) | 2031 if (parentLayoutObject->isSVGHiddenContainer()) |
2032 return false; | 2032 return false; |
2033 parentLayoutObject = parentLayoutObject->parent(); | 2033 parentLayoutObject = parentLayoutObject->parent(); |
2034 } | 2034 } |
2035 | 2035 |
2036 return true; | 2036 return true; |
2037 } | 2037 } |
2038 | 2038 |
2039 inline void LayoutObject::setSelectionStateIfNeeded(SelectionState state) | 2039 inline void LayoutObject::setSelectionStateIfNeeded(SelectionState state) |
2040 { | 2040 { |
2041 if (selectionState() == state) | 2041 if (getSelectionState() == state) |
2042 return; | 2042 return; |
2043 | 2043 |
2044 setSelectionState(state); | 2044 setSelectionState(state); |
2045 } | 2045 } |
2046 | 2046 |
2047 inline void LayoutObject::setHasBoxDecorationBackground(bool b) | 2047 inline void LayoutObject::setHasBoxDecorationBackground(bool b) |
2048 { | 2048 { |
2049 if (!b) { | 2049 if (!b) { |
2050 m_bitfields.setBoxDecorationBackgroundState(NoBoxDecorationBackground); | 2050 m_bitfields.setBoxDecorationBackgroundState(NoBoxDecorationBackground); |
2051 return; | 2051 return; |
2052 } | 2052 } |
2053 if (hasBoxDecorationBackground()) | 2053 if (hasBoxDecorationBackground()) |
2054 return; | 2054 return; |
2055 m_bitfields.setBoxDecorationBackgroundState(HasBoxDecorationBackgroundObscur
ationStatusInvalid); | 2055 m_bitfields.setBoxDecorationBackgroundState(HasBoxDecorationBackgroundObscur
ationStatusInvalid); |
2056 } | 2056 } |
2057 | 2057 |
2058 inline void LayoutObject::invalidateBackgroundObscurationStatus() | 2058 inline void LayoutObject::invalidateBackgroundObscurationStatus() |
2059 { | 2059 { |
2060 if (!hasBoxDecorationBackground()) | 2060 if (!hasBoxDecorationBackground()) |
2061 return; | 2061 return; |
2062 m_bitfields.setBoxDecorationBackgroundState(HasBoxDecorationBackgroundObscur
ationStatusInvalid); | 2062 m_bitfields.setBoxDecorationBackgroundState(HasBoxDecorationBackgroundObscur
ationStatusInvalid); |
2063 } | 2063 } |
2064 | 2064 |
2065 inline bool LayoutObject::boxDecorationBackgroundIsKnownToBeObscured() const | 2065 inline bool LayoutObject::boxDecorationBackgroundIsKnownToBeObscured() const |
2066 { | 2066 { |
2067 if (m_bitfields.boxDecorationBackgroundState() == HasBoxDecorationBackground
ObscurationStatusInvalid) { | 2067 if (m_bitfields.getBoxDecorationBackgroundState() == HasBoxDecorationBackgro
undObscurationStatusInvalid) { |
2068 BoxDecorationBackgroundState state = computeBackgroundIsKnownToBeObscure
d() ? HasBoxDecorationBackgroundKnownToBeObscured : HasBoxDecorationBackgroundMa
yBeVisible; | 2068 BoxDecorationBackgroundState state = computeBackgroundIsKnownToBeObscure
d() ? HasBoxDecorationBackgroundKnownToBeObscured : HasBoxDecorationBackgroundMa
yBeVisible; |
2069 m_bitfields.setBoxDecorationBackgroundState(state); | 2069 m_bitfields.setBoxDecorationBackgroundState(state); |
2070 } | 2070 } |
2071 return m_bitfields.boxDecorationBackgroundState() == HasBoxDecorationBackgro
undKnownToBeObscured; | 2071 return m_bitfields.getBoxDecorationBackgroundState() == HasBoxDecorationBack
groundKnownToBeObscured; |
2072 } | 2072 } |
2073 | 2073 |
2074 inline void makeMatrixRenderable(TransformationMatrix& matrix, bool has3DRenderi
ng) | 2074 inline void makeMatrixRenderable(TransformationMatrix& matrix, bool has3DRenderi
ng) |
2075 { | 2075 { |
2076 if (!has3DRendering) | 2076 if (!has3DRendering) |
2077 matrix.makeAffine(); | 2077 matrix.makeAffine(); |
2078 } | 2078 } |
2079 | 2079 |
2080 inline int adjustForAbsoluteZoom(int value, LayoutObject* layoutObject) | 2080 inline int adjustForAbsoluteZoom(int value, LayoutObject* layoutObject) |
2081 { | 2081 { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 void showTree(const blink::LayoutObject*); | 2124 void showTree(const blink::LayoutObject*); |
2125 void showLineTree(const blink::LayoutObject*); | 2125 void showLineTree(const blink::LayoutObject*); |
2126 void showLayoutTree(const blink::LayoutObject* object1); | 2126 void showLayoutTree(const blink::LayoutObject* object1); |
2127 // We don't make object2 an optional parameter so that showLayoutTree | 2127 // We don't make object2 an optional parameter so that showLayoutTree |
2128 // can be called from gdb easily. | 2128 // can be called from gdb easily. |
2129 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec
t* object2); | 2129 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec
t* object2); |
2130 | 2130 |
2131 #endif | 2131 #endif |
2132 | 2132 |
2133 #endif // LayoutObject_h | 2133 #endif // LayoutObject_h |
OLD | NEW |