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

Side by Side Diff: Source/core/layout/LayoutObject.h

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated patch after splitting Created 5 years, 10 months 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 | Annotate | Revision Log
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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 bool hasHiddenBackface() const { return style() && style()->backfaceVisibili ty() == BackfaceVisibilityHidden; } 594 bool hasHiddenBackface() const { return style() && style()->backfaceVisibili ty() == BackfaceVisibilityHidden; }
595 595
596 bool hasFilter() const { return style() && style()->hasFilter(); } 596 bool hasFilter() const { return style() && style()->hasFilter(); }
597 597
598 bool hasShapeOutside() const { return style() && style()->shapeOutside(); } 598 bool hasShapeOutside() const { return style() && style()->shapeOutside(); }
599 599
600 inline bool preservesNewline() const; 600 inline bool preservesNewline() const;
601 601
602 // The pseudo element style can be cached or uncached. Use the cached metho d if the pseudo element doesn't respect 602 // The pseudo element style can be cached or uncached. Use the cached metho d if the pseudo element doesn't respect
603 // any pseudo classes (and therefore has no concept of changing state). 603 // any pseudo classes (and therefore has no concept of changing state).
604 LayoutStyle* getCachedPseudoStyle(PseudoId, LayoutStyle* parentStyle = 0) co nst; 604 LayoutStyle* getCachedPseudoStyle(PseudoId, const LayoutStyle* parentStyle = 0) const;
605 PassRefPtr<LayoutStyle> getUncachedPseudoStyle(const PseudoStyleRequest&, La youtStyle* parentStyle = 0, LayoutStyle* ownStyle = 0) const; 605 PassRefPtr<LayoutStyle> getUncachedPseudoStyle(const PseudoStyleRequest&, co nst LayoutStyle* parentStyle = 0, const LayoutStyle* ownStyle = 0) const;
606 606
607 virtual void updateDragState(bool dragOn); 607 virtual void updateDragState(bool dragOn);
608 608
609 RenderView* view() const { return document().renderView(); }; 609 RenderView* view() const { return document().renderView(); };
610 FrameView* frameView() const { return document().view(); }; 610 FrameView* frameView() const { return document().view(); };
611 611
612 bool isRooted() const; 612 bool isRooted() const;
613 613
614 Node* node() const 614 Node* node() const
615 { 615 {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 virtual IntRect absoluteFocusRingBoundingBoxRect() const; 791 virtual IntRect absoluteFocusRingBoundingBoxRect() const;
792 792
793 static FloatRect absoluteBoundingBoxRectForRange(const Range*); 793 static FloatRect absoluteBoundingBoxRectForRange(const Range*);
794 794
795 // the rect that will be painted if this object is passed as the paintingRoo t 795 // the rect that will be painted if this object is passed as the paintingRoo t
796 LayoutRect paintingRootRect(LayoutRect& topLevelRect); 796 LayoutRect paintingRootRect(LayoutRect& topLevelRect);
797 797
798 virtual LayoutUnit minPreferredLogicalWidth() const { return 0; } 798 virtual LayoutUnit minPreferredLogicalWidth() const { return 0; }
799 virtual LayoutUnit maxPreferredLogicalWidth() const { return 0; } 799 virtual LayoutUnit maxPreferredLogicalWidth() const { return 0; }
800 800
801 LayoutStyle* style() const { return m_style.get(); } 801 const LayoutStyle* style() const { return m_style.get(); }
802 LayoutStyle* mutableStyle() const { return m_style.get(); }
802 803
803 // m_style can only be nullptr before the first style is set, thus most 804 // m_style can only be nullptr before the first style is set, thus most
804 // callers will never see a nullptr style and should use styleRef(). 805 // callers will never see a nullptr style and should use styleRef().
805 // FIXME: It would be better if style() returned a const reference. 806 // FIXME: It would be better if style() returned a const reference.
806 const LayoutStyle& styleRef() const { return mutableStyleRef(); } 807 const LayoutStyle& styleRef() const { return mutableStyleRef(); }
807 LayoutStyle& mutableStyleRef() const { ASSERT(m_style); return *m_style; } 808 LayoutStyle& mutableStyleRef() const { ASSERT(m_style); return *m_style; }
808 809
809 /* The following methods are inlined in LayoutObjectInlines.h */ 810 /* The following methods are inlined in LayoutObjectInlines.h */
810 LayoutStyle* firstLineStyle() const; 811 const LayoutStyle* firstLineStyle() const;
811 const LayoutStyle& firstLineStyleRef() const; 812 const LayoutStyle& firstLineStyleRef() const;
812 LayoutStyle* style(bool firstLine) const; 813 const LayoutStyle* style(bool firstLine) const;
813 const LayoutStyle& styleRef(bool firstLine) const; 814 const LayoutStyle& styleRef(bool firstLine) const;
rune 2015/02/10 12:03:01 Why do you need the pointer-return variants? I as
rune 2015/02/10 12:03:01 Do we really need the pointer-return variants? Wh
Julien - ping for review 2015/02/10 23:10:43 We do. The reason is that there is a small window
814 815
815 static inline Color resolveColor(const LayoutStyle& styleToUse, int colorPro perty) 816 static inline Color resolveColor(const LayoutStyle& styleToUse, int colorPro perty)
816 { 817 {
817 return styleToUse.visitedDependentColor(colorProperty); 818 return styleToUse.visitedDependentColor(colorProperty);
818 } 819 }
819 820
820 inline Color resolveColor(int colorProperty) const 821 inline Color resolveColor(int colorProperty) const
821 { 822 {
822 return style()->visitedDependentColor(colorProperty); 823 return style()->visitedDependentColor(colorProperty);
823 } 824 }
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 void showTree(const blink::LayoutObject*); 1623 void showTree(const blink::LayoutObject*);
1623 void showLineTree(const blink::LayoutObject*); 1624 void showLineTree(const blink::LayoutObject*);
1624 void showRenderTree(const blink::LayoutObject* object1); 1625 void showRenderTree(const blink::LayoutObject* object1);
1625 // We don't make object2 an optional parameter so that showRenderTree 1626 // We don't make object2 an optional parameter so that showRenderTree
1626 // can be called from gdb easily. 1627 // can be called from gdb easily.
1627 void showRenderTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2); 1628 void showRenderTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2);
1628 1629
1629 #endif 1630 #endif
1630 1631
1631 #endif // LayoutObject_h 1632 #endif // LayoutObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698