{"action":"created","comment":{"url":"https://api.github.com/repos/flutter/engine/pulls/comments/51347876","id":51347876,"diff_hunk":"@@ -952,6 +952,112 @@ bool RenderBlock::hitTestContents(const HitTestRequest& request, HitTestResult&\n     return false;\n }\n \n+static PositionWithAffinity positionForPointInChild(RenderBox* child, const LayoutPoint& pointInParentCoordinates)\n+{\n+    LayoutPoint childLocation = child->location();\n+\n+    // FIXME: This is wrong if the child's writing-mode is different from the parent's.\n+    LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates - childLocation));\n+    return child->positionForPoint(pointInChildCoordinates);\n+}\n+\n+PositionWithAffinity RenderBlock::positionForPointWithInlineChildren(const LayoutPoint& pointInLogicalContents)\n+{\n+    ASSERT(isRenderParagraph());\n+\n+    if (!firstRootBox())\n+        return createPositionWithAffinity(0, DOWNSTREAM);\n+\n+    // look for the closest line box in the root box which is at the passed-in y coordinate\n+    InlineBox* closestBox = 0;\n+    RootInlineBox* firstRootBoxWithChildren = 0;\n+    RootInlineBox* lastRootBoxWithChildren = 0;\n+    for (RootInlineBox* root = firstRootBox(); root; root = root->nextRootBox()) {\n+        if (!root->firstLeafChild())\n+            continue;\n+        if (!firstRootBoxWithChildren)\n+            firstRootBoxWithChildren = root;\n+\n+        lastRootBoxWithChildren = root;\n+\n+        // check if this root line box is located at this y coordinate\n+        if (pointInLogicalContents.y() < root->selectionBottom()) {\n+            closestBox = root->closestLeafChildForLogicalLeftPosition(pointInLogicalContents.x());\n+            if (closestBox)\n+                break;\n+        }\n+    }\n+\n+    if (!closestBox && lastRootBoxWithChildren) {\n+        // y coordinate is below last root line box, pretend we hit it\n+        closestBox = lastRootBoxWithChildren->closestLeafChildForLogicalLeftPosition(pointInLogicalContents.x());\n+    }\n+\n+    if (closestBox) {\n+        // pass the box a top position that is inside it\n+        LayoutPoint point(pointInLogicalContents.x(), closestBox->root().blockDirectionPointInLine());\n+        if (closestBox->renderer().isReplaced())\n+            return positionForPointInChild(&toRenderBox(closestBox->renderer()), point);\n+        return closestBox->renderer().positionForPoint(point);\n+    }\n+\n+    // Can't reach this. We have a root line box, but it has no kids.\n+    // FIXME: This should ASSERT_NOT_REACHED(), but clicking on placeholder text\n+    // seems to hit this code path.\n+    return createPositionWithAffinity(0, DOWNSTREAM);\n+}\n+\n+static inline bool isChildHitTestCandidate(RenderBox* box)\n+{\n+    return box->height() && !box->isFloatingOrOutOfFlowPositioned();\n+}\n+\n+PositionWithAffinity RenderBlock::positionForPoint(const LayoutPoint& point)\n+{\n+    if (isReplaced()) {","path":"sky/engine/core/rendering/RenderBlock.cpp","position":66,"original_position":66,"commit_id":"21d75757169917b8ec6474bbd4668c45719fe3c9","original_commit_id":"21d75757169917b8ec6474bbd4668c45719fe3c9","user":{"login":"abarth","id":112007,"avatar_url":"https://avatars.githubusercontent.com/u/112007?v=3","gravatar_id":"","url":"https://api.github.com/users/abarth","html_url":"https://github.com/abarth","followers_url":"https://api.github.com/users/abarth/followers","following_url":"https://api.github.com/users/abarth/following{/other_user}","gists_url":"https://api.github.com/users/abarth/gists{/gist_id}","starred_url":"https://api.github.com/users/abarth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abarth/subscriptions","organizations_url":"https://api.github.com/users/abarth/orgs","repos_url":"https://api.github.com/users/abarth/repos","events_url":"https://api.github.com/users/abarth/events{/privacy}","received_events_url":"https://api.github.com/users/abarth/received_events","type":"User","site_admin":false},"body":"We still have RenderReplaced, but there's no way to create one currently.  We do want to let people have replaced objects in their text flows (e.g., material chips), but we haven't sorted out how we're going to do that yet.","created_at":"2016-01-30T17:27:41Z","updated_at":"2016-01-30T17:27:41Z","html_url":"https://github.com/flutter/engine/pull/2327#discussion_r51347876","pull_request_url":"https://api.github.com/repos/flutter/engine/pulls/2327","_links":{"self":{"href":"https://api.github.com/repos/flutter/engine/pulls/comments/51347876"},"html":{"href":"https://github.com/flutter/engine/pull/2327#discussion_r51347876"},"pull_request":{"href":"https://api.github.com/repos/flutter/engine/pulls/2327"}}},"pull_request":{"url":"https://api.github.com/repos/flutter/engine/pulls/2327","id":57731895,"html_url":"https://github.com/flutter/engine/pull/2327","diff_url":"https://github.com/flutter/engine/pull/2327.diff","patch_url":"https://github.com/flutter/engine/pull/2327.patch","issue_url":"https://api.github.com/repos/flutter/engine/issues/2327","number":2327,"state":"open","locked":false,"title":"Add Paragraph#getPositionForOffset","user":{"login":"abarth","id":112007,"avatar_url":"https://avatars.githubusercontent.com/u/112007?v=3","gravatar_id":"","url":"https://api.github.com/users/abarth","html_url":"https://github.com/abarth","followers_url":"https://api.github.com/users/abarth/followers","following_url":"https://api.github.com/users/abarth/following{/other_user}","gists_url":"https://api.github.com/users/abarth/gists{/gist_id}","starred_url":"https://api.github.com/users/abarth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abarth/subscriptions","organizations_url":"https://api.github.com/users/abarth/orgs","repos_url":"https://api.github.com/users/abarth/repos","events_url":"https://api.github.com/users/abarth/events{/privacy}","received_events_url":"https://api.github.com/users/abarth/received_events","type":"User","site_admin":false},"body":"We'll use this function to position the caret when the user taps a text\r\ninput control.\r\n\r\nVery little of the code in this patch is actually new. Most of it is\r\nrestoring code that we previously removed from the engine. I've made\r\nsome small changes to the restored code to handle the lack of a DOM. The\r\nonly major change is to RenderObject::createPositionWithAffinity, which\r\nnow just returns the values it captures instead of trying to compute a\r\nDOM position.\r\n\r\nTextAffinity and TextPosition are lifted from package:flutter. Once this\r\npatch rolls into package:flutter, I'll remove the declarations there.","created_at":"2016-01-30T06:10:09Z","updated_at":"2016-01-30T17:27:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f9423b7c2640745d3daa39822712353fd6981f3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/flutter/engine/pulls/2327/commits","review_comments_url":"https://api.github.com/repos/flutter/engine/pulls/2327/comments","review_comment_url":"https://api.github.com/repos/flutter/engine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flutter/engine/issues/2327/comments","statuses_url":"https://api.github.com/repos/flutter/engine/statuses/21d75757169917b8ec6474bbd4668c45719fe3c9","head":{"label":"abarth:position_for_point","ref":"position_for_point","sha":"21d75757169917b8ec6474bbd4668c45719fe3c9","user":{"login":"abarth","id":112007,"avatar_url":"https://avatars.githubusercontent.com/u/112007?v=3","gravatar_id":"","url":"https://api.github.com/users/abarth","html_url":"https://github.com/abarth","followers_url":"https://api.github.com/users/abarth/followers","following_url":"https://api.github.com/users/abarth/following{/other_user}","gists_url":"https://api.github.com/users/abarth/gists{/gist_id}","starred_url":"https://api.github.com/users/abarth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abarth/subscriptions","organizations_url":"https://api.github.com/users/abarth/orgs","repos_url":"https://api.github.com/users/abarth/repos","events_url":"https://api.github.com/users/abarth/events{/privacy}","received_events_url":"https://api.github.com/users/abarth/received_events","type":"User","site_admin":false},"repo":{"id":39215675,"name":"engine","full_name":"abarth/engine","owner":{"login":"abarth","id":112007,"avatar_url":"https://avatars.githubusercontent.com/u/112007?v=3","gravatar_id":"","url":"https://api.github.com/users/abarth","html_url":"https://github.com/abarth","followers_url":"https://api.github.com/users/abarth/followers","following_url":"https://api.github.com/users/abarth/following{/other_user}","gists_url":"https://api.github.com/users/abarth/gists{/gist_id}","starred_url":"https://api.github.com/users/abarth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abarth/subscriptions","organizations_url":"https://api.github.com/users/abarth/orgs","repos_url":"https://api.github.com/users/abarth/repos","events_url":"https://api.github.com/users/abarth/events{/privacy}","received_events_url":"https://api.github.com/users/abarth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abarth/engine","description":"The Flutter engine","fork":true,"url":"https://api.github.com/repos/abarth/engine","forks_url":"https://api.github.com/repos/abarth/engine/forks","keys_url":"https://api.github.com/repos/abarth/engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abarth/engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abarth/engine/teams","hooks_url":"https://api.github.com/repos/abarth/engine/hooks","issue_events_url":"https://api.github.com/repos/abarth/engine/issues/events{/number}","events_url":"https://api.github.com/repos/abarth/engine/events","assignees_url":"https://api.github.com/repos/abarth/engine/assignees{/user}","branches_url":"https://api.github.com/repos/abarth/engine/branches{/branch}","tags_url":"https://api.github.com/repos/abarth/engine/tags","blobs_url":"https://api.github.com/repos/abarth/engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abarth/engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abarth/engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/abarth/engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abarth/engine/statuses/{sha}","languages_url":"https://api.github.com/repos/abarth/engine/languages","stargazers_url":"https://api.github.com/repos/abarth/engine/stargazers","contributors_url":"https://api.github.com/repos/abarth/engine/contributors","subscribers_url":"https://api.github.com/repos/abarth/engine/subscribers","subscription_url":"https://api.github.com/repos/abarth/engine/subscription","commits_url":"https://api.github.com/repos/abarth/engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/abarth/engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/abarth/engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/abarth/engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/abarth/engine/contents/{+path}","compare_url":"https://api.github.com/repos/abarth/engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abarth/engine/merges","archive_url":"https://api.github.com/repos/abarth/engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abarth/engine/downloads","issues_url":"https://api.github.com/repos/abarth/engine/issues{/number}","pulls_url":"https://api.github.com/repos/abarth/engine/pulls{/number}","milestones_url":"https://api.github.com/repos/abarth/engine/milestones{/number}","notifications_url":"https://api.github.com/repos/abarth/engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abarth/engine/labels{/name}","releases_url":"https://api.github.com/repos/abarth/engine/releases{/id}","deployments_url":"https://api.github.com/repos/abarth/engine/deployments","created_at":"2015-07-16T19:18:24Z","updated_at":"2015-12-30T17:43:29Z","pushed_at":"2016-01-30T07:07:58Z","git_url":"git://github.com/abarth/engine.git","ssh_url":"git@github.com:abarth/engine.git","clone_url":"https://github.com/abarth/engine.git","svn_url":"https://github.com/abarth/engine","homepage":"http://flutter.io","size":99398,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"flutter:master","ref":"master","sha":"51d68b8f91af2a53f0e265d71aff7bea83edf8a9","user":{"login":"flutter","id":14101776,"avatar_url":"https://avatars.githubusercontent.com/u/14101776?v=3","gravatar_id":"","url":"https://api.github.com/users/flutter","html_url":"https://github.com/flutter","followers_url":"https://api.github.com/users/flutter/followers","following_url":"https://api.github.com/users/flutter/following{/other_user}","gists_url":"https://api.github.com/users/flutter/gists{/gist_id}","starred_url":"https://api.github.com/users/flutter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flutter/subscriptions","organizations_url":"https://api.github.com/users/flutter/orgs","repos_url":"https://api.github.com/users/flutter/repos","events_url":"https://api.github.com/users/flutter/events{/privacy}","received_events_url":"https://api.github.com/users/flutter/received_events","type":"Organization","site_admin":false},"repo":{"id":39211337,"name":"engine","full_name":"flutter/engine","owner":{"login":"flutter","id":14101776,"avatar_url":"https://avatars.githubusercontent.com/u/14101776?v=3","gravatar_id":"","url":"https://api.github.com/users/flutter","html_url":"https://github.com/flutter","followers_url":"https://api.github.com/users/flutter/followers","following_url":"https://api.github.com/users/flutter/following{/other_user}","gists_url":"https://api.github.com/users/flutter/gists{/gist_id}","starred_url":"https://api.github.com/users/flutter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flutter/subscriptions","organizations_url":"https://api.github.com/users/flutter/orgs","repos_url":"https://api.github.com/users/flutter/repos","events_url":"https://api.github.com/users/flutter/events{/privacy}","received_events_url":"https://api.github.com/users/flutter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flutter/engine","description":"The Flutter engine","fork":false,"url":"https://api.github.com/repos/flutter/engine","forks_url":"https://api.github.com/repos/flutter/engine/forks","keys_url":"https://api.github.com/repos/flutter/engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flutter/engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flutter/engine/teams","hooks_url":"https://api.github.com/repos/flutter/engine/hooks","issue_events_url":"https://api.github.com/repos/flutter/engine/issues/events{/number}","events_url":"https://api.github.com/repos/flutter/engine/events","assignees_url":"https://api.github.com/repos/flutter/engine/assignees{/user}","branches_url":"https://api.github.com/repos/flutter/engine/branches{/branch}","tags_url":"https://api.github.com/repos/flutter/engine/tags","blobs_url":"https://api.github.com/repos/flutter/engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flutter/engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flutter/engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/flutter/engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flutter/engine/statuses/{sha}","languages_url":"https://api.github.com/repos/flutter/engine/languages","stargazers_url":"https://api.github.com/repos/flutter/engine/stargazers","contributors_url":"https://api.github.com/repos/flutter/engine/contributors","subscribers_url":"https://api.github.com/repos/flutter/engine/subscribers","subscription_url":"https://api.github.com/repos/flutter/engine/subscription","commits_url":"https://api.github.com/repos/flutter/engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/flutter/engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/flutter/engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/flutter/engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/flutter/engine/contents/{+path}","compare_url":"https://api.github.com/repos/flutter/engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flutter/engine/merges","archive_url":"https://api.github.com/repos/flutter/engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flutter/engine/downloads","issues_url":"https://api.github.com/repos/flutter/engine/issues{/number}","pulls_url":"https://api.github.com/repos/flutter/engine/pulls{/number}","milestones_url":"https://api.github.com/repos/flutter/engine/milestones{/number}","notifications_url":"https://api.github.com/repos/flutter/engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flutter/engine/labels{/name}","releases_url":"https://api.github.com/repos/flutter/engine/releases{/id}","deployments_url":"https://api.github.com/repos/flutter/engine/deployments","created_at":"2015-07-16T17:39:56Z","updated_at":"2016-01-29T04:42:57Z","pushed_at":"2016-01-30T07:07:59Z","git_url":"git://github.com/flutter/engine.git","ssh_url":"git@github.com:flutter/engine.git","clone_url":"https://github.com/flutter/engine.git","svn_url":"https://github.com/flutter/engine","homepage":"http://flutter.io","size":101895,"stargazers_count":859,"watchers_count":859,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":123,"mirror_url":null,"open_issues_count":4,"forks":123,"open_issues":4,"watchers":859,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flutter/engine/pulls/2327"},"html":{"href":"https://github.com/flutter/engine/pull/2327"},"issue":{"href":"https://api.github.com/repos/flutter/engine/issues/2327"},"comments":{"href":"https://api.github.com/repos/flutter/engine/issues/2327/comments"},"review_comments":{"href":"https://api.github.com/repos/flutter/engine/pulls/2327/comments"},"review_comment":{"href":"https://api.github.com/repos/flutter/engine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flutter/engine/pulls/2327/commits"},"statuses":{"href":"https://api.github.com/repos/flutter/engine/statuses/21d75757169917b8ec6474bbd4668c45719fe3c9"}}}}