|
Lines 31-36
a/Source/WebCore/html/ColorInputType.cpp_sec1
|
| 31 |
#include "config.h" |
31 |
#include "config.h" |
| 32 |
#include "ColorInputType.h" |
32 |
#include "ColorInputType.h" |
| 33 |
|
33 |
|
|
|
34 |
#include "CSSPropertyNames.h" |
| 34 |
#include "Chrome.h" |
35 |
#include "Chrome.h" |
| 35 |
#include "Color.h" |
36 |
#include "Color.h" |
| 36 |
#include "HTMLDivElement.h" |
37 |
#include "HTMLDivElement.h" |
|
Lines 38-43
a/Source/WebCore/html/ColorInputType.cpp_sec2
|
| 38 |
#include "MouseEvent.h" |
39 |
#include "MouseEvent.h" |
| 39 |
#include "ScriptController.h" |
40 |
#include "ScriptController.h" |
| 40 |
#include "ShadowRoot.h" |
41 |
#include "ShadowRoot.h" |
|
|
42 |
|
| 41 |
#include <wtf/PassOwnPtr.h> |
43 |
#include <wtf/PassOwnPtr.h> |
| 42 |
#include <wtf/text/WTFString.h> |
44 |
#include <wtf/text/WTFString.h> |
| 43 |
|
45 |
|
|
Lines 66-72
PassOwnPtr<InputType> ColorInputType::create(HTMLInputElement* element)
a/Source/WebCore/html/ColorInputType.cpp_sec3
|
| 66 |
|
68 |
|
| 67 |
ColorInputType::~ColorInputType() |
69 |
ColorInputType::~ColorInputType() |
| 68 |
{ |
70 |
{ |
| 69 |
cleanupColorChooser(); |
71 |
endColorChooser(); |
| 70 |
} |
72 |
} |
| 71 |
|
73 |
|
| 72 |
bool ColorInputType::isColorControl() const |
74 |
bool ColorInputType::isColorControl() const |
|
Lines 126-134
void ColorInputType::setValue(const String& value, bool valueChanged, bool sendC
a/Source/WebCore/html/ColorInputType.cpp_sec4
|
| 126 |
return; |
128 |
return; |
| 127 |
|
129 |
|
| 128 |
updateColorSwatch(); |
130 |
updateColorSwatch(); |
| 129 |
Chrome* chrome = this->chrome(); |
131 |
if (m_chooser) |
| 130 |
if (chrome && chooser()) |
132 |
m_chooser->setSelectedColor(valueAsColor()); |
| 131 |
chrome->setSelectedColorInColorChooser(chooser(), valueAsColor()); |
|
|
| 132 |
} |
133 |
} |
| 133 |
|
134 |
|
| 134 |
void ColorInputType::handleDOMActivateEvent(Event* event) |
135 |
void ColorInputType::handleDOMActivateEvent(Event* event) |
|
Lines 139-152
void ColorInputType::handleDOMActivateEvent(Event* event)
a/Source/WebCore/html/ColorInputType.cpp_sec5
|
| 139 |
if (!ScriptController::processingUserGesture()) |
140 |
if (!ScriptController::processingUserGesture()) |
| 140 |
return; |
141 |
return; |
| 141 |
|
142 |
|
| 142 |
if (Chrome* chrome = this->chrome()) |
143 |
Chrome* chrome = this->chrome(); |
| 143 |
chrome->openColorChooser(newColorChooser(), valueAsColor()); |
144 |
if (chrome && !m_chooser) |
|
|
145 |
m_chooser = chrome->createColorChooser(this, valueAsColor()); |
| 146 |
|
| 144 |
event->setDefaultHandled(); |
147 |
event->setDefaultHandled(); |
| 145 |
} |
148 |
} |
| 146 |
|
149 |
|
| 147 |
void ColorInputType::detach() |
150 |
void ColorInputType::detach() |
| 148 |
{ |
151 |
{ |
| 149 |
cleanupColorChooser(); |
152 |
endColorChooser(); |
| 150 |
} |
153 |
} |
| 151 |
|
154 |
|
| 152 |
void ColorInputType::didChooseColor(const Color& color) |
155 |
void ColorInputType::didChooseColor(const Color& color) |
|
Lines 158-174
void ColorInputType::didChooseColor(const Color& color)
a/Source/WebCore/html/ColorInputType.cpp_sec6
|
| 158 |
element()->dispatchFormControlChangeEvent(); |
161 |
element()->dispatchFormControlChangeEvent(); |
| 159 |
} |
162 |
} |
| 160 |
|
163 |
|
| 161 |
void ColorInputType::didCleanup() |
164 |
void ColorInputType::didEndChooser() |
| 162 |
{ |
165 |
{ |
| 163 |
discardChooser(); |
166 |
m_chooser.clear(); |
| 164 |
} |
167 |
} |
| 165 |
|
168 |
|
| 166 |
void ColorInputType::cleanupColorChooser() |
169 |
void ColorInputType::endColorChooser() |
| 167 |
{ |
170 |
{ |
| 168 |
Chrome* chrome = this->chrome(); |
171 |
if (m_chooser) |
| 169 |
if (chrome && chooser()) |
172 |
m_chooser->endChooser(); |
| 170 |
chrome->cleanupColorChooser(chooser()); |
|
|
| 171 |
discardChooser(); |
| 172 |
} |
173 |
} |
| 173 |
|
174 |
|
| 174 |
void ColorInputType::updateColorSwatch() |
175 |
void ColorInputType::updateColorSwatch() |
|
Lines 177-184
void ColorInputType::updateColorSwatch()
a/Source/WebCore/html/ColorInputType.cpp_sec7
|
| 177 |
if (!colorSwatch) |
178 |
if (!colorSwatch) |
| 178 |
return; |
179 |
return; |
| 179 |
|
180 |
|
| 180 |
ExceptionCode ec; |
181 |
colorSwatch->style()->setProperty(CSSPropertyBackgroundColor, element()->value(), false, ASSERT_NO_EXCEPTION); |
| 181 |
colorSwatch->style()->setProperty("background-color", element()->value(), ec); |
|
|
| 182 |
} |
182 |
} |
| 183 |
|
183 |
|
| 184 |
HTMLElement* ColorInputType::shadowColorSwatch() const |
184 |
HTMLElement* ColorInputType::shadowColorSwatch() const |