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

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: fix tests and add test 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 6159 matching lines...) Expand 10 before | Expand all | Expand 10 after
6170 } 6170 }
6171 } 6171 }
6172 6172
6173 return 0; 6173 return 0;
6174 } 6174 }
6175 6175
6176 // TODO(mustaq) |request| parameter maybe a misuse of HitTestRequest in 6176 // TODO(mustaq) |request| parameter maybe a misuse of HitTestRequest in
6177 // updateHoverActiveState() since the function doesn't bother with hit-testing. 6177 // updateHoverActiveState() since the function doesn't bother with hit-testing.
6178 void Document::updateHoverActiveState(const HitTestRequest& request, 6178 void Document::updateHoverActiveState(const HitTestRequest& request,
6179 Element* innerElement, 6179 Element* innerElement,
6180 Scrollbar* hitScrollbar) { 6180 Scrollbar* hitScrollbar) {
bokan 2017/03/31 20:07:00 You can remove the hitScrollbar parameter now.
6181 DCHECK(!request.readOnly()); 6181 DCHECK(!request.readOnly());
6182 6182
6183 if (request.active() && m_frame) 6183 if (request.active() && m_frame)
6184 m_frame->eventHandler().notifyElementActivated(); 6184 m_frame->eventHandler().notifyElementActivated();
6185 6185
6186 Element* innerElementInDocument = hitScrollbar ? nullptr : innerElement; 6186 Element* innerElementInDocument = innerElement;
6187 // Replace the innerElementInDocument to be srollbar's parent when hit
6188 // scrollbar
6189 if (hitScrollbar) {
6190 ScrollableArea* scrollableArea = hitScrollbar->getScrollableArea();
6191 if (scrollableArea && scrollableArea->layoutBox() &&
6192 scrollableArea->layoutBox()->node() &&
6193 scrollableArea->layoutBox()->node()->isElementNode()) {
6194 innerElementInDocument =
6195 toElement(hitScrollbar->getScrollableArea()->layoutBox()->node());
6196 }
6197 }
6198 6187
6199 while (innerElementInDocument && innerElementInDocument->document() != this) { 6188 while (innerElementInDocument && innerElementInDocument->document() != this) {
6200 innerElementInDocument->document().updateHoverActiveState( 6189 innerElementInDocument->document().updateHoverActiveState(
6201 request, innerElementInDocument, hitScrollbar); 6190 request, innerElementInDocument, hitScrollbar);
6202 innerElementInDocument = innerElementInDocument->document().localOwner(); 6191 innerElementInDocument = innerElementInDocument->document().localOwner();
6203 } 6192 }
6204 6193
6205 updateDistribution(); 6194 updateDistribution();
6206 Element* oldActiveElement = activeHoverElement(); 6195 Element* oldActiveElement = activeHoverElement();
6207 if (oldActiveElement && !request.active()) { 6196 if (oldActiveElement && !request.active()) {
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
6674 } 6663 }
6675 6664
6676 void showLiveDocumentInstances() { 6665 void showLiveDocumentInstances() {
6677 WeakDocumentSet& set = liveDocumentSet(); 6666 WeakDocumentSet& set = liveDocumentSet();
6678 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6667 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6679 for (blink::Document* document : set) 6668 for (blink::Document* document : set)
6680 fprintf(stderr, "- Document %p URL: %s\n", document, 6669 fprintf(stderr, "- Document %p URL: %s\n", document,
6681 document->url().getString().utf8().data()); 6670 document->url().getString().utf8().data());
6682 } 6671 }
6683 #endif 6672 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698