{"action":"created","comment":{"url":"https://api.github.com/repos/servo/servo/pulls/comments/88332328","pull_request_review_id":8909715,"id":88332328,"diff_hunk":"@@ -9,13 +9,167 @@ use dom::bindings::js::{JS, MutNullableHeap, Root};\n use dom::bindings::str::DOMString;\n use dom::document::Document;\n use dom::domtokenlist::DOMTokenList;\n+use dom::element::Element;\n use dom::htmlelement::HTMLElement;\n use dom::node::Node;\n use dom::virtualmethods::VirtualMethods;\n+use euclid::point::Point2D;\n use html5ever_atoms::LocalName;\n use std::default::Default;\n use style::attr::AttrValue;\n \n+#[derive(PartialEq)]\n+#[derive(Debug)]\n+pub enum Area {\n+    Circle { left: f32, top: f32, radius: f32 },\n+    Rectangle { top_left: (f32, f32), bottom_right: (f32, f32) },\n+    Polygon { points: Vec<f32> },\n+}\n+\n+pub enum Shape {\n+    Circle,\n+    Rectangle,\n+    Polygon,\n+}\n+\n+// https://html.spec.whatwg.org/multipage/#rules-for-parsing-a-list-of-floating-point-numbers\n+impl Area {\n+    pub fn parse(coord: &str, target: Shape) -> Option<Area> {\n+        let mut array;\n+        let size = coord.len();\n+        let num = coord.as_bytes();\n+        let mut index = 0;\n+        let mut number_list = Vec::new();\n+        let points_count;\n+\n+        match target {\n+            Shape::Circle => points_count = 3,\n+            Shape::Rectangle => points_count = 4,\n+            Shape::Polygon => points_count = 0,\n+        }\n+\n+        // Step 4: Walk till char is not a delimiter\n+        while index < size {\n+            let val = num[index];\n+            match val {\n+                0x2C | 0x3B | 0x20 | 0x09 | 0x0A | 0x0C | 0x0D  => {},\n+                _ => break,\n+            }\n+\n+            index += 1;\n+        }\n+\n+        // Step 5: walk till end of string\n+        while index < size {\n+            array = Vec::new();","path":"components/script/dom/htmlareaelement.rs","position":56,"original_position":56,"commit_id":"3fbf45812448bd7387acdcd4f5ca0b80d3b894a2","original_commit_id":"3fbf45812448bd7387acdcd4f5ca0b80d3b894a2","user":{"login":"Manishearth","id":1617736,"avatar_url":"https://avatars.githubusercontent.com/u/1617736?v=3","gravatar_id":"","url":"https://api.github.com/users/Manishearth","html_url":"https://github.com/Manishearth","followers_url":"https://api.github.com/users/Manishearth/followers","following_url":"https://api.github.com/users/Manishearth/following{/other_user}","gists_url":"https://api.github.com/users/Manishearth/gists{/gist_id}","starred_url":"https://api.github.com/users/Manishearth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Manishearth/subscriptions","organizations_url":"https://api.github.com/users/Manishearth/orgs","repos_url":"https://api.github.com/users/Manishearth/repos","events_url":"https://api.github.com/users/Manishearth/events{/privacy}","received_events_url":"https://api.github.com/users/Manishearth/received_events","type":"User","site_admin":false},"body":"I think it would be better to initialize it outside the loop, and `clear()` it inside each time (instead of reallocating a new one each time)","created_at":"2016-11-16T21:16:10Z","updated_at":"2016-11-16T21:16:10Z","html_url":"https://github.com/servo/servo/pull/13972#discussion_r88332328","pull_request_url":"https://api.github.com/repos/servo/servo/pulls/13972","_links":{"self":{"href":"https://api.github.com/repos/servo/servo/pulls/comments/88332328"},"html":{"href":"https://github.com/servo/servo/pull/13972#discussion_r88332328"},"pull_request":{"href":"https://api.github.com/repos/servo/servo/pulls/13972"}}},"pull_request":{"url":"https://api.github.com/repos/servo/servo/pulls/13972","id":91479110,"html_url":"https://github.com/servo/servo/pull/13972","diff_url":"https://github.com/servo/servo/pull/13972.diff","patch_url":"https://github.com/servo/servo/pull/13972.patch","issue_url":"https://api.github.com/repos/servo/servo/issues/13972","number":13972,"state":"open","locked":false,"title":"ImageMaps: Implemented support for parsing coord attribute to a shape…","user":{"login":"shravan-achar","id":21150833,"avatar_url":"https://avatars.githubusercontent.com/u/21150833?v=3","gravatar_id":"","url":"https://api.github.com/users/shravan-achar","html_url":"https://github.com/shravan-achar","followers_url":"https://api.github.com/users/shravan-achar/followers","following_url":"https://api.github.com/users/shravan-achar/following{/other_user}","gists_url":"https://api.github.com/users/shravan-achar/gists{/gist_id}","starred_url":"https://api.github.com/users/shravan-achar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shravan-achar/subscriptions","organizations_url":"https://api.github.com/users/shravan-achar/orgs","repos_url":"https://api.github.com/users/shravan-achar/repos","events_url":"https://api.github.com/users/shravan-achar/events{/privacy}","received_events_url":"https://api.github.com/users/shravan-achar/received_events","type":"User","site_admin":false},"body":"<!-- Please describe your changes on the following line: -->\n\nImage Maps: (Part 1) Implemented support for parsing coord attribute to a shape object. \n                       Implemented a hit_test method to see if a point is within the area. Tests for constructors                      and hit_test included\n\n---\n\n<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->\n- [ ] `./mach build -d` does not report any errors\n- [ ] `./mach test-tidy` does not report any errors\n- [ ] These changes fix #__ (github issue number if applicable).\n\n<!-- Either: -->\n- [ ] There are tests for these changes OR\n- [ ] These changes do not require tests because _____\n\n<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->\n\n… object in HTMLAreaElement\n\n<!-- Reviewable:start -->\n\n---\n\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/servo/servo/13972)\n\n<!-- Reviewable:end -->\n","created_at":"2016-10-29T04:58:03Z","updated_at":"2016-11-16T21:21:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34c2af53ca3c1b1f6936898ccc6f642671f3496e","assignee":{"login":"jdm","id":27658,"avatar_url":"https://avatars.githubusercontent.com/u/27658?v=3","gravatar_id":"","url":"https://api.github.com/users/jdm","html_url":"https://github.com/jdm","followers_url":"https://api.github.com/users/jdm/followers","following_url":"https://api.github.com/users/jdm/following{/other_user}","gists_url":"https://api.github.com/users/jdm/gists{/gist_id}","starred_url":"https://api.github.com/users/jdm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdm/subscriptions","organizations_url":"https://api.github.com/users/jdm/orgs","repos_url":"https://api.github.com/users/jdm/repos","events_url":"https://api.github.com/users/jdm/events{/privacy}","received_events_url":"https://api.github.com/users/jdm/received_events","type":"User","site_admin":false},"assignees":[{"login":"jdm","id":27658,"avatar_url":"https://avatars.githubusercontent.com/u/27658?v=3","gravatar_id":"","url":"https://api.github.com/users/jdm","html_url":"https://github.com/jdm","followers_url":"https://api.github.com/users/jdm/followers","following_url":"https://api.github.com/users/jdm/following{/other_user}","gists_url":"https://api.github.com/users/jdm/gists{/gist_id}","starred_url":"https://api.github.com/users/jdm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdm/subscriptions","organizations_url":"https://api.github.com/users/jdm/orgs","repos_url":"https://api.github.com/users/jdm/repos","events_url":"https://api.github.com/users/jdm/events{/privacy}","received_events_url":"https://api.github.com/users/jdm/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/servo/servo/pulls/13972/commits","review_comments_url":"https://api.github.com/repos/servo/servo/pulls/13972/comments","review_comment_url":"https://api.github.com/repos/servo/servo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/servo/servo/issues/13972/comments","statuses_url":"https://api.github.com/repos/servo/servo/statuses/3fbf45812448bd7387acdcd4f5ca0b80d3b894a2","head":{"label":"shravan-achar:master","ref":"master","sha":"3fbf45812448bd7387acdcd4f5ca0b80d3b894a2","user":{"login":"shravan-achar","id":21150833,"avatar_url":"https://avatars.githubusercontent.com/u/21150833?v=3","gravatar_id":"","url":"https://api.github.com/users/shravan-achar","html_url":"https://github.com/shravan-achar","followers_url":"https://api.github.com/users/shravan-achar/followers","following_url":"https://api.github.com/users/shravan-achar/following{/other_user}","gists_url":"https://api.github.com/users/shravan-achar/gists{/gist_id}","starred_url":"https://api.github.com/users/shravan-achar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shravan-achar/subscriptions","organizations_url":"https://api.github.com/users/shravan-achar/orgs","repos_url":"https://api.github.com/users/shravan-achar/repos","events_url":"https://api.github.com/users/shravan-achar/events{/privacy}","received_events_url":"https://api.github.com/users/shravan-achar/received_events","type":"User","site_admin":false},"repo":{"id":72263625,"name":"servo","full_name":"shravan-achar/servo","owner":{"login":"shravan-achar","id":21150833,"avatar_url":"https://avatars.githubusercontent.com/u/21150833?v=3","gravatar_id":"","url":"https://api.github.com/users/shravan-achar","html_url":"https://github.com/shravan-achar","followers_url":"https://api.github.com/users/shravan-achar/followers","following_url":"https://api.github.com/users/shravan-achar/following{/other_user}","gists_url":"https://api.github.com/users/shravan-achar/gists{/gist_id}","starred_url":"https://api.github.com/users/shravan-achar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shravan-achar/subscriptions","organizations_url":"https://api.github.com/users/shravan-achar/orgs","repos_url":"https://api.github.com/users/shravan-achar/repos","events_url":"https://api.github.com/users/shravan-achar/events{/privacy}","received_events_url":"https://api.github.com/users/shravan-achar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shravan-achar/servo","description":"The Servo Browser Engine","fork":true,"url":"https://api.github.com/repos/shravan-achar/servo","forks_url":"https://api.github.com/repos/shravan-achar/servo/forks","keys_url":"https://api.github.com/repos/shravan-achar/servo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shravan-achar/servo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shravan-achar/servo/teams","hooks_url":"https://api.github.com/repos/shravan-achar/servo/hooks","issue_events_url":"https://api.github.com/repos/shravan-achar/servo/issues/events{/number}","events_url":"https://api.github.com/repos/shravan-achar/servo/events","assignees_url":"https://api.github.com/repos/shravan-achar/servo/assignees{/user}","branches_url":"https://api.github.com/repos/shravan-achar/servo/branches{/branch}","tags_url":"https://api.github.com/repos/shravan-achar/servo/tags","blobs_url":"https://api.github.com/repos/shravan-achar/servo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shravan-achar/servo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shravan-achar/servo/git/refs{/sha}","trees_url":"https://api.github.com/repos/shravan-achar/servo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shravan-achar/servo/statuses/{sha}","languages_url":"https://api.github.com/repos/shravan-achar/servo/languages","stargazers_url":"https://api.github.com/repos/shravan-achar/servo/stargazers","contributors_url":"https://api.github.com/repos/shravan-achar/servo/contributors","subscribers_url":"https://api.github.com/repos/shravan-achar/servo/subscribers","subscription_url":"https://api.github.com/repos/shravan-achar/servo/subscription","commits_url":"https://api.github.com/repos/shravan-achar/servo/commits{/sha}","git_commits_url":"https://api.github.com/repos/shravan-achar/servo/git/commits{/sha}","comments_url":"https://api.github.com/repos/shravan-achar/servo/comments{/number}","issue_comment_url":"https://api.github.com/repos/shravan-achar/servo/issues/comments{/number}","contents_url":"https://api.github.com/repos/shravan-achar/servo/contents/{+path}","compare_url":"https://api.github.com/repos/shravan-achar/servo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shravan-achar/servo/merges","archive_url":"https://api.github.com/repos/shravan-achar/servo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shravan-achar/servo/downloads","issues_url":"https://api.github.com/repos/shravan-achar/servo/issues{/number}","pulls_url":"https://api.github.com/repos/shravan-achar/servo/pulls{/number}","milestones_url":"https://api.github.com/repos/shravan-achar/servo/milestones{/number}","notifications_url":"https://api.github.com/repos/shravan-achar/servo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shravan-achar/servo/labels{/name}","releases_url":"https://api.github.com/repos/shravan-achar/servo/releases{/id}","deployments_url":"https://api.github.com/repos/shravan-achar/servo/deployments","created_at":"2016-10-29T03:51:56Z","updated_at":"2016-10-29T05:49:45Z","pushed_at":"2016-11-13T00:32:33Z","git_url":"git://github.com/shravan-achar/servo.git","ssh_url":"git@github.com:shravan-achar/servo.git","clone_url":"https://github.com/shravan-achar/servo.git","svn_url":"https://github.com/shravan-achar/servo","homepage":"https://servo.org/","size":215138,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"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":"servo:master","ref":"master","sha":"516be8f85c0c79b16c3841c60d887661abe91e81","user":{"login":"servo","id":2566135,"avatar_url":"https://avatars.githubusercontent.com/u/2566135?v=3","gravatar_id":"","url":"https://api.github.com/users/servo","html_url":"https://github.com/servo","followers_url":"https://api.github.com/users/servo/followers","following_url":"https://api.github.com/users/servo/following{/other_user}","gists_url":"https://api.github.com/users/servo/gists{/gist_id}","starred_url":"https://api.github.com/users/servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servo/subscriptions","organizations_url":"https://api.github.com/users/servo/orgs","repos_url":"https://api.github.com/users/servo/repos","events_url":"https://api.github.com/users/servo/events{/privacy}","received_events_url":"https://api.github.com/users/servo/received_events","type":"Organization","site_admin":false},"repo":{"id":3390243,"name":"servo","full_name":"servo/servo","owner":{"login":"servo","id":2566135,"avatar_url":"https://avatars.githubusercontent.com/u/2566135?v=3","gravatar_id":"","url":"https://api.github.com/users/servo","html_url":"https://github.com/servo","followers_url":"https://api.github.com/users/servo/followers","following_url":"https://api.github.com/users/servo/following{/other_user}","gists_url":"https://api.github.com/users/servo/gists{/gist_id}","starred_url":"https://api.github.com/users/servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servo/subscriptions","organizations_url":"https://api.github.com/users/servo/orgs","repos_url":"https://api.github.com/users/servo/repos","events_url":"https://api.github.com/users/servo/events{/privacy}","received_events_url":"https://api.github.com/users/servo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/servo/servo","description":"The Servo Browser Engine","fork":false,"url":"https://api.github.com/repos/servo/servo","forks_url":"https://api.github.com/repos/servo/servo/forks","keys_url":"https://api.github.com/repos/servo/servo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/servo/servo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/servo/servo/teams","hooks_url":"https://api.github.com/repos/servo/servo/hooks","issue_events_url":"https://api.github.com/repos/servo/servo/issues/events{/number}","events_url":"https://api.github.com/repos/servo/servo/events","assignees_url":"https://api.github.com/repos/servo/servo/assignees{/user}","branches_url":"https://api.github.com/repos/servo/servo/branches{/branch}","tags_url":"https://api.github.com/repos/servo/servo/tags","blobs_url":"https://api.github.com/repos/servo/servo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/servo/servo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/servo/servo/git/refs{/sha}","trees_url":"https://api.github.com/repos/servo/servo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/servo/servo/statuses/{sha}","languages_url":"https://api.github.com/repos/servo/servo/languages","stargazers_url":"https://api.github.com/repos/servo/servo/stargazers","contributors_url":"https://api.github.com/repos/servo/servo/contributors","subscribers_url":"https://api.github.com/repos/servo/servo/subscribers","subscription_url":"https://api.github.com/repos/servo/servo/subscription","commits_url":"https://api.github.com/repos/servo/servo/commits{/sha}","git_commits_url":"https://api.github.com/repos/servo/servo/git/commits{/sha}","comments_url":"https://api.github.com/repos/servo/servo/comments{/number}","issue_comment_url":"https://api.github.com/repos/servo/servo/issues/comments{/number}","contents_url":"https://api.github.com/repos/servo/servo/contents/{+path}","compare_url":"https://api.github.com/repos/servo/servo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/servo/servo/merges","archive_url":"https://api.github.com/repos/servo/servo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/servo/servo/downloads","issues_url":"https://api.github.com/repos/servo/servo/issues{/number}","pulls_url":"https://api.github.com/repos/servo/servo/pulls{/number}","milestones_url":"https://api.github.com/repos/servo/servo/milestones{/number}","notifications_url":"https://api.github.com/repos/servo/servo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/servo/servo/labels{/name}","releases_url":"https://api.github.com/repos/servo/servo/releases{/id}","deployments_url":"https://api.github.com/repos/servo/servo/deployments","created_at":"2012-02-08T19:07:25Z","updated_at":"2016-11-16T20:12:26Z","pushed_at":"2016-11-16T21:06:00Z","git_url":"git://github.com/servo/servo.git","ssh_url":"git@github.com:servo/servo.git","clone_url":"https://github.com/servo/servo.git","svn_url":"https://github.com/servo/servo","homepage":"https://servo.org/","size":313390,"stargazers_count":8267,"watchers_count":8267,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1349,"mirror_url":null,"open_issues_count":1894,"forks":1349,"open_issues":1894,"watchers":8267,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/servo/servo/pulls/13972"},"html":{"href":"https://github.com/servo/servo/pull/13972"},"issue":{"href":"https://api.github.com/repos/servo/servo/issues/13972"},"comments":{"href":"https://api.github.com/repos/servo/servo/issues/13972/comments"},"review_comments":{"href":"https://api.github.com/repos/servo/servo/pulls/13972/comments"},"review_comment":{"href":"https://api.github.com/repos/servo/servo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/servo/servo/pulls/13972/commits"},"statuses":{"href":"https://api.github.com/repos/servo/servo/statuses/3fbf45812448bd7387acdcd4f5ca0b80d3b894a2"}}}}
{"actor":{"display_login":"Manishearth"}}