Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: third_party/WebKit/Source/web/WebFormControlElement.cpp

Issue 2161963003: Make autofill dropdown to obey text-align: left|right CSS property. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 int WebFormControlElement::selectionEnd() const 179 int WebFormControlElement::selectionEnd() const
180 { 180 {
181 if (isHTMLInputElement(*m_private)) 181 if (isHTMLInputElement(*m_private))
182 return constUnwrap<HTMLInputElement>()->selectionEnd(); 182 return constUnwrap<HTMLInputElement>()->selectionEnd();
183 if (isHTMLTextAreaElement(*m_private)) 183 if (isHTMLTextAreaElement(*m_private))
184 return constUnwrap<HTMLTextAreaElement>()->selectionEnd(); 184 return constUnwrap<HTMLTextAreaElement>()->selectionEnd();
185 return 0; 185 return 0;
186 } 186 }
187 187
188 WebString WebFormControlElement::alignmentForFormData() const
189 {
190 if (const ComputedStyle* style = constUnwrap<HTMLFormControlElement>()->comp utedStyle()) {
191 if (style->textAlign() == RIGHT)
192 return WebString::fromUTF8("right");
193 if (style->textAlign() == LEFT)
194 return WebString::fromUTF8("left");
195 }
196 return WebString();
197 }
198
188 WebString WebFormControlElement::directionForFormData() const 199 WebString WebFormControlElement::directionForFormData() const
189 { 200 {
190 if (const ComputedStyle* style = constUnwrap<HTMLFormControlElement>()->comp utedStyle()) 201 if (const ComputedStyle* style = constUnwrap<HTMLFormControlElement>()->comp utedStyle()) {
191 return style->isLeftToRightDirection() ? WebString::fromUTF8("ltr") : We bString::fromUTF8("rtl"); 202 return style->isLeftToRightDirection() ? WebString::fromUTF8("ltr") : We bString::fromUTF8("rtl");
203 }
192 return WebString::fromUTF8("ltr"); 204 return WebString::fromUTF8("ltr");
193 } 205 }
194 206
195 WebFormElement WebFormControlElement::form() const 207 WebFormElement WebFormControlElement::form() const
196 { 208 {
197 return WebFormElement(constUnwrap<HTMLFormControlElement>()->form()); 209 return WebFormElement(constUnwrap<HTMLFormControlElement>()->form());
198 } 210 }
199 211
200 WebFormControlElement::WebFormControlElement(HTMLFormControlElement*elem) 212 WebFormControlElement::WebFormControlElement(HTMLFormControlElement*elem)
201 : WebElement(elem) 213 : WebElement(elem)
202 { 214 {
203 } 215 }
204 216
205 DEFINE_WEB_NODE_TYPE_CASTS(WebFormControlElement, isElementNode() && constUnwrap <Element>()->isFormControlElement()); 217 DEFINE_WEB_NODE_TYPE_CASTS(WebFormControlElement, isElementNode() && constUnwrap <Element>()->isFormControlElement());
206 218
207 WebFormControlElement& WebFormControlElement::operator=(HTMLFormControlElement*e lem) 219 WebFormControlElement& WebFormControlElement::operator=(HTMLFormControlElement*e lem)
208 { 220 {
209 m_private = elem; 221 m_private = elem;
210 return *this; 222 return *this;
211 } 223 }
212 224
213 WebFormControlElement::operator HTMLFormControlElement*() const 225 WebFormControlElement::operator HTMLFormControlElement*() const
214 { 226 {
215 return toHTMLFormControlElement(m_private.get()); 227 return toHTMLFormControlElement(m_private.get());
216 } 228 }
217 229
218 } // namespace blink 230 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698