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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 15425005: Don't force layout for mouse event hit tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: touch adjustment in window.internals also needs layout Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 return range->text(); 1067 return range->text();
1068 } 1068 }
1069 1069
1070 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionCode& ec) 1070 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
1071 { 1071 {
1072 if (!document || !document->frame()) { 1072 if (!document || !document->frame()) {
1073 ec = INVALID_ACCESS_ERR; 1073 ec = INVALID_ACCESS_ERR;
1074 return 0; 1074 return 0;
1075 } 1075 }
1076 1076
1077 document->updateLayout();
1078
1077 IntSize radius(width / 2, height / 2); 1079 IntSize radius(width / 2, height / 2);
1078 IntPoint point(x + radius.width(), y + radius.height()); 1080 IntPoint point(x + radius.width(), y + radius.height());
1079 1081
1080 Node* targetNode; 1082 Node* targetNode;
1081 IntPoint adjustedPoint; 1083 IntPoint adjustedPoint;
1082 1084
1083 bool foundNode = document->frame()->eventHandler()->bestClickableNodeForTouc hPoint(point, radius, adjustedPoint, targetNode); 1085 bool foundNode = document->frame()->eventHandler()->bestClickableNodeForTouc hPoint(point, radius, adjustedPoint, targetNode);
1084 if (foundNode) 1086 if (foundNode)
1085 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); 1087 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y());
1086 1088
1087 return 0; 1089 return 0;
1088 } 1090 }
1089 1091
1090 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width , long height, Document* document, ExceptionCode& ec) 1092 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width , long height, Document* document, ExceptionCode& ec)
1091 { 1093 {
1092 if (!document || !document->frame()) { 1094 if (!document || !document->frame()) {
1093 ec = INVALID_ACCESS_ERR; 1095 ec = INVALID_ACCESS_ERR;
1094 return 0; 1096 return 0;
1095 } 1097 }
1096 1098
1099 document->updateLayout();
1100
1097 IntSize radius(width / 2, height / 2); 1101 IntSize radius(width / 2, height / 2);
1098 IntPoint point(x + radius.width(), y + radius.height()); 1102 IntPoint point(x + radius.width(), y + radius.height());
1099 1103
1100 Node* targetNode; 1104 Node* targetNode;
1101 IntPoint adjustedPoint; 1105 IntPoint adjustedPoint;
1102 document->frame()->eventHandler()->bestClickableNodeForTouchPoint(point, rad ius, adjustedPoint, targetNode); 1106 document->frame()->eventHandler()->bestClickableNodeForTouchPoint(point, rad ius, adjustedPoint, targetNode);
1103 return targetNode; 1107 return targetNode;
1104 } 1108 }
1105 1109
1106 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document* document, ExceptionCode& ec) 1110 PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
1107 { 1111 {
1108 if (!document || !document->frame()) { 1112 if (!document || !document->frame()) {
1109 ec = INVALID_ACCESS_ERR; 1113 ec = INVALID_ACCESS_ERR;
1110 return 0; 1114 return 0;
1111 } 1115 }
1112 1116
1117 document->updateLayout();
1118
1113 IntSize radius(width / 2, height / 2); 1119 IntSize radius(width / 2, height / 2);
1114 IntPoint point(x + radius.width(), y + radius.height()); 1120 IntPoint point(x + radius.width(), y + radius.height());
1115 1121
1116 Node* targetNode = 0; 1122 Node* targetNode = 0;
1117 IntPoint adjustedPoint; 1123 IntPoint adjustedPoint;
1118 1124
1119 bool foundNode = document->frame()->eventHandler()->bestContextMenuNodeForTo uchPoint(point, radius, adjustedPoint, targetNode); 1125 bool foundNode = document->frame()->eventHandler()->bestContextMenuNodeForTo uchPoint(point, radius, adjustedPoint, targetNode);
1120 if (foundNode) 1126 if (foundNode)
1121 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); 1127 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y());
1122 1128
1123 return DOMPoint::create(x, y); 1129 return DOMPoint::create(x, y);
1124 } 1130 }
1125 1131
1126 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid th, long height, Document* document, ExceptionCode& ec) 1132 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid th, long height, Document* document, ExceptionCode& ec)
1127 { 1133 {
1128 if (!document || !document->frame()) { 1134 if (!document || !document->frame()) {
1129 ec = INVALID_ACCESS_ERR; 1135 ec = INVALID_ACCESS_ERR;
1130 return 0; 1136 return 0;
1131 } 1137 }
1132 1138
1139 document->updateLayout();
1140
1133 IntSize radius(width / 2, height / 2); 1141 IntSize radius(width / 2, height / 2);
1134 IntPoint point(x + radius.width(), y + radius.height()); 1142 IntPoint point(x + radius.width(), y + radius.height());
1135 1143
1136 Node* targetNode = 0; 1144 Node* targetNode = 0;
1137 IntPoint adjustedPoint; 1145 IntPoint adjustedPoint;
1138 document->frame()->eventHandler()->bestContextMenuNodeForTouchPoint(point, r adius, adjustedPoint, targetNode); 1146 document->frame()->eventHandler()->bestContextMenuNodeForTouchPoint(point, r adius, adjustedPoint, targetNode);
1139 return targetNode; 1147 return targetNode;
1140 } 1148 }
1141 1149
1142 PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document* document, ExceptionCode& ec) 1150 PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
1143 { 1151 {
1144 if (!document || !document->frame()) { 1152 if (!document || !document->frame()) {
1145 ec = INVALID_ACCESS_ERR; 1153 ec = INVALID_ACCESS_ERR;
1146 return 0; 1154 return 0;
1147 } 1155 }
1148 1156
1157 document->updateLayout();
1158
1149 IntSize radius(width / 2, height / 2); 1159 IntSize radius(width / 2, height / 2);
1150 IntPoint point(x + radius.width(), y + radius.height()); 1160 IntPoint point(x + radius.width(), y + radius.height());
1151 1161
1152 Node* targetNode; 1162 Node* targetNode;
1153 IntRect zoomableArea; 1163 IntRect zoomableArea;
1154 bool foundNode = document->frame()->eventHandler()->bestZoomableAreaForTouch Point(point, radius, zoomableArea, targetNode); 1164 bool foundNode = document->frame()->eventHandler()->bestZoomableAreaForTouch Point(point, radius, zoomableArea, targetNode);
1155 if (foundNode) 1165 if (foundNode)
1156 return ClientRect::create(zoomableArea); 1166 return ClientRect::create(zoomableArea);
1157 1167
1158 return 0; 1168 return 0;
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 1934
1925 RenderObject* renderer = select->renderer(); 1935 RenderObject* renderer = select->renderer();
1926 if (!renderer->isMenuList()) 1936 if (!renderer->isMenuList())
1927 return false; 1937 return false;
1928 1938
1929 RenderMenuList* menuList = toRenderMenuList(renderer); 1939 RenderMenuList* menuList = toRenderMenuList(renderer);
1930 return menuList->popupIsVisible(); 1940 return menuList->popupIsVisible();
1931 } 1941 }
1932 1942
1933 } 1943 }
OLDNEW
« no previous file with comments | « Source/core/page/EventHandler.cpp ('k') | Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698