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

Side by Side Diff: Source/core/layout/HitTestResult.cpp

Issue 1211973004: Add another uma metric for HitTesting validity. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « Source/core/layout/HitTestResult.h ('k') | no next file » | 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) 2006, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 , m_hitTestRequest(otherRequest) 78 , m_hitTestRequest(otherRequest)
79 , m_cacheable(true) 79 , m_cacheable(true)
80 , m_pointInInnerNodeFrame(m_hitTestLocation.point()) 80 , m_pointInInnerNodeFrame(m_hitTestLocation.point())
81 , m_isOverWidget(false) 81 , m_isOverWidget(false)
82 { 82 {
83 } 83 }
84 84
85 HitTestResult::HitTestResult(const HitTestResult& other) 85 HitTestResult::HitTestResult(const HitTestResult& other)
86 : m_hitTestLocation(other.m_hitTestLocation) 86 : m_hitTestLocation(other.m_hitTestLocation)
87 , m_hitTestRequest(other.m_hitTestRequest) 87 , m_hitTestRequest(other.m_hitTestRequest)
88 , m_cacheable(other.m_cacheable)
Rick Byers 2015/06/25 20:58:27 was this an unrelated bug?
dtapuska 2015/06/25 21:01:33 Yes it was; this constructor isn't used in the cod
88 , m_innerNode(other.innerNode()) 89 , m_innerNode(other.innerNode())
89 , m_innerPossiblyPseudoNode(other.m_innerPossiblyPseudoNode) 90 , m_innerPossiblyPseudoNode(other.m_innerPossiblyPseudoNode)
90 , m_pointInInnerNodeFrame(other.m_pointInInnerNodeFrame) 91 , m_pointInInnerNodeFrame(other.m_pointInInnerNodeFrame)
91 , m_localPoint(other.localPoint()) 92 , m_localPoint(other.localPoint())
92 , m_innerURLElement(other.URLElement()) 93 , m_innerURLElement(other.URLElement())
93 , m_scrollbar(other.scrollbar()) 94 , m_scrollbar(other.scrollbar())
94 , m_isOverWidget(other.isOverWidget()) 95 , m_isOverWidget(other.isOverWidget())
95 { 96 {
96 // Only copy the NodeSet in case of list hit test. 97 // Only copy the NodeSet in case of list hit test.
97 m_listBasedTestResult = adoptPtrWillBeNoop(other.m_listBasedTestResult ? new NodeSet(*other.m_listBasedTestResult) : 0); 98 m_listBasedTestResult = adoptPtrWillBeNoop(other.m_listBasedTestResult ? new NodeSet(*other.m_listBasedTestResult) : 0);
98 } 99 }
99 100
100 HitTestResult::~HitTestResult() 101 HitTestResult::~HitTestResult()
101 { 102 {
102 } 103 }
103 104
104 HitTestResult& HitTestResult::operator=(const HitTestResult& other) 105 HitTestResult& HitTestResult::operator=(const HitTestResult& other)
105 { 106 {
106 m_hitTestLocation = other.m_hitTestLocation; 107 m_hitTestLocation = other.m_hitTestLocation;
107 m_hitTestRequest = other.m_hitTestRequest; 108 m_hitTestRequest = other.m_hitTestRequest;
108 populateFromCachedResult(other); 109 populateFromCachedResult(other);
109 110
110 return *this; 111 return *this;
111 } 112 }
112 113
114 unsigned HitTestResult::equalityScore(const HitTestResult& other) const
115 {
116 return (m_hitTestRequest.equalForCacheability(other.m_hitTestRequest) << 7)
117 | ((m_innerNode == other.innerNode()) << 6)
118 | ((m_innerPossiblyPseudoNode == other.innerPossiblyPseudoNode()) << 5)
119 | ((m_pointInInnerNodeFrame == other.m_pointInInnerNodeFrame) << 4)
120 | ((m_localPoint == other.localPoint()) << 3)
121 | ((m_innerURLElement == other.URLElement()) << 2)
122 | ((m_scrollbar == other.scrollbar()) << 1)
123 | (m_isOverWidget == other.isOverWidget());
124 }
125
113 bool HitTestResult::equalForCacheability(const HitTestResult& other) const 126 bool HitTestResult::equalForCacheability(const HitTestResult& other) const
114 { 127 {
115 return m_hitTestRequest.equalForCacheability(other.m_hitTestRequest) 128 return m_hitTestRequest.equalForCacheability(other.m_hitTestRequest)
116 && m_innerNode == other.innerNode() 129 && m_innerNode == other.innerNode()
117 && m_innerPossiblyPseudoNode == other.innerPossiblyPseudoNode() 130 && m_innerPossiblyPseudoNode == other.innerPossiblyPseudoNode()
118 && m_pointInInnerNodeFrame == other.m_pointInInnerNodeFrame 131 && m_pointInInnerNodeFrame == other.m_pointInInnerNodeFrame
119 && m_localPoint == other.localPoint() 132 && m_localPoint == other.localPoint()
120 && m_innerURLElement == other.URLElement() 133 && m_innerURLElement == other.URLElement()
121 && m_scrollbar == other.scrollbar() 134 && m_scrollbar == other.scrollbar()
122 && m_isOverWidget == other.isOverWidget(); 135 && m_isOverWidget == other.isOverWidget();
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 else if (isHTMLMapElement(m_innerNode)) 552 else if (isHTMLMapElement(m_innerNode))
540 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); 553 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement();
541 554
542 if (!imageMapImageElement) 555 if (!imageMapImageElement)
543 return m_innerNode.get(); 556 return m_innerNode.get();
544 557
545 return imageMapImageElement; 558 return imageMapImageElement;
546 } 559 }
547 560
548 } // namespace blink 561 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/HitTestResult.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698