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

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: Various fixes and test additions 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 bool operator!=(const AnnotatedRegionValue& o) const 122 bool operator!=(const AnnotatedRegionValue& o) const
123 { 123 {
124 return !(*this == o); 124 return !(*this == o);
125 } 125 }
126 126
127 LayoutRect bounds; 127 LayoutRect bounds;
128 bool draggable; 128 bool draggable;
129 }; 129 };
130 130
131 typedef WTF::HashSet<const RenderObject*> RenderObjectAncestorLineboxDirtySet; 131 typedef WTF::HashSet<const RenderObject*> RenderObjectAncestorLineboxDirtySet;
132 typedef WTF::HashMap<const RenderLayer*, Vector<IntRect> > LayerHitTestRects;
132 133
133 #ifndef NDEBUG 134 #ifndef NDEBUG
134 const int showTreeCharacterOffset = 39; 135 const int showTreeCharacterOffset = 39;
135 #endif 136 #endif
136 137
137 // Base class for all rendering tree objects. 138 // Base class for all rendering tree objects.
138 class RenderObject : public CachedImageClient, public MemoryReporterTag { 139 class RenderObject : public CachedImageClient, public MemoryReporterTag {
139 friend class RenderBlock; 140 friend class RenderBlock;
140 friend class RenderLayer; 141 friend class RenderLayer;
141 friend class RenderObjectChildList; 142 friend class RenderObjectChildList;
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const; 934 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const;
934 935
935 bool shouldUseTransformFromContainer(const RenderObject* container) const; 936 bool shouldUseTransformFromContainer(const RenderObject* container) const;
936 void getTransformFromContainer(const RenderObject* container, const LayoutSi ze& offsetInContainer, TransformationMatrix&) const; 937 void getTransformFromContainer(const RenderObject* container, const LayoutSi ze& offsetInContainer, TransformationMatrix&) const;
937 938
938 // return true if this object requires a new stacking context 939 // return true if this object requires a new stacking context
939 bool createsGroup() const { return isTransparent() || hasMask() || hasFilter () || hasBlendMode(); } 940 bool createsGroup() const { return isTransparent() || hasMask() || hasFilter () || hasBlendMode(); }
940 941
941 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& /* addit ionalOffset */, const RenderLayerModelObject* /* paintContainer */ = 0) { }; 942 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& /* addit ionalOffset */, const RenderLayerModelObject* /* paintContainer */ = 0) { };
942 943
944 // Compute a list of hit-test rectangles per composited layer rooted at this renderer.
945 virtual void computeLayerHitTestRects(LayerHitTestRects&) const;
946
943 LayoutRect absoluteOutlineBounds() const 947 LayoutRect absoluteOutlineBounds() const
944 { 948 {
945 return outlineBoundsForRepaint(0); 949 return outlineBoundsForRepaint(0);
946 } 950 }
947 951
948 // 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. 952 // 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.
949 RenderObject* rendererForRootBackground(); 953 RenderObject* rendererForRootBackground();
950 954
951 RespectImageOrientationEnum shouldRespectImageOrientation() const; 955 RespectImageOrientationEnum shouldRespectImageOrientation() const;
952 956
953 protected: 957 protected:
954 inline bool layerCreationAllowedForSubtree() const; 958 inline bool layerCreationAllowedForSubtree() const;
955 959
960 void enclosingCompositedLayerAndOffset(const RenderLayer**, LayoutPoint&) co nst;
961
956 // Overrides should call the superclass at the end 962 // Overrides should call the superclass at the end
957 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); 963 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
958 // Overrides should call the superclass at the start 964 // Overrides should call the superclass at the start
959 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 965 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
960 void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false); 966 void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false);
961 967
962 void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, Bo xSide, 968 void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, Bo xSide,
963 Color, EBorderStyle, int adjbw1, int adjbw2, bool an tialias = false); 969 Color, EBorderStyle, int adjbw1, int adjbw2, bool an tialias = false);
964 970
965 void paintFocusRing(PaintInfo&, const LayoutPoint&, RenderStyle*); 971 void paintFocusRing(PaintInfo&, const LayoutPoint&, RenderStyle*);
966 void paintOutline(PaintInfo&, const LayoutRect&); 972 void paintOutline(PaintInfo&, const LayoutRect&);
967 void addPDFURLRect(GraphicsContext*, const LayoutRect&); 973 void addPDFURLRect(GraphicsContext*, const LayoutRect&);
968 974
969 virtual LayoutRect viewRect() const; 975 virtual LayoutRect viewRect() const;
970 976
971 void adjustRectForOutlineAndShadow(LayoutRect&) const; 977 void adjustRectForOutlineAndShadow(LayoutRect&) const;
972 978
973 void clearLayoutRootIfNeeded() const; 979 void clearLayoutRootIfNeeded() const;
974 virtual void willBeDestroyed(); 980 virtual void willBeDestroyed();
975 void arenaDelete(RenderArena*, void* objectBase); 981 void arenaDelete(RenderArena*, void* objectBase);
976 982
977 virtual bool canBeReplacedWithInlineRunIn() const; 983 virtual bool canBeReplacedWithInlineRunIn() const;
978 984
979 virtual void insertedIntoTree(); 985 virtual void insertedIntoTree();
980 virtual void willBeRemovedFromTree(); 986 virtual void willBeRemovedFromTree();
981 987
982 void setDocumentForAnonymous(Document* document) { ASSERT(isAnonymous()); m_ node = document; } 988 void setDocumentForAnonymous(Document* document) { ASSERT(isAnonymous()); m_ node = document; }
983 989
990 // Add hit-test rects for the render tree rooted at this node to the provide d collection on a
991 // per-composited-layer basis. CurrentCompositedLayer must be the enclosing composited layer,
992 // and layerOffset is the current offset within this layer. Subclass impleme ntations will add
993 // any offset for this renderer within it's container, so callers should pro vide only the
994 // offset of the container within it's layer.
995 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur rentCompositedLayer, const LayoutPoint& layerOffset) const;
996
997 // Add hit-test rects for this renderer only to the provided list. layerOffs et is the offset of this renderer within
998 // the current composited layer that should be used for each result.
999 virtual void computeOwnHitTestRects(Vector<IntRect>&, const LayoutPoint& lay erOffset) const { };
1000
984 private: 1001 private:
985 RenderFlowThread* locateFlowThreadContainingBlock() const; 1002 RenderFlowThread* locateFlowThreadContainingBlock() const;
986 void removeFromRenderFlowThread(); 1003 void removeFromRenderFlowThread();
987 void removeFromRenderFlowThreadRecursive(RenderFlowThread*); 1004 void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
988 1005
989 bool shouldRepaintForStyleDifference(StyleDifference) const; 1006 bool shouldRepaintForStyleDifference(StyleDifference) const;
990 bool hasImmediateNonWhitespaceTextChild() const; 1007 bool hasImmediateNonWhitespaceTextChild() const;
991 1008
992 RenderStyle* cachedFirstLineStyle() const; 1009 RenderStyle* cachedFirstLineStyle() const;
993 StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensi tiveProperties) const; 1010 StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensi tiveProperties) const;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 // Outside the WebCore namespace for ease of invocation from gdb. 1336 // Outside the WebCore namespace for ease of invocation from gdb.
1320 void showTree(const WebCore::RenderObject*); 1337 void showTree(const WebCore::RenderObject*);
1321 void showLineTree(const WebCore::RenderObject*); 1338 void showLineTree(const WebCore::RenderObject*);
1322 void showRenderTree(const WebCore::RenderObject* object1); 1339 void showRenderTree(const WebCore::RenderObject* object1);
1323 // We don't make object2 an optional parameter so that showRenderTree 1340 // We don't make object2 an optional parameter so that showRenderTree
1324 // can be called from gdb easily. 1341 // can be called from gdb easily.
1325 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1342 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1326 #endif 1343 #endif
1327 1344
1328 #endif // RenderObject_h 1345 #endif // RenderObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698