Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented HTMLInputElement placeholder attribute #5385

Closed
wants to merge 1 commit into from
Closed

Implemented HTMLInputElement placeholder attribute #5385

wants to merge 1 commit into from

Conversation

minsumm
Copy link
Contributor

@minsumm minsumm commented Mar 26, 2015

I'm unsure whether I should wrap 'placeholder' in Cell, or DomRefCell, or leave as it is now.
Also, the spec says that the placeholder should be presented with line breaks stripped off,
should it be done in this stage?

@hoppipolla-critic-bot
Copy link

Critic review: https://critic.hoppipolla.co.uk/r/4383

This is an external review system which you may optionally use for the code review of your pull request.

In order to help critic track your changes, please do not make in-place history rewrites (e.g. via git rebase -i or git commit --amend) when updating this pull request.

@highfive
Copy link

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @metajack (or someone else) soon.

@highfive
Copy link

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@Ms2ger Ms2ger added the S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. label Mar 26, 2015
@jdm
Copy link
Member

jdm commented Mar 26, 2015

@Genkku This is a good start! I've left comments on Critic; the most important takeaway is that testing your changes would have demonstrated that the implementation is not yet complete :)

@jdm jdm added the S-needs-code-changes Changes have not yet been made that were requested by a reviewer. label Mar 26, 2015
@minsumm
Copy link
Contributor Author

minsumm commented Mar 26, 2015

@jdm Doh! I was also unsure about which tests where relevant. I'll try to make sense of the required changes.

@jdm
Copy link
Member

jdm commented Mar 26, 2015

The spec link in the original issue has a decent HTML example that would show the desired behaviour in the browser of your choice.

@metajack
Copy link
Contributor

Assigning to @jdm since he already did the initial pass.

@minsumm
Copy link
Contributor Author

minsumm commented Apr 1, 2015

Sorry for the lack of communication. What's the status? Can I still finish this, as I've implemented the feature and it works when testing with servo. I'm now working on the tests.

Also, there's a small problem relating to string_cache:
If I've understood correctly I should be matching against

&atom!("placeholder")

Now this fails, since string_cache doesn't have "placeholder" in 'plugin/src/atom/data.rs'.

I locally made the change and tested that it works. Should I make pull request to string_cache?

@jdm
Copy link
Member

jdm commented Apr 1, 2015

For now, you can just use Atom::from_slice("placeholder") instead of using the atom macro. And yes, do go ahead and finish this work - we're just assigning the PRs to team members as a way of saying "you're responsible for making sure this PR doesn't get forgotten".

@minsumm
Copy link
Contributor Author

minsumm commented Apr 1, 2015

It might be that I'm confused and using Atom::from_slice("placeholder") in a wrong way, but it seems that it can't be matched against. Various unsatisfactory hacks don't work either (local variables, constants, etc.)

I fixed the test expectations that we're expected to fail, but I'm also getting a few failed tests. I'm unsure whether they're related to the changes I've made:

/html/browsers/history/the-location-interface/security_location_0.sub.htm
-------------------------------------------------------------------------
NOTRUN Accessing location object from different origins doesn't raise SECURITY_ERR exception
TIMEOUT expected CRASH [Parent]
/html/browsers/the-window-object/security-window/window-security.sub.html
-------------------------------------------------------------------------
NOTRUN Window Security testing
TIMEOUT expected CRASH [Parent]
/html/dom/reflection-forms.html
-------------------------------
TIMEOUT [Parent]
/html/dom/reflection-misc.html
------------------------------
TIMEOUT [Parent]
/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setTimeout.html
----------------------------------------------------------------------------------------
FAIL expected NOTRUN window.onerror - compile error in cross-origin setTimeout
FAIL expected NOTRUN window.onerror - compile error in cross-origin setTimeout (column)
OK expected TIMEOUT [Parent]
/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setInterval.html
-----------------------------------------------------------------------------------------
FAIL expected NOTRUN window.onerror - compile error in cross-origin setInterval
FAIL expected NOTRUN window.onerror - compile error in cross-origin setInterval (column)
OK expected TIMEOUT [Parent]
/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setInterval.html
-----------------------------------------------------------------------------------------
FAIL expected NOTRUN window.onerror - runtime error in cross-origin setInterval
FAIL expected NOTRUN window.onerror - runtime error in cross-origin setInterval (column)
OK expected TIMEOUT [Parent]
/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setTimeout.html
----------------------------------------------------------------------------------------
FAIL expected NOTRUN window.onerror - runtime error in cross-origin setTimeout
FAIL expected NOTRUN window.onerror - runtime error in cross-origin setTimeout (column)
OK expected TIMEOUT [Parent]
/html/semantics/text-level-semantics/the-wbr-element/wbr-element.html
---------------------------------------------------------------------
TIMEOUT expected FAIL [Parent]

@jdm
Copy link
Member

jdm commented Apr 1, 2015

I admit that I don't know what to make of that. The first two look like the changes from #5476, and I've seen the reflection ones time out before for testharness-related reasons, but the rest are super weird. Maybe try submitting the changes you have and we'll see what happens on the test machines?

@jdm
Copy link
Member

jdm commented Apr 1, 2015

With regards to Atom::from_slice, are you using &Atom::from_slice where you would use &atom!?

@jdm
Copy link
Member

jdm commented Apr 1, 2015

Oh wait, that probably doesn't work. You may need a separate _ if foo == Atom::from_slice("placeholder") => branch.

@minsumm
Copy link
Contributor Author

minsumm commented Apr 1, 2015

I failed to find a way to accomplish this without excessive mutation. I'm also wondering if there's a more idiomatic way to strip the line breaks.

@jdm
Copy link
Member

jdm commented Apr 1, 2015

http://mxr.mozilla.org/servo/source/components/script/dom/window.rs#249 is a nice example of removing whitespace from strings.

@jdm
Copy link
Member

jdm commented Apr 1, 2015

I've left some more comments on Critic, but this is looking much more like what I was expecting :)

@jdm jdm removed the S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. label Apr 1, 2015
@minsumm
Copy link
Contributor Author

minsumm commented Apr 2, 2015

I tried removing the to_owned() on line 159, but it fails: 'cannot move out of borrowed content'.

@jdm
Copy link
Member

jdm commented Apr 2, 2015

One teeny little style nit left, and then it's mergeable!

@minsumm
Copy link
Contributor Author

minsumm commented Apr 2, 2015

Haha, I got a bit ahead of myself and let that one slip past me :)

@jdm jdm added S-needs-squash Some (or all) of the commits in the PR should be combined. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Apr 2, 2015
@jdm
Copy link
Member

jdm commented Apr 2, 2015

Squash!

+ modified HTMLInputElement.webidl to include placeholder
+ modified placeholder test expectations
@minsumm
Copy link
Contributor Author

minsumm commented Apr 4, 2015

@jdm hopefully everything is fine and dandy now!

@jdm jdm added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Apr 4, 2015
@jdm jdm removed the S-needs-squash Some (or all) of the commits in the PR should be combined. label Apr 4, 2015
bors-servo pushed a commit that referenced this pull request Apr 4, 2015
I'm unsure whether I should wrap 'placeholder' in Cell, or DomRefCell, or leave as it is now.
Also, the spec says that the placeholder should be presented with line breaks stripped off,
should it be done in this stage?
bors-servo pushed a commit that referenced this pull request Apr 4, 2015
I'm unsure whether I should wrap 'placeholder' in Cell, or DomRefCell, or leave as it is now.
Also, the spec says that the placeholder should be presented with line breaks stripped off,
should it be done in this stage?
@bors-servo bors-servo closed this Apr 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants