Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: sky/engine/core/rendering/RenderObject.h

Issue 688443003: Remove a bit more position:fixed plumbing. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/rendering/RenderLayer.h ('k') | sky/engine/core/rendering/RenderObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 // Set the style of the object and update the state of the object accordingl y. 614 // Set the style of the object and update the state of the object accordingl y.
615 void setStyle(PassRefPtr<RenderStyle>); 615 void setStyle(PassRefPtr<RenderStyle>);
616 616
617 // Updates only the local style ptr of the object. Does not update the stat e of the object, 617 // Updates only the local style ptr of the object. Does not update the stat e of the object,
618 // and so only should be called when the style is known not to have changed (or from setStyle). 618 // and so only should be called when the style is known not to have changed (or from setStyle).
619 void setStyleInternal(PassRefPtr<RenderStyle> style) { m_style = style; } 619 void setStyleInternal(PassRefPtr<RenderStyle> style) { m_style = style; }
620 620
621 // returns the containing block level element for this element. 621 // returns the containing block level element for this element.
622 RenderBlock* containingBlock() const; 622 RenderBlock* containingBlock() const;
623 623
624 bool canContainFixedPositionObjects() const
625 {
626 return isRenderView() || (hasTransform() && isRenderBlock());
627 }
628
629 // Convert the given local point to absolute coordinates 624 // Convert the given local point to absolute coordinates
630 // FIXME: Temporary. If UseTransforms is true, take transforms into account. Eventually localToAbsolute() will always be transform-aware. 625 // FIXME: Temporary. If UseTransforms is true, take transforms into account. Eventually localToAbsolute() will always be transform-aware.
631 FloatPoint localToAbsolute(const FloatPoint& localPoint = FloatPoint(), MapC oordinatesFlags = 0) const; 626 FloatPoint localToAbsolute(const FloatPoint& localPoint = FloatPoint(), MapC oordinatesFlags = 0) const;
632 FloatPoint absoluteToLocal(const FloatPoint&, MapCoordinatesFlags = 0) const ; 627 FloatPoint absoluteToLocal(const FloatPoint&, MapCoordinatesFlags = 0) const ;
633 628
634 // Convert a local quad to absolute coordinates, taking transforms into acco unt. 629 // Convert a local quad to absolute coordinates, taking transforms into acco unt.
635 FloatQuad localToAbsoluteQuad(const FloatQuad& quad, MapCoordinatesFlags mod e = 0) const 630 FloatQuad localToAbsoluteQuad(const FloatQuad& quad, MapCoordinatesFlags mod e = 0) const
636 { 631 {
637 return localToContainerQuad(quad, 0, mode); 632 return localToContainerQuad(quad, 0, mode);
638 } 633 }
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 void checkBlockPositionedObjectsNeedLayout(); 999 void checkBlockPositionedObjectsNeedLayout();
1005 #endif 1000 #endif
1006 const char* invalidationReasonToString(InvalidationReason) const; 1001 const char* invalidationReasonToString(InvalidationReason) const;
1007 1002
1008 void markContainingBlockChainForPaintInvalidation() 1003 void markContainingBlockChainForPaintInvalidation()
1009 { 1004 {
1010 for (RenderObject* container = this->container(); container && !containe r->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); containe r = container->container()) 1005 for (RenderObject* container = this->container(); container && !containe r->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); containe r = container->container())
1011 container->setMayNeedPaintInvalidation(true); 1006 container->setMayNeedPaintInvalidation(true);
1012 } 1007 }
1013 1008
1009 // FIXME(sky): This method is just to avoid copy-paste.
1010 // Merge container into containingBlock and then get rid of this method.
1011 bool canContainAbsolutePositionObjects() const
1012 {
1013 return isRenderView() || (hasTransform() && isRenderBlock());
1014 }
1015
1014 static bool isAllowedToModifyRenderTreeStructure(Document&); 1016 static bool isAllowedToModifyRenderTreeStructure(Document&);
1015 1017
1016 RefPtr<RenderStyle> m_style; 1018 RefPtr<RenderStyle> m_style;
1017 1019
1018 RawPtr<Node> m_node; 1020 RawPtr<Node> m_node;
1019 1021
1020 RawPtr<RenderObject> m_parent; 1022 RawPtr<RenderObject> m_parent;
1021 RawPtr<RenderObject> m_previous; 1023 RawPtr<RenderObject> m_previous;
1022 RawPtr<RenderObject> m_next; 1024 RawPtr<RenderObject> m_next;
1023 1025
1024 #if ENABLE(ASSERT) 1026 #if ENABLE(ASSERT)
1025 unsigned m_setNeedsLayoutForbidden : 1; 1027 unsigned m_setNeedsLayoutForbidden : 1;
1026 #if ENABLE(OILPAN) 1028 #if ENABLE(OILPAN)
1027 protected: 1029 protected:
1028 unsigned m_didCallDestroy : 1; 1030 unsigned m_didCallDestroy : 1;
1029 private: 1031 private:
1030 #endif 1032 #endif
1031 #endif 1033 #endif
1032 1034
1033 #define ADD_BOOLEAN_BITFIELD(name, Name) \ 1035 #define ADD_BOOLEAN_BITFIELD(name, Name) \
1034 private:\ 1036 private:\
1035 unsigned m_##name : 1;\ 1037 unsigned m_##name : 1;\
1036 public:\ 1038 public:\
1037 bool name() const { return m_##name; }\ 1039 bool name() const { return m_##name; }\
1038 void set##Name(bool name) { m_##name = name; }\ 1040 void set##Name(bool name) { m_##name = name; }\
1039 1041
1040 class RenderObjectBitfields { 1042 class RenderObjectBitfields {
1043 // FIXME(sky): Remove this enum and just use EPosition directly.
1041 enum PositionedState { 1044 enum PositionedState {
1042 IsStaticallyPositioned = 0, 1045 IsStaticallyPositioned = 0,
1043 IsRelativelyPositioned = 1, 1046 IsRelativelyPositioned = 1,
1044 IsOutOfFlowPositioned = 2, 1047 IsOutOfFlowPositioned = 2,
1045 }; 1048 };
1046 1049
1047 public: 1050 public:
1048 RenderObjectBitfields(Node* node) 1051 RenderObjectBitfields(Node* node)
1049 : m_selfNeedsLayout(false) 1052 : m_selfNeedsLayout(false)
1050 , m_shouldDoFullPaintInvalidation(false) 1053 , m_shouldDoFullPaintInvalidation(false)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 unsigned m_selectionState : 3; // SelectionState 1137 unsigned m_selectionState : 3; // SelectionState
1135 unsigned m_boxDecorationBackgroundState : 2; // BoxDecorationBackgroundS tate 1138 unsigned m_boxDecorationBackgroundState : 2; // BoxDecorationBackgroundS tate
1136 1139
1137 public: 1140 public:
1138 bool isOutOfFlowPositioned() const { return m_positionedState == IsOutOf FlowPositioned; } 1141 bool isOutOfFlowPositioned() const { return m_positionedState == IsOutOf FlowPositioned; }
1139 bool isRelPositioned() const { return m_positionedState == IsRelativelyP ositioned; } 1142 bool isRelPositioned() const { return m_positionedState == IsRelativelyP ositioned; }
1140 bool isPositioned() const { return m_positionedState != IsStaticallyPosi tioned; } 1143 bool isPositioned() const { return m_positionedState != IsStaticallyPosi tioned; }
1141 1144
1142 void setPositionedState(int positionState) 1145 void setPositionedState(int positionState)
1143 { 1146 {
1144 // FIXME(sky): Simplify now that we don't have FixedPosition. 1147 m_positionedState = static_cast<PositionedState>(positionState);
1145 // This mask maps FixedPosition and AbsolutePosition to IsOutOfFlowP ositioned, saving one bit.
1146 m_positionedState = static_cast<PositionedState>(positionState & 0x3 );
1147 } 1148 }
1148 void clearPositionedState() { m_positionedState = StaticPosition; } 1149 void clearPositionedState() { m_positionedState = StaticPosition; }
1149 1150
1150 ALWAYS_INLINE SelectionState selectionState() const { return static_cast <SelectionState>(m_selectionState); } 1151 ALWAYS_INLINE SelectionState selectionState() const { return static_cast <SelectionState>(m_selectionState); }
1151 ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { m_ selectionState = selectionState; } 1152 ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { m_ selectionState = selectionState; }
1152 1153
1153 ALWAYS_INLINE BoxDecorationBackgroundState boxDecorationBackgroundState( ) const { return static_cast<BoxDecorationBackgroundState>(m_boxDecorationBackgr oundState); } 1154 ALWAYS_INLINE BoxDecorationBackgroundState boxDecorationBackgroundState( ) const { return static_cast<BoxDecorationBackgroundState>(m_boxDecorationBackgr oundState); }
1154 ALWAYS_INLINE void setBoxDecorationBackgroundState(BoxDecorationBackgrou ndState s) { m_boxDecorationBackgroundState = s; } 1155 ALWAYS_INLINE void setBoxDecorationBackgroundState(BoxDecorationBackgrou ndState s) { m_boxDecorationBackgroundState = s; }
1155 }; 1156 };
1156 1157
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 void showTree(const blink::RenderObject*); 1346 void showTree(const blink::RenderObject*);
1346 void showLineTree(const blink::RenderObject*); 1347 void showLineTree(const blink::RenderObject*);
1347 void showRenderTree(const blink::RenderObject* object1); 1348 void showRenderTree(const blink::RenderObject* object1);
1348 // We don't make object2 an optional parameter so that showRenderTree 1349 // We don't make object2 an optional parameter so that showRenderTree
1349 // can be called from gdb easily. 1350 // can be called from gdb easily.
1350 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec t* object2); 1351 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec t* object2);
1351 1352
1352 #endif 1353 #endif
1353 1354
1354 #endif // RenderObject_h 1355 #endif // RenderObject_h
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderLayer.h ('k') | sky/engine/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698