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

Side by Side Diff: Source/core/rendering/InlineFlowBox.cpp

Issue 685963002: We need to account for culled inline parents of the hit-tested nodes.(Reland) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 1022
1023 bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, LayoutUnit lineTop, LayoutUnit lineBottom) 1023 bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, LayoutUnit lineTop, LayoutUnit lineBottom)
1024 { 1024 {
1025 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom)); 1025 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom));
1026 flipForWritingMode(overflowRect); 1026 flipForWritingMode(overflowRect);
1027 overflowRect.moveBy(accumulatedOffset); 1027 overflowRect.moveBy(accumulatedOffset);
1028 if (!locationInContainer.intersects(overflowRect)) 1028 if (!locationInContainer.intersects(overflowRect))
1029 return false; 1029 return false;
1030 1030
1031 // Check children first. 1031 // Check children first.
1032 // We need to account for culled inline parents of the hit-tested nodes, so that they may also get included in area-based hit-tests. 1032 // We need to account for culled inline parents of the hit-tested nodes, so that they may also get included in not only area-based hit-tests but also point- based ones.
1033 RenderObject* culledParent = 0; 1033 RenderObject* culledParent = 0;
1034 for (InlineBox* curr = lastChild(); curr; curr = curr->prevOnLine()) { 1034 for (InlineBox* curr = lastChild(); curr; curr = curr->prevOnLine()) {
1035 if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPaintin gLayer()) { 1035 if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPaintin gLayer()) {
1036 RenderObject* newParent = 0; 1036 RenderObject* newParent = 0;
1037 // Culled parents are only relevant for area-based hit-tests, so ign ore it in point-based ones. 1037 newParent = curr->renderer().parent();
1038 if (locationInContainer.isRectBasedTest()) { 1038 if (newParent == renderer())
1039 newParent = curr->renderer().parent(); 1039 newParent = 0;
1040 if (newParent == renderer())
1041 newParent = 0;
1042 }
1043 // Check the culled parent after all its children have been checked, to do this we wait until 1040 // Check the culled parent after all its children have been checked, to do this we wait until
1044 // we are about to test an element with a different parent. 1041 // we are about to test an element with a different parent.
1045 if (newParent != culledParent) { 1042 if (newParent != culledParent) {
1046 if (!newParent || !newParent->isDescendantOf(culledParent)) { 1043 if (!newParent || !newParent->isDescendantOf(culledParent)) {
1047 while (culledParent && culledParent != renderer() && culledP arent != newParent) { 1044 while (culledParent && culledParent != renderer() && culledP arent != newParent) {
1048 if (culledParent->isRenderInline() && toRenderInline(cul ledParent)->hitTestCulledInline(request, result, locationInContainer, accumulate dOffset)) 1045 if (culledParent->isRenderInline() && toRenderInline(cul ledParent)->hitTestCulledInline(request, result, locationInContainer, accumulate dOffset))
1049 return true; 1046 return true;
1050 culledParent = culledParent->parent(); 1047 culledParent = culledParent->parent();
1051 } 1048 }
1052 } 1049 }
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 ASSERT(child->prevOnLine() == prev); 1349 ASSERT(child->prevOnLine() == prev);
1353 prev = child; 1350 prev = child;
1354 } 1351 }
1355 ASSERT(prev == m_lastChild); 1352 ASSERT(prev == m_lastChild);
1356 #endif 1353 #endif
1357 } 1354 }
1358 1355
1359 #endif 1356 #endif
1360 1357
1361 } // namespace blink 1358 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698