Created attachment 34352[details]
Preliminary patch
This is the piece of code which I need some help about:
bool HTMLFormControlElement::isDefaultButtonForForm() const
{
if (!isSuccessfulSubmitButton() || !m_form)
return false;
return isSameNode(m_form->defaultButton()); // equivalent to m_form->defaultButton() == this;
}
This method is called by CSSStyleSelector to match element's style but, for reasons I can't quite understand, it always returns true on this test:
<input name="victim" type="submit" value="Submit" /> <- It should match only this one
<input name="victim" type="submit" value="Submit"/>
<input name="victim" type="submit" value="Submit"/>
However, the right style is matched if one of the two "not default" submit buttons is kept pressed: try to apply the patch and keep pressed one of the last two buttons in the test.
So, the question is quite simple: there should be a way to check univocally one element's against another. Node::isEqualNode() isn't the answer for sure.
I tought that this issue can depend on something related to the attachment thread but I'm not certain about it: any kind of help would be much appreciated.
m_form->defaultButton() always returns the first submit button, take it as functioning.:)

You should never use isSameNode in C++ code. It's only there because it's part of the DOM standard. To check if two nodes are the same you should just use ==. I am almost certain the problem you're having is not due to the "==" check -- you can verify that with some printf debugging.
I believe you're having trouble because of style sharing. I don't have time to explain it right now, but two identical elements will share style, and the style sharing mechanism doesn't know that these elements can't share style.