RESOLVED FIXED 23015
RenderTextControl relies on HTMLFormControlElement, making it hard to reuse for WML
https://bugs.webkit.org/show_bug.cgi?id=23015
Summary RenderTextControl relies on HTMLFormControlElement, making it hard to reuse f...
Nikolas Zimmermann
Reported 2008-12-28 14:36:51 PST
RenderTextControl relies on HTMLFormControlElement, and is not usable within WML at the moment. One possibility would be to introduce a FormControlElement abstract class, containing two pure-virtual functions: setValueMatchesRenderer/valueMatchesRenderer, as these methods are in use from within RenderTextControl. As RenderObject stores a Node* pointer only, we'd also need to store a FormControlElement pointer in RenderTextControl, as we aren't allowed to cast node() to HTMLFormControlElement, as we want to abstract away the HTML-dependency. As Node got enough unused bits left, it's easier to store "bool m_controlValueMatchesRenderer : 1" in Node and add non-virtual getter/setter methods. This way RenderTextControl saves all casts from Node -> HTMLFormControlElement and the HTML dependency is gone.
Attachments
Initial patch (11.83 KB, patch)
2008-12-28 14:59 PST, Nikolas Zimmermann
sam: review-
Updated patch (17.28 KB, patch)
2008-12-28 16:09 PST, Nikolas Zimmermann
koivisto: review+
Nikolas Zimmermann
Comment 1 2008-12-28 14:59:49 PST
Created attachment 26283 [details] Initial patch
Sam Weinig
Comment 2 2008-12-28 15:26:50 PST
Comment on attachment 26283 [details] Initial patch It's a little sad to be using bits in Node for something as rare as a RenderTextControl. Otherwise, the patch seems fine. r=me
Nikolas Zimmermann
Comment 3 2008-12-28 15:50:45 PST
As discussed with Antti & Sam, adding memory to RenderTextControl is not as bad as adding too specialized data (only needed for form control elements) to Node. I'll upload a revised version, implementing my first idea: a shared ABC.
Nikolas Zimmermann
Comment 4 2008-12-28 16:09:35 PST
Created attachment 26285 [details] Updated patch Found a much nicer way to refactor, without adding any extra memory consumption.
Nikolas Zimmermann
Comment 5 2008-12-28 16:17:09 PST
Landed in r39495.
Note You need to log in before you can comment on or make changes to this bug.