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

Side by Side Diff: Source/core/rendering/RenderObject.h

Issue 17471008: Rework compositor touch hit testing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: CR feedback - accumulate LayoutRects instead of IntRects, disable when page isn't composited. Also… Created 7 years, 5 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
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 }; 101 };
102 102
103 enum MarkingBehavior { 103 enum MarkingBehavior {
104 MarkOnlyThis, 104 MarkOnlyThis,
105 MarkContainingBlockChain, 105 MarkContainingBlockChain,
106 }; 106 };
107 107
108 enum MapCoordinatesMode { 108 enum MapCoordinatesMode {
109 IsFixed = 1 << 0, 109 IsFixed = 1 << 0,
110 UseTransforms = 1 << 1, 110 UseTransforms = 1 << 1,
111 ApplyContainerFlip = 1 << 2 111 ApplyContainerFlip = 1 << 2,
112 TraverseDocumentBoundaries = 1 << 3,
112 }; 113 };
113 typedef unsigned MapCoordinatesFlags; 114 typedef unsigned MapCoordinatesFlags;
114 115
115 const int caretWidth = 1; 116 const int caretWidth = 1;
116 117
117 struct AnnotatedRegionValue { 118 struct AnnotatedRegionValue {
118 bool operator==(const AnnotatedRegionValue& o) const 119 bool operator==(const AnnotatedRegionValue& o) const
119 { 120 {
120 return draggable == o.draggable && bounds == o.bounds; 121 return draggable == o.draggable && bounds == o.bounds;
121 } 122 }
122 bool operator!=(const AnnotatedRegionValue& o) const 123 bool operator!=(const AnnotatedRegionValue& o) const
123 { 124 {
124 return !(*this == o); 125 return !(*this == o);
125 } 126 }
126 127
127 LayoutRect bounds; 128 LayoutRect bounds;
128 bool draggable; 129 bool draggable;
129 }; 130 };
130 131
131 typedef WTF::HashSet<const RenderObject*> RenderObjectAncestorLineboxDirtySet; 132 typedef WTF::HashSet<const RenderObject*> RenderObjectAncestorLineboxDirtySet;
133 typedef WTF::HashMap<const RenderLayer*, Vector<LayoutRect> > LayerHitTestRects;
132 134
133 #ifndef NDEBUG 135 #ifndef NDEBUG
134 const int showTreeCharacterOffset = 39; 136 const int showTreeCharacterOffset = 39;
135 #endif 137 #endif
136 138
137 // Base class for all rendering tree objects. 139 // Base class for all rendering tree objects.
138 class RenderObject : public CachedImageClient { 140 class RenderObject : public CachedImageClient {
139 friend class RenderBlock; 141 friend class RenderBlock;
140 friend class RenderLayer; 142 friend class RenderLayer;
141 friend class RenderObjectChildList; 143 friend class RenderObjectChildList;
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const; 925 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const;
924 926
925 bool shouldUseTransformFromContainer(const RenderObject* container) const; 927 bool shouldUseTransformFromContainer(const RenderObject* container) const;
926 void getTransformFromContainer(const RenderObject* container, const LayoutSi ze& offsetInContainer, TransformationMatrix&) const; 928 void getTransformFromContainer(const RenderObject* container, const LayoutSi ze& offsetInContainer, TransformationMatrix&) const;
927 929
928 // return true if this object requires a new stacking context 930 // return true if this object requires a new stacking context
929 bool createsGroup() const { return isTransparent() || hasMask() || hasFilter () || hasBlendMode(); } 931 bool createsGroup() const { return isTransparent() || hasMask() || hasFilter () || hasBlendMode(); }
930 932
931 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& /* addit ionalOffset */, const RenderLayerModelObject* /* paintContainer */ = 0) { }; 933 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& /* addit ionalOffset */, const RenderLayerModelObject* /* paintContainer */ = 0) { };
932 934
935 // Compute a list of hit-test rectangles per layer rooted at this renderer.
936 virtual void computeLayerHitTestRects(LayerHitTestRects&) const;
937
933 LayoutRect absoluteOutlineBounds() const 938 LayoutRect absoluteOutlineBounds() const
934 { 939 {
935 return outlineBoundsForRepaint(0); 940 return outlineBoundsForRepaint(0);
936 } 941 }
937 942
938 // Return the renderer whose background style is used to paint the root back ground. Should only be called on the renderer for which isRoot() is true. 943 // Return the renderer whose background style is used to paint the root back ground. Should only be called on the renderer for which isRoot() is true.
939 RenderObject* rendererForRootBackground(); 944 RenderObject* rendererForRootBackground();
940 945
941 RespectImageOrientationEnum shouldRespectImageOrientation() const; 946 RespectImageOrientationEnum shouldRespectImageOrientation() const;
942 947
(...skipping 21 matching lines...) Expand all
964 virtual void willBeDestroyed(); 969 virtual void willBeDestroyed();
965 void arenaDelete(RenderArena*, void* objectBase); 970 void arenaDelete(RenderArena*, void* objectBase);
966 971
967 virtual bool canBeReplacedWithInlineRunIn() const; 972 virtual bool canBeReplacedWithInlineRunIn() const;
968 973
969 virtual void insertedIntoTree(); 974 virtual void insertedIntoTree();
970 virtual void willBeRemovedFromTree(); 975 virtual void willBeRemovedFromTree();
971 976
972 void setDocumentForAnonymous(Document* document) { ASSERT(isAnonymous()); m_ node = document; } 977 void setDocumentForAnonymous(Document* document) { ASSERT(isAnonymous()); m_ node = document; }
973 978
979 // Add hit-test rects for the render tree rooted at this node to the provide d collection on a
980 // per-RenderLayer basis. CurrentLayer must be the enclosing layer,
981 // and layerOffset is the current offset within this layer. Subclass impleme ntations will add
982 // any offset for this renderer within it's container, so callers should pro vide only the
983 // offset of the container within it's layer.
984 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur rentLayer, const LayoutPoint& layerOffset) const;
985
986 // Add hit-test rects for this renderer only to the provided list. layerOffs et is the offset
987 // of this renderer within the current layer that should be used for each re sult.
988 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const { };
989
974 private: 990 private:
975 RenderFlowThread* locateFlowThreadContainingBlock() const; 991 RenderFlowThread* locateFlowThreadContainingBlock() const;
976 void removeFromRenderFlowThread(); 992 void removeFromRenderFlowThread();
977 void removeFromRenderFlowThreadRecursive(RenderFlowThread*); 993 void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
978 994
979 bool shouldRepaintForStyleDifference(StyleDifference) const; 995 bool shouldRepaintForStyleDifference(StyleDifference) const;
980 bool hasImmediateNonWhitespaceTextChild() const; 996 bool hasImmediateNonWhitespaceTextChild() const;
981 997
982 RenderStyle* cachedFirstLineStyle() const; 998 RenderStyle* cachedFirstLineStyle() const;
983 StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensi tiveProperties) const; 999 StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensi tiveProperties) const;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 // Outside the WebCore namespace for ease of invocation from gdb. 1325 // Outside the WebCore namespace for ease of invocation from gdb.
1310 void showTree(const WebCore::RenderObject*); 1326 void showTree(const WebCore::RenderObject*);
1311 void showLineTree(const WebCore::RenderObject*); 1327 void showLineTree(const WebCore::RenderObject*);
1312 void showRenderTree(const WebCore::RenderObject* object1); 1328 void showRenderTree(const WebCore::RenderObject* object1);
1313 // We don't make object2 an optional parameter so that showRenderTree 1329 // We don't make object2 an optional parameter so that showRenderTree
1314 // can be called from gdb easily. 1330 // can be called from gdb easily.
1315 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1331 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1316 #endif 1332 #endif
1317 1333
1318 #endif // RenderObject_h 1334 #endif // RenderObject_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayerModelObject.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698