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

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

Issue 249133002: hitTest should take care if the location is inside rounded border if border-radius is specified (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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-radius-hittest-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) 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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 2864 matching lines...) Expand 10 before | Expand all | Expand 10 after
2875 && isPointInOverflowControl(result, locationInContainer.point(), adjuste dLocation)) { 2875 && isPointInOverflowControl(result, locationInContainer.point(), adjuste dLocation)) {
2876 updateHitTestResult(result, locationInContainer.point() - localOffset); 2876 updateHitTestResult(result, locationInContainer.point() - localOffset);
2877 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet . 2877 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet .
2878 if (!result.addNodeToRectBasedTestResult(nodeForHitTest(), request, loca tionInContainer)) 2878 if (!result.addNodeToRectBasedTestResult(nodeForHitTest(), request, loca tionInContainer))
2879 return true; 2879 return true;
2880 } 2880 }
2881 2881
2882 // If we have clipping, then we can't have any spillout. 2882 // If we have clipping, then we can't have any spillout.
2883 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); 2883 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer();
2884 bool useClip = (hasControlClip() || useOverflowClip); 2884 bool useClip = (hasControlClip() || useOverflowClip);
2885 bool checkChildren = !useClip || (hasControlClip() ? locationInContainer.int ersects(controlClipRect(adjustedLocation)) : locationInContainer.intersects(over flowClipRect(adjustedLocation, IncludeOverlayScrollbarSize))); 2885 bool checkChildren = !useClip;
2886 if (!checkChildren) {
2887 if (hasControlClip()) {
2888 checkChildren = locationInContainer.intersects(controlClipRect(adjus tedLocation));
2889 } else {
2890 LayoutRect clipRect = overflowClipRect(adjustedLocation, IncludeOver layScrollbarSize);
2891 if (style()->hasBorderRadius())
2892 checkChildren = locationInContainer.intersects(style()->getRound edBorderFor(clipRect));
2893 else
2894 checkChildren = locationInContainer.intersects(clipRect);
2895 }
2896 }
2886 if (checkChildren) { 2897 if (checkChildren) {
2887 // Hit test descendants first. 2898 // Hit test descendants first.
2888 LayoutSize scrolledOffset(localOffset); 2899 LayoutSize scrolledOffset(localOffset);
2889 if (hasOverflowClip()) 2900 if (hasOverflowClip())
2890 scrolledOffset -= scrolledContentOffset(); 2901 scrolledOffset -= scrolledContentOffset();
2891 2902
2892 // Hit test contents if we don't have columns. 2903 // Hit test contents if we don't have columns.
2893 if (!hasColumns()) { 2904 if (!hasColumns()) {
2894 if (hitTestContents(request, result, locationInContainer, toLayoutPo int(scrolledOffset), hitTestAction)) { 2905 if (hitTestContents(request, result, locationInContainer, toLayoutPo int(scrolledOffset), hitTestAction)) {
2895 updateHitTestResult(result, flipForWritingMode(locationInContain er.point() - localOffset)); 2906 updateHitTestResult(result, flipForWritingMode(locationInContain er.point() - localOffset));
2896 return true; 2907 return true;
2897 } 2908 }
2898 if (hitTestAction == HitTestFloat && hitTestFloats(request, result, locationInContainer, toLayoutPoint(scrolledOffset))) 2909 if (hitTestAction == HitTestFloat && hitTestFloats(request, result, locationInContainer, toLayoutPoint(scrolledOffset)))
2899 return true; 2910 return true;
2900 } else if (hitTestColumns(request, result, locationInContainer, toLayout Point(scrolledOffset), hitTestAction)) { 2911 } else if (hitTestColumns(request, result, locationInContainer, toLayout Point(scrolledOffset), hitTestAction)) {
2901 updateHitTestResult(result, flipForWritingMode(locationInContainer.p oint() - localOffset)); 2912 updateHitTestResult(result, flipForWritingMode(locationInContainer.p oint() - localOffset));
2902 return true; 2913 return true;
2903 } 2914 }
2904 } 2915 }
2905 2916
2906 // Check if the point is outside radii. 2917 // Check if the point is outside radii.
2907 if (!isRenderView() && style()->hasBorderRadius()) { 2918 if (style()->hasBorderRadius()) {
2908 LayoutRect borderRect = borderBoxRect(); 2919 LayoutRect borderRect = borderBoxRect();
2909 borderRect.moveBy(adjustedLocation); 2920 borderRect.moveBy(adjustedLocation);
2910 RoundedRect border = style()->getRoundedBorderFor(borderRect); 2921 RoundedRect border = style()->getRoundedBorderFor(borderRect);
2911 if (!locationInContainer.intersects(border)) 2922 if (!locationInContainer.intersects(border))
2912 return false; 2923 return false;
2913 } 2924 }
2914 2925
2915 // Now hit test our background 2926 // Now hit test our background
2916 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild BlockBackground) { 2927 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild BlockBackground) {
2917 LayoutRect boundsRect(adjustedLocation, size()); 2928 LayoutRect boundsRect(adjustedLocation, size());
(...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after
5021 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5032 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5022 { 5033 {
5023 showRenderObject(); 5034 showRenderObject();
5024 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5035 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5025 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5036 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5026 } 5037 }
5027 5038
5028 #endif 5039 #endif
5029 5040
5030 } // namespace WebCore 5041 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/borders/border-radius-hittest-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698