| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 #ifndef NDEBUG | 100 #ifndef NDEBUG |
| 101 const int showTreeCharacterOffset = 39; | 101 const int showTreeCharacterOffset = 39; |
| 102 #endif | 102 #endif |
| 103 | 103 |
| 104 // Base class for all rendering tree objects. | 104 // Base class for all rendering tree objects. |
| 105 class RenderObject : public ImageResourceClient { | 105 class RenderObject : public ImageResourceClient { |
| 106 friend class RenderBlock; | 106 friend class RenderBlock; |
| 107 friend class RenderObjectChildList; | 107 friend class RenderObjectChildList; |
| 108 WTF_MAKE_NONCOPYABLE(RenderObject); | 108 WTF_MAKE_NONCOPYABLE(RenderObject); |
| 109 public: | 109 public: |
| 110 // Anonymous objects should pass the document as their node, and they will t
hen automatically be | 110 // TODO(ojan): Pass in a reference since the node can no longer be null. |
| 111 // marked as anonymous in the constructor. | |
| 112 explicit RenderObject(Node*); | 111 explicit RenderObject(Node*); |
| 113 virtual ~RenderObject(); | 112 virtual ~RenderObject(); |
| 114 | 113 |
| 115 virtual const char* renderName() const = 0; | 114 virtual const char* renderName() const = 0; |
| 116 | 115 |
| 117 String debugName() const; | 116 String debugName() const; |
| 118 | 117 |
| 119 RenderObject* parent() const { return m_parent; } | 118 RenderObject* parent() const { return m_parent; } |
| 120 bool isDescendantOf(const RenderObject*) const; | 119 bool isDescendantOf(const RenderObject*) const; |
| 121 | 120 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 // SVG uses FloatPoint precise hit testing, and passes the point in parent | 281 // SVG uses FloatPoint precise hit testing, and passes the point in parent |
| 283 // coordinates instead of in paint invalidaiton container coordinates. Event
ually the | 282 // coordinates instead of in paint invalidaiton container coordinates. Event
ually the |
| 284 // rest of the rendering tree will move to a similar model. | 283 // rest of the rendering tree will move to a similar model. |
| 285 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const F
loatPoint& pointInParent); | 284 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const F
loatPoint& pointInParent); |
| 286 | 285 |
| 287 bool canHaveWhitespaceChildren() const | 286 bool canHaveWhitespaceChildren() const |
| 288 { | 287 { |
| 289 return !isFlexibleBox(); | 288 return !isFlexibleBox(); |
| 290 } | 289 } |
| 291 | 290 |
| 292 // FIXME(sky): Remove. | |
| 293 bool isAnonymous() const { return false; } | |
| 294 bool isAnonymousBlock() const { return false; } | |
| 295 | |
| 296 bool isOutOfFlowPositioned() const { return m_bitfields.isOutOfFlowPositione
d(); } // absolute or fixed positioning | 291 bool isOutOfFlowPositioned() const { return m_bitfields.isOutOfFlowPositione
d(); } // absolute or fixed positioning |
| 297 bool isPositioned() const { return m_bitfields.isPositioned(); } | 292 bool isPositioned() const { return m_bitfields.isPositioned(); } |
| 298 | 293 |
| 299 bool isText() const { return m_bitfields.isText(); } | 294 bool isText() const { return m_bitfields.isText(); } |
| 300 bool isBox() const { return m_bitfields.isBox(); } | 295 bool isBox() const { return m_bitfields.isBox(); } |
| 301 bool isInline() const { return m_bitfields.isInline(); } // inline object | 296 bool isInline() const { return m_bitfields.isInline(); } // inline object |
| 302 bool isDragging() const { return m_bitfields.isDragging(); } | 297 bool isDragging() const { return m_bitfields.isDragging(); } |
| 303 bool isReplaced() const { return m_bitfields.isReplaced(); } // a "replaced"
element (see CSS) | 298 bool isReplaced() const { return m_bitfields.isReplaced(); } // a "replaced"
element (see CSS) |
| 304 | 299 |
| 305 bool hasLayer() const { return m_bitfields.hasLayer(); } | 300 bool hasLayer() const { return m_bitfields.hasLayer(); } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 bool hasClipPath() const { return style() && style()->clipPath(); } | 340 bool hasClipPath() const { return style() && style()->clipPath(); } |
| 346 bool hasHiddenBackface() const { return style() && style()->backfaceVisibili
ty() == BackfaceVisibilityHidden; } | 341 bool hasHiddenBackface() const { return style() && style()->backfaceVisibili
ty() == BackfaceVisibilityHidden; } |
| 347 | 342 |
| 348 inline bool preservesNewline() const; | 343 inline bool preservesNewline() const; |
| 349 | 344 |
| 350 RenderView* view() const { return document().renderView(); }; | 345 RenderView* view() const { return document().renderView(); }; |
| 351 FrameView* frameView() const { return document().view(); }; | 346 FrameView* frameView() const { return document().view(); }; |
| 352 | 347 |
| 353 bool isRooted() const; | 348 bool isRooted() const; |
| 354 | 349 |
| 350 // TODO(ojan): Make this a reference now that it can't be null. |
| 355 Node* node() const | 351 Node* node() const |
| 356 { | 352 { |
| 357 return isAnonymous() ? 0 : m_node.get(); | 353 return m_node.get(); |
| 358 } | 354 } |
| 359 | 355 |
| 360 Document& document() const { return m_node->document(); } | 356 Document& document() const { return m_node->document(); } |
| 361 LocalFrame* frame() const { return document().frame(); } | 357 LocalFrame* frame() const { return document().frame(); } |
| 362 | 358 |
| 363 // Returns the object containing this one. Can be different from parent for
positioned elements. | 359 // Returns the object containing this one. Can be different from parent for
positioned elements. |
| 364 // If paintInvalidationContainer and paintInvalidationContainerSkipped are n
ot null, on return *paintInvalidationContainerSkipped | 360 // If paintInvalidationContainer and paintInvalidationContainerSkipped are n
ot null, on return *paintInvalidationContainerSkipped |
| 365 // is true if the renderer returned is an ancestor of paintInvalidationConta
iner. | 361 // is true if the renderer returned is an ancestor of paintInvalidationConta
iner. |
| 366 RenderObject* container(const RenderBox* paintInvalidationContainer = 0, boo
l* paintInvalidationContainerSkipped = 0) const; | 362 RenderObject* container(const RenderBox* paintInvalidationContainer = 0, boo
l* paintInvalidationContainerSkipped = 0) const; |
| 367 | 363 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 * @param caretOffset zero-based offset determining position within the rend
er object. | 541 * @param caretOffset zero-based offset determining position within the rend
er object. |
| 546 * @param extraWidthToEndOfLine optional out arg to give extra width to end
of line - | 542 * @param extraWidthToEndOfLine optional out arg to give extra width to end
of line - |
| 547 * useful for character range rect computations | 543 * useful for character range rect computations |
| 548 */ | 544 */ |
| 549 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* e
xtraWidthToEndOfLine = 0); | 545 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* e
xtraWidthToEndOfLine = 0); |
| 550 | 546 |
| 551 // When performing a global document tear-down, the renderer of the document
is cleared. We use this | 547 // When performing a global document tear-down, the renderer of the document
is cleared. We use this |
| 552 // as a hook to detect the case of document destruction and don't waste time
doing unnecessary work. | 548 // as a hook to detect the case of document destruction and don't waste time
doing unnecessary work. |
| 553 bool documentBeingDestroyed() const; | 549 bool documentBeingDestroyed() const; |
| 554 | 550 |
| 555 void destroyAndCleanupAnonymousWrappers(); | |
| 556 virtual void destroy(); | 551 virtual void destroy(); |
| 557 | 552 |
| 558 // Virtual function helper for the new FlexibleBox Layout (display: -webkit-
flex). | 553 // Virtual function helper for the new FlexibleBox Layout (display: -webkit-
flex). |
| 559 virtual bool isFlexibleBox() const { return false; } | 554 virtual bool isFlexibleBox() const { return false; } |
| 560 | 555 |
| 561 virtual int caretMinOffset() const; | 556 virtual int caretMinOffset() const; |
| 562 virtual int caretMaxOffset() const; | 557 virtual int caretMaxOffset() const; |
| 563 | 558 |
| 564 virtual int previousOffset(int current) const; | 559 virtual int previousOffset(int current) const; |
| 565 virtual int previousOffsetForBackwardDeletion(int current) const; | 560 virtual int previousOffsetForBackwardDeletion(int current) const; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 628 |
| 634 virtual LayoutRect viewRect() const; | 629 virtual LayoutRect viewRect() const; |
| 635 | 630 |
| 636 void clearLayoutRootIfNeeded() const; | 631 void clearLayoutRootIfNeeded() const; |
| 637 virtual void willBeDestroyed(); | 632 virtual void willBeDestroyed(); |
| 638 void postDestroy(); | 633 void postDestroy(); |
| 639 | 634 |
| 640 void insertedIntoTree(); | 635 void insertedIntoTree(); |
| 641 void willBeRemovedFromTree(); | 636 void willBeRemovedFromTree(); |
| 642 | 637 |
| 643 void setDocumentForAnonymous(Document* document) { ASSERT(isAnonymous()); m_
node = document; } | |
| 644 | |
| 645 private: | 638 private: |
| 646 bool hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const; | 639 bool hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const; |
| 647 | 640 |
| 648 StyleDifference adjustStyleDifference(StyleDifference) const; | 641 StyleDifference adjustStyleDifference(StyleDifference) const; |
| 649 | 642 |
| 650 Color selectionColor(int colorProperty) const; | 643 Color selectionColor(int colorProperty) const; |
| 651 | 644 |
| 652 #if ENABLE(ASSERT) | 645 #if ENABLE(ASSERT) |
| 653 void checkBlockPositionedObjectsNeedLayout(); | 646 void checkBlockPositionedObjectsNeedLayout(); |
| 654 #endif | 647 #endif |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 : m_selfNeedsLayout(false) | 691 : m_selfNeedsLayout(false) |
| 699 , m_onlyNeededPositionedMovementLayout(false) | 692 , m_onlyNeededPositionedMovementLayout(false) |
| 700 , m_neededLayoutBecauseOfChildren(false) | 693 , m_neededLayoutBecauseOfChildren(false) |
| 701 , m_needsPositionedMovementLayout(false) | 694 , m_needsPositionedMovementLayout(false) |
| 702 , m_normalChildNeedsLayout(false) | 695 , m_normalChildNeedsLayout(false) |
| 703 , m_posChildNeedsLayout(false) | 696 , m_posChildNeedsLayout(false) |
| 704 , m_needsSimplifiedNormalFlowLayout(false) | 697 , m_needsSimplifiedNormalFlowLayout(false) |
| 705 , m_preferredLogicalWidthsDirty(false) | 698 , m_preferredLogicalWidthsDirty(false) |
| 706 , m_selfNeedsOverflowRecalcAfterStyleChange(false) | 699 , m_selfNeedsOverflowRecalcAfterStyleChange(false) |
| 707 , m_childNeedsOverflowRecalcAfterStyleChange(false) | 700 , m_childNeedsOverflowRecalcAfterStyleChange(false) |
| 708 , m_isAnonymous(!node) | |
| 709 , m_isText(false) | 701 , m_isText(false) |
| 710 , m_isBox(false) | 702 , m_isBox(false) |
| 711 , m_isInline(true) | 703 , m_isInline(true) |
| 712 , m_isReplaced(false) | 704 , m_isReplaced(false) |
| 713 , m_isDragging(false) | 705 , m_isDragging(false) |
| 714 , m_hasLayer(false) | 706 , m_hasLayer(false) |
| 715 , m_hasOverflowClip(false) | 707 , m_hasOverflowClip(false) |
| 716 , m_hasTransform(false) | 708 , m_hasTransform(false) |
| 717 , m_hasBoxDecorationBackground(false) | 709 , m_hasBoxDecorationBackground(false) |
| 718 , m_everHadLayout(false) | 710 , m_everHadLayout(false) |
| 719 , m_ancestorLineBoxDirty(false) | 711 , m_ancestorLineBoxDirty(false) |
| 720 , m_alwaysCreateLineBoxesForRenderInline(false) | 712 , m_alwaysCreateLineBoxesForRenderInline(false) |
| 721 , m_positionedState(IsStaticallyPositioned) | 713 , m_positionedState(IsStaticallyPositioned) |
| 722 , m_selectionState(SelectionNone) | 714 , m_selectionState(SelectionNone) |
| 723 { | 715 { |
| 724 } | 716 } |
| 725 | 717 |
| 726 // 32 bits have been used in the first word, and 11 in the second. | 718 // 32 bits have been used in the first word, and 11 in the second. |
| 727 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); | 719 ADD_BOOLEAN_BITFIELD(selfNeedsLayout, SelfNeedsLayout); |
| 728 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit
ionedMovementLayout); | 720 ADD_BOOLEAN_BITFIELD(onlyNeededPositionedMovementLayout, OnlyNeededPosit
ionedMovementLayout); |
| 729 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO
fChildren); | 721 ADD_BOOLEAN_BITFIELD(neededLayoutBecauseOfChildren, NeededLayoutBecauseO
fChildren); |
| 730 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem
entLayout); | 722 ADD_BOOLEAN_BITFIELD(needsPositionedMovementLayout, NeedsPositionedMovem
entLayout); |
| 731 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); | 723 ADD_BOOLEAN_BITFIELD(normalChildNeedsLayout, NormalChildNeedsLayout); |
| 732 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); | 724 ADD_BOOLEAN_BITFIELD(posChildNeedsLayout, PosChildNeedsLayout); |
| 733 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor
malFlowLayout); | 725 ADD_BOOLEAN_BITFIELD(needsSimplifiedNormalFlowLayout, NeedsSimplifiedNor
malFlowLayout); |
| 734 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths
Dirty); | 726 ADD_BOOLEAN_BITFIELD(preferredLogicalWidthsDirty, PreferredLogicalWidths
Dirty); |
| 735 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, SelfNeedsO
verflowRecalcAfterStyleChange); | 727 ADD_BOOLEAN_BITFIELD(selfNeedsOverflowRecalcAfterStyleChange, SelfNeedsO
verflowRecalcAfterStyleChange); |
| 736 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed
sOverflowRecalcAfterStyleChange); | 728 ADD_BOOLEAN_BITFIELD(childNeedsOverflowRecalcAfterStyleChange, ChildNeed
sOverflowRecalcAfterStyleChange); |
| 737 | 729 |
| 738 ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous); | |
| 739 ADD_BOOLEAN_BITFIELD(isText, IsText); | 730 ADD_BOOLEAN_BITFIELD(isText, IsText); |
| 740 ADD_BOOLEAN_BITFIELD(isBox, IsBox); | 731 ADD_BOOLEAN_BITFIELD(isBox, IsBox); |
| 741 ADD_BOOLEAN_BITFIELD(isInline, IsInline); | 732 ADD_BOOLEAN_BITFIELD(isInline, IsInline); |
| 742 ADD_BOOLEAN_BITFIELD(isReplaced, IsReplaced); | 733 ADD_BOOLEAN_BITFIELD(isReplaced, IsReplaced); |
| 743 ADD_BOOLEAN_BITFIELD(isDragging, IsDragging); | 734 ADD_BOOLEAN_BITFIELD(isDragging, IsDragging); |
| 744 | 735 |
| 745 ADD_BOOLEAN_BITFIELD(hasLayer, HasLayer); | 736 ADD_BOOLEAN_BITFIELD(hasLayer, HasLayer); |
| 746 ADD_BOOLEAN_BITFIELD(hasOverflowClip, HasOverflowClip); // Set in the ca
se of overflow:auto/scroll/hidden | 737 ADD_BOOLEAN_BITFIELD(hasOverflowClip, HasOverflowClip); // Set in the ca
se of overflow:auto/scroll/hidden |
| 747 ADD_BOOLEAN_BITFIELD(hasTransform, HasTransform); | 738 ADD_BOOLEAN_BITFIELD(hasTransform, HasTransform); |
| 748 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground, HasBoxDecorationBackgro
und); | 739 ADD_BOOLEAN_BITFIELD(hasBoxDecorationBackground, HasBoxDecorationBackgro
und); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 void showTree(const blink::RenderObject*); | 862 void showTree(const blink::RenderObject*); |
| 872 void showLineTree(const blink::RenderObject*); | 863 void showLineTree(const blink::RenderObject*); |
| 873 void showRenderTree(const blink::RenderObject* object1); | 864 void showRenderTree(const blink::RenderObject* object1); |
| 874 // We don't make object2 an optional parameter so that showRenderTree | 865 // We don't make object2 an optional parameter so that showRenderTree |
| 875 // can be called from gdb easily. | 866 // can be called from gdb easily. |
| 876 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec
t* object2); | 867 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec
t* object2); |
| 877 | 868 |
| 878 #endif | 869 #endif |
| 879 | 870 |
| 880 #endif // SKY_ENGINE_CORE_RENDERING_RENDEROBJECT_H_ | 871 #endif // SKY_ENGINE_CORE_RENDERING_RENDEROBJECT_H_ |
| OLD | NEW |