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

Side by Side Diff: Source/core/layout/line/InlineFlowBox.cpp

Issue 1034433003: Hittest for RootInlineBox/InlineFlowBox should take care of border-radius. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 | « LayoutTests/fast/borders/border-hittest-inlineFlowBox-expected.txt ('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) 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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 } 968 }
969 969
970 bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, LayoutUnit lineTop, LayoutUnit lineBottom) 970 bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, LayoutUnit lineTop, LayoutUnit lineBottom)
971 { 971 {
972 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom)); 972 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom));
973 flipForWritingMode(overflowRect); 973 flipForWritingMode(overflowRect);
974 overflowRect.moveBy(accumulatedOffset); 974 overflowRect.moveBy(accumulatedOffset);
975 if (!locationInContainer.intersects(overflowRect)) 975 if (!locationInContainer.intersects(overflowRect))
976 return false; 976 return false;
977 977
978 if (layoutObject().style()->hasBorderRadius()) {
979 LayoutRect borderRect = logicalFrameRect();
980 borderRect.moveBy(accumulatedOffset);
981 FloatRoundedRect border = layoutObject().style()->getRoundedBorderFor(bo rderRect, includeLogicalLeftEdge(), includeLogicalRightEdge());
982 if (!locationInContainer.intersects(border)) {
983 // For child whose bounding box is flowing ouside it's parent border .
984 bool hasChildAtPoint = false;
985 for (InlineBox* curr = lastChild(); curr; curr = curr->prevOnLine()) {
davve 2015/03/27 12:40:20 Instead of having a loop here and a preliminary hi
Abhijeet Kandalkar Slow 2015/03/27 13:08:26 Done.
986 LayoutRect absoluteRect = curr->logicalFrameRect();
987 absoluteRect.moveBy(accumulatedOffset);
988 if (locationInContainer.intersects(absoluteRect)) {
989 hasChildAtPoint = true;
990 break;
991 }
992 }
993
994 if (!hasChildAtPoint)
995 return false;
996 }
997 }
998
978 // Check children first. 999 // Check children first.
979 // 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. 1000 // 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.
980 LayoutObject* culledParent = 0; 1001 LayoutObject* culledParent = 0;
981 for (InlineBox* curr = lastChild(); curr; curr = curr->prevOnLine()) { 1002 for (InlineBox* curr = lastChild(); curr; curr = curr->prevOnLine()) {
982 if (curr->layoutObject().isText() || !curr->boxModelObject()->hasSelfPai ntingLayer()) { 1003 if (curr->layoutObject().isText() || !curr->boxModelObject()->hasSelfPai ntingLayer()) {
983 LayoutObject* newParent = 0; 1004 LayoutObject* newParent = 0;
984 // Culled parents are only relevant for area-based hit-tests, so ign ore it in point-based ones. 1005 // Culled parents are only relevant for area-based hit-tests, so ign ore it in point-based ones.
985 if (locationInContainer.isRectBasedTest()) { 1006 if (locationInContainer.isRectBasedTest()) {
986 newParent = curr->layoutObject().parent(); 1007 newParent = curr->layoutObject().parent();
987 if (newParent == layoutObject()) 1008 if (newParent == layoutObject())
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 ASSERT(child->prevOnLine() == prev); 1320 ASSERT(child->prevOnLine() == prev);
1300 prev = child; 1321 prev = child;
1301 } 1322 }
1302 ASSERT(prev == m_lastChild); 1323 ASSERT(prev == m_lastChild);
1303 #endif 1324 #endif
1304 } 1325 }
1305 1326
1306 #endif 1327 #endif
1307 1328
1308 } // namespace blink 1329 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/borders/border-hittest-inlineFlowBox-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698