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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2784313002: Change hittest node to be scrollbar's parent when hittest include a scrollbar (Closed)
Patch Set: mustaq comments addressed Created 3 years, 8 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 #include "platform/LengthFunctions.h" 227 #include "platform/LengthFunctions.h"
228 #include "platform/PluginScriptForbiddenScope.h" 228 #include "platform/PluginScriptForbiddenScope.h"
229 #include "platform/RuntimeEnabledFeatures.h" 229 #include "platform/RuntimeEnabledFeatures.h"
230 #include "platform/ScriptForbiddenScope.h" 230 #include "platform/ScriptForbiddenScope.h"
231 #include "platform/WebFrameScheduler.h" 231 #include "platform/WebFrameScheduler.h"
232 #include "platform/instrumentation/tracing/TraceEvent.h" 232 #include "platform/instrumentation/tracing/TraceEvent.h"
233 #include "platform/loader/fetch/ResourceFetcher.h" 233 #include "platform/loader/fetch/ResourceFetcher.h"
234 #include "platform/network/ContentSecurityPolicyParsers.h" 234 #include "platform/network/ContentSecurityPolicyParsers.h"
235 #include "platform/network/HTTPParsers.h" 235 #include "platform/network/HTTPParsers.h"
236 #include "platform/network/NetworkStateNotifier.h" 236 #include "platform/network/NetworkStateNotifier.h"
237 #include "platform/scroll/Scrollbar.h"
238 #include "platform/scroll/ScrollbarTheme.h" 237 #include "platform/scroll/ScrollbarTheme.h"
239 #include "platform/text/PlatformLocale.h" 238 #include "platform/text/PlatformLocale.h"
240 #include "platform/text/SegmentedString.h" 239 #include "platform/text/SegmentedString.h"
241 #include "platform/weborigin/OriginAccessEntry.h" 240 #include "platform/weborigin/OriginAccessEntry.h"
242 #include "platform/weborigin/SchemeRegistry.h" 241 #include "platform/weborigin/SchemeRegistry.h"
243 #include "platform/weborigin/SecurityOrigin.h" 242 #include "platform/weborigin/SecurityOrigin.h"
244 #include "public/platform/InterfaceProvider.h" 243 #include "public/platform/InterfaceProvider.h"
245 #include "public/platform/Platform.h" 244 #include "public/platform/Platform.h"
246 #include "public/platform/WebAddressSpace.h" 245 #include "public/platform/WebAddressSpace.h"
247 #include "public/platform/WebPrerenderingSupport.h" 246 #include "public/platform/WebPrerenderingSupport.h"
(...skipping 3397 matching lines...) Expand 10 before | Expand all | Expand 10 after
3645 // lead to a premature layout() happening, which could show a flash of white. 3644 // lead to a premature layout() happening, which could show a flash of white.
3646 // See also the similar code in EventHandler::hitTestResultAtPoint. 3645 // See also the similar code in EventHandler::hitTestResultAtPoint.
3647 if (layoutViewItem().isNull() || !view() || !view()->didFirstLayout()) 3646 if (layoutViewItem().isNull() || !view() || !view()->didFirstLayout())
3648 return MouseEventWithHitTestResults(event, 3647 return MouseEventWithHitTestResults(event,
3649 HitTestResult(request, LayoutPoint())); 3648 HitTestResult(request, LayoutPoint()));
3650 3649
3651 HitTestResult result(request, documentPoint); 3650 HitTestResult result(request, documentPoint);
3652 layoutViewItem().hitTest(result); 3651 layoutViewItem().hitTest(result);
3653 3652
3654 if (!request.readOnly()) 3653 if (!request.readOnly())
3655 updateHoverActiveState(request, result.innerElement(), result.scrollbar()); 3654 updateHoverActiveState(request, result.innerElement());
3656 3655
3657 if (isHTMLCanvasElement(result.innerNode())) { 3656 if (isHTMLCanvasElement(result.innerNode())) {
3658 HitTestCanvasResult* hitTestCanvasResult = 3657 HitTestCanvasResult* hitTestCanvasResult =
3659 toHTMLCanvasElement(result.innerNode()) 3658 toHTMLCanvasElement(result.innerNode())
3660 ->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); 3659 ->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame());
3661 if (hitTestCanvasResult->getControl()) { 3660 if (hitTestCanvasResult->getControl()) {
3662 result.setInnerNode(hitTestCanvasResult->getControl()); 3661 result.setInnerNode(hitTestCanvasResult->getControl());
3663 } 3662 }
3664 result.setCanvasRegionId(hitTestCanvasResult->getId()); 3663 result.setCanvasRegionId(hitTestCanvasResult->getId());
3665 } 3664 }
(...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after
6168 return currObj1; 6167 return currObj1;
6169 } 6168 }
6170 } 6169 }
6171 6170
6172 return 0; 6171 return 0;
6173 } 6172 }
6174 6173
6175 // TODO(mustaq) |request| parameter maybe a misuse of HitTestRequest in 6174 // TODO(mustaq) |request| parameter maybe a misuse of HitTestRequest in
6176 // updateHoverActiveState() since the function doesn't bother with hit-testing. 6175 // updateHoverActiveState() since the function doesn't bother with hit-testing.
6177 void Document::updateHoverActiveState(const HitTestRequest& request, 6176 void Document::updateHoverActiveState(const HitTestRequest& request,
6178 Element* innerElement, 6177 Element* innerElement) {
6179 Scrollbar* hitScrollbar) {
6180 DCHECK(!request.readOnly()); 6178 DCHECK(!request.readOnly());
6181 6179
6182 if (request.active() && m_frame) 6180 if (request.active() && m_frame)
6183 m_frame->eventHandler().notifyElementActivated(); 6181 m_frame->eventHandler().notifyElementActivated();
6184 6182
6185 Element* innerElementInDocument = hitScrollbar ? nullptr : innerElement; 6183 Element* innerElementInDocument = innerElement;
6186 // Replace the innerElementInDocument to be srollbar's parent when hit
6187 // scrollbar
6188 if (hitScrollbar) {
6189 ScrollableArea* scrollableArea = hitScrollbar->getScrollableArea();
6190 if (scrollableArea && scrollableArea->layoutBox() &&
6191 scrollableArea->layoutBox()->node() &&
6192 scrollableArea->layoutBox()->node()->isElementNode()) {
6193 innerElementInDocument =
6194 toElement(hitScrollbar->getScrollableArea()->layoutBox()->node());
6195 }
6196 }
6197 6184
6198 while (innerElementInDocument && innerElementInDocument->document() != this) { 6185 while (innerElementInDocument && innerElementInDocument->document() != this) {
6199 innerElementInDocument->document().updateHoverActiveState( 6186 innerElementInDocument->document().updateHoverActiveState(
6200 request, innerElementInDocument, hitScrollbar); 6187 request, innerElementInDocument);
6201 innerElementInDocument = innerElementInDocument->document().localOwner(); 6188 innerElementInDocument = innerElementInDocument->document().localOwner();
6202 } 6189 }
6203 6190
6204 updateDistribution(); 6191 updateDistribution();
6205 Element* oldActiveElement = activeHoverElement(); 6192 Element* oldActiveElement = activeHoverElement();
6206 if (oldActiveElement && !request.active()) { 6193 if (oldActiveElement && !request.active()) {
6207 // The oldActiveElement layoutObject is null, dropped on :active by setting 6194 // The oldActiveElement layoutObject is null, dropped on :active by setting
6208 // display: none, for instance. We still need to clear the ActiveChain as 6195 // display: none, for instance. We still need to clear the ActiveChain as
6209 // the mouse is released. 6196 // the mouse is released.
6210 for (Node* node = oldActiveElement; node; 6197 for (Node* node = oldActiveElement; node;
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
6673 } 6660 }
6674 6661
6675 void showLiveDocumentInstances() { 6662 void showLiveDocumentInstances() {
6676 WeakDocumentSet& set = liveDocumentSet(); 6663 WeakDocumentSet& set = liveDocumentSet();
6677 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6664 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6678 for (blink::Document* document : set) 6665 for (blink::Document* document : set)
6679 fprintf(stderr, "- Document %p URL: %s\n", document, 6666 fprintf(stderr, "- Document %p URL: %s\n", document,
6680 document->url().getString().utf8().data()); 6667 document->url().getString().utf8().data());
6681 } 6668 }
6682 #endif 6669 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698