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

Side by Side Diff: Source/web/WebSelectElement.cpp

Issue 194923003: Move common methods to WebFormControlElement interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/web/WebInputElement.cpp ('k') | Source/web/WebTextAreaElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 23 matching lines...) Expand all
34 #include "HTMLNames.h" 34 #include "HTMLNames.h"
35 #include "core/html/HTMLOptionElement.h" 35 #include "core/html/HTMLOptionElement.h"
36 #include "core/html/HTMLSelectElement.h" 36 #include "core/html/HTMLSelectElement.h"
37 #include "public/platform/WebString.h" 37 #include "public/platform/WebString.h"
38 #include "wtf/PassRefPtr.h" 38 #include "wtf/PassRefPtr.h"
39 39
40 using namespace WebCore; 40 using namespace WebCore;
41 41
42 namespace blink { 42 namespace blink {
43 43
44 void WebSelectElement::setValue(const WebString& value)
45 {
46 unwrap<HTMLSelectElement>()->setValue(value);
47 }
48
49 WebString WebSelectElement::value() const
50 {
51 return constUnwrap<HTMLSelectElement>()->value();
52 }
53
54 WebVector<WebElement> WebSelectElement::listItems() const 44 WebVector<WebElement> WebSelectElement::listItems() const
55 { 45 {
56 const Vector<HTMLElement*>& sourceItems = constUnwrap<HTMLSelectElement>()-> listItems(); 46 const Vector<HTMLElement*>& sourceItems = constUnwrap<HTMLSelectElement>()-> listItems();
57 WebVector<WebElement> items(sourceItems.size()); 47 WebVector<WebElement> items(sourceItems.size());
58 for (size_t i = 0; i < sourceItems.size(); ++i) 48 for (size_t i = 0; i < sourceItems.size(); ++i)
59 items[i] = WebElement(sourceItems[i]); 49 items[i] = WebElement(sourceItems[i]);
60 50
61 return items; 51 return items;
62 } 52 }
63 53
64 WebSelectElement::WebSelectElement(const PassRefPtr<HTMLSelectElement>& element) 54 WebSelectElement::WebSelectElement(const PassRefPtr<HTMLSelectElement>& element)
65 : WebFormControlElement(element) 55 : WebFormControlElement(element)
66 { 56 {
67 } 57 }
68 58
69 WebSelectElement& WebSelectElement::operator=(const PassRefPtr<HTMLSelectElement >& element) 59 WebSelectElement& WebSelectElement::operator=(const PassRefPtr<HTMLSelectElement >& element)
70 { 60 {
71 m_private = element; 61 m_private = element;
72 return *this; 62 return *this;
73 } 63 }
74 64
75 WebSelectElement::operator PassRefPtr<HTMLSelectElement>() const 65 WebSelectElement::operator PassRefPtr<HTMLSelectElement>() const
76 { 66 {
77 return toHTMLSelectElement(m_private.get()); 67 return toHTMLSelectElement(m_private.get());
78 } 68 }
79 69
80 } // namespace blink 70 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebInputElement.cpp ('k') | Source/web/WebTextAreaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698