| Differences between
and this patch
- a/Source/WebCore/ChangeLog +54 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2014-03-04  Zan Dobersek  <zdobersek@igalia.com>
2
3
        Move the rest of Source/WebCore/html/ code to std::unique_ptr
4
        https://bugs.webkit.org/show_bug.cgi?id=129669
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Replace the remaining uses of OwnPtr, PassOwnPtr under Source/WebCore/html/ with std::unique_ptr.
9
10
        * html/FormController.cpp:
11
        (WebCore::SavedFormState::SavedFormState):
12
        (WebCore::SavedFormState::deserialize):
13
        (WebCore::FormController::createSavedFormStateMap):
14
        (WebCore::FormController::formElementsState):
15
        (WebCore::FormController::takeStateForFormElement):
16
        (WebCore::FormController::formStatesFromStateVector):
17
        * html/FormController.h:
18
        * html/HTMLAreaElement.cpp:
19
        (WebCore::HTMLAreaElement::mapMouseEvent):
20
        * html/HTMLAreaElement.h:
21
        * html/HTMLCanvasElement.cpp:
22
        (WebCore::HTMLCanvasElement::setSurfaceSize):
23
        (WebCore::HTMLCanvasElement::createImageBuffer):
24
        * html/HTMLCanvasElement.h:
25
        * html/HTMLCollection.h:
26
        * html/HTMLEmbedElement.cpp:
27
        (WebCore::HTMLEmbedElement::parseAttribute):
28
        * html/HTMLFormControlElement.cpp:
29
        (WebCore::HTMLFormControlElement::updateVisibleValidationMessage):
30
        * html/HTMLFormControlElement.h:
31
        * html/HTMLFormElement.cpp:
32
        (WebCore::HTMLFormElement::addToPastNamesMap):
33
        * html/HTMLFormElement.h:
34
        * html/HTMLInputElement.cpp:
35
        (WebCore::HTMLInputElement::imageLoader):
36
        (WebCore::HTMLInputElement::resetListAttributeTargetObserver):
37
        * html/HTMLInputElement.h:
38
        (WebCore::HTMLInputElement::hasImageLoader):
39
        * html/HTMLObjectElement.cpp:
40
        (WebCore::HTMLObjectElement::parseAttribute):
41
        * html/HTMLPlugInImageElement.cpp:
42
        (WebCore::HTMLPlugInImageElement::startLoadingImage):
43
        * html/HTMLPlugInImageElement.h:
44
        * html/HTMLVideoElement.cpp:
45
        (WebCore::HTMLVideoElement::didAttachRenderers):
46
        (WebCore::HTMLVideoElement::parseAttribute):
47
        * html/HTMLVideoElement.h:
48
        * html/ValidationMessage.cpp:
49
        (WebCore::ValidationMessage::ValidationMessage):
50
        (WebCore::ValidationMessage::setMessage):
51
        (WebCore::ValidationMessage::setMessageDOMAndStartTimer):
52
        (WebCore::ValidationMessage::requestToHideMessage):
53
        * html/ValidationMessage.h:
54
1
2014-03-03  Sanghyup Lee  <sh53.lee@samsung.com>
55
2014-03-03  Sanghyup Lee  <sh53.lee@samsung.com>
2
56
3
        :active style is not cleared when its display property is set to none before mouse released.
57
        :active style is not cleared when its display property is set to none before mouse released.
- a/Source/WebCore/html/FormController.cpp -27 / +22 lines
Lines 173-180 class SavedFormState { a/Source/WebCore/html/FormController.cpp_sec1
173
    WTF_MAKE_FAST_ALLOCATED;
173
    WTF_MAKE_FAST_ALLOCATED;
174
174
175
public:
175
public:
176
    static OwnPtr<SavedFormState> create();
176
    SavedFormState()
177
    static OwnPtr<SavedFormState> deserialize(const Vector<String>&, size_t& index);
177
        : m_controlStateCount(0)
178
    {
179
    }
180
181
    static std::unique_ptr<SavedFormState> deserialize(const Vector<String>&, size_t& index);
178
    void serializeTo(Vector<String>&) const;
182
    void serializeTo(Vector<String>&) const;
179
    bool isEmpty() const { return m_stateForNewFormElements.isEmpty(); }
183
    bool isEmpty() const { return m_stateForNewFormElements.isEmpty(); }
180
    void appendControlState(const AtomicString& name, const AtomicString& type, const FormControlState&);
184
    void appendControlState(const AtomicString& name, const AtomicString& type, const FormControlState&);
Lines 183-206 public: a/Source/WebCore/html/FormController.cpp_sec2
183
    Vector<String> getReferencedFilePaths() const;
187
    Vector<String> getReferencedFilePaths() const;
184
188
185
private:
189
private:
186
    SavedFormState() : m_controlStateCount(0) { }
187
188
    typedef HashMap<FormElementKey, Deque<FormControlState>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap;
190
    typedef HashMap<FormElementKey, Deque<FormControlState>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap;
189
    FormElementStateMap m_stateForNewFormElements;
191
    FormElementStateMap m_stateForNewFormElements;
190
    size_t m_controlStateCount;
192
    size_t m_controlStateCount;
191
};
193
};
192
194
193
OwnPtr<SavedFormState> SavedFormState::create()
194
{
195
    return adoptPtr(new SavedFormState);
196
}
197
198
static bool isNotFormControlTypeCharacter(UChar ch)
195
static bool isNotFormControlTypeCharacter(UChar ch)
199
{
196
{
200
    return ch != '-' && (ch > 'z' || ch < 'a');
197
    return ch != '-' && (ch > 'z' || ch < 'a');
201
}
198
}
202
199
203
OwnPtr<SavedFormState> SavedFormState::deserialize(const Vector<String>& stateVector, size_t& index)
200
std::unique_ptr<SavedFormState> SavedFormState::deserialize(const Vector<String>& stateVector, size_t& index)
204
{
201
{
205
    if (index >= stateVector.size())
202
    if (index >= stateVector.size())
206
        return nullptr;
203
        return nullptr;
Lines 208-214 OwnPtr<SavedFormState> SavedFormState::deserialize(const Vector<String>& stateVe a/Source/WebCore/html/FormController.cpp_sec3
208
    size_t itemCount = stateVector[index++].toUInt();
205
    size_t itemCount = stateVector[index++].toUInt();
209
    if (!itemCount)
206
    if (!itemCount)
210
        return nullptr;
207
        return nullptr;
211
    OwnPtr<SavedFormState> savedFormState = adoptPtr(new SavedFormState);
208
    auto savedFormState = std::make_unique<SavedFormState>();
212
    while (itemCount--) {
209
    while (itemCount--) {
213
        if (index + 1 >= stateVector.size())
210
        if (index + 1 >= stateVector.size())
214
            return nullptr;
211
            return nullptr;
Lines 219-225 OwnPtr<SavedFormState> SavedFormState::deserialize(const Vector<String>& stateVe a/Source/WebCore/html/FormController.cpp_sec4
219
            return nullptr;
216
            return nullptr;
220
        savedFormState->appendControlState(name, type, state);
217
        savedFormState->appendControlState(name, type, state);
221
    }
218
    }
222
    return savedFormState.release();
219
    return std::move(savedFormState);
223
}
220
}
224
221
225
void SavedFormState::serializeTo(Vector<String>& stateVector) const
222
void SavedFormState::serializeTo(Vector<String>& stateVector) const
Lines 289-301 class FormKeyGenerator { a/Source/WebCore/html/FormController.cpp_sec5
289
    WTF_MAKE_FAST_ALLOCATED;
286
    WTF_MAKE_FAST_ALLOCATED;
290
287
291
public:
288
public:
292
    static OwnPtr<FormKeyGenerator> create() { return adoptPtr(new FormKeyGenerator); }
289
    FormKeyGenerator() = default;
293
    AtomicString formKey(const HTMLFormControlElementWithState&);
290
    AtomicString formKey(const HTMLFormControlElementWithState&);
294
    void willDeleteForm(HTMLFormElement*);
291
    void willDeleteForm(HTMLFormElement*);
295
292
296
private:
293
private:
297
    FormKeyGenerator() { }
298
299
    typedef HashMap<HTMLFormElement*, AtomicString> FormToKeyMap;
294
    typedef HashMap<HTMLFormElement*, AtomicString> FormToKeyMap;
300
    typedef HashMap<String, unsigned> FormSignatureToNextIndexMap;
295
    typedef HashMap<String, unsigned> FormSignatureToNextIndexMap;
301
    FormToKeyMap m_formToKeyMap;
296
    FormToKeyMap m_formToKeyMap;
Lines 399-423 static String formStateSignature() a/Source/WebCore/html/FormController.cpp_sec6
399
    return signature;
394
    return signature;
400
}
395
}
401
396
402
OwnPtr<FormController::SavedFormStateMap> FormController::createSavedFormStateMap(const FormElementListHashSet& controlList)
397
std::unique_ptr<FormController::SavedFormStateMap> FormController::createSavedFormStateMap(const FormElementListHashSet& controlList)
403
{
398
{
404
    OwnPtr<FormKeyGenerator> keyGenerator = FormKeyGenerator::create();
399
    auto keyGenerator = std::make_unique<FormKeyGenerator>();
405
    OwnPtr<SavedFormStateMap> stateMap = adoptPtr(new SavedFormStateMap);
400
    auto stateMap = std::make_unique<SavedFormStateMap>();
406
    for (FormElementListHashSet::const_iterator it = controlList.begin(); it != controlList.end(); ++it) {
401
    for (FormElementListHashSet::const_iterator it = controlList.begin(); it != controlList.end(); ++it) {
407
        HTMLFormControlElementWithState* control = it->get();
402
        HTMLFormControlElementWithState* control = it->get();
408
        if (!control->shouldSaveAndRestoreFormControlState())
403
        if (!control->shouldSaveAndRestoreFormControlState())
409
            continue;
404
            continue;
410
        SavedFormStateMap::AddResult result = stateMap->add(keyGenerator->formKey(*control).impl(), nullptr);
405
        auto& formState = stateMap->add(keyGenerator->formKey(*control).impl(), nullptr).iterator->value;
411
        if (result.isNewEntry)
406
        if (!formState)
412
            result.iterator->value = SavedFormState::create();
407
            formState = std::make_unique<SavedFormState>();
413
        result.iterator->value->appendControlState(control->name(), control->type(), control->saveFormControlState());
408
        formState->appendControlState(control->name(), control->type(), control->saveFormControlState());
414
    }
409
    }
415
    return stateMap.release();
410
    return std::move(stateMap);
416
}
411
}
417
412
418
Vector<String> FormController::formElementsState() const
413
Vector<String> FormController::formElementsState() const
419
{
414
{
420
    OwnPtr<SavedFormStateMap> stateMap = createSavedFormStateMap(m_formElementsWithState);
415
    std::unique_ptr<SavedFormStateMap> stateMap = createSavedFormStateMap(m_formElementsWithState);
421
    Vector<String> stateVector;
416
    Vector<String> stateVector;
422
    stateVector.reserveInitialCapacity(m_formElementsWithState.size() * 4);
417
    stateVector.reserveInitialCapacity(m_formElementsWithState.size() * 4);
423
    stateVector.append(formStateSignature());
418
    stateVector.append(formStateSignature());
Lines 441-447 FormControlState FormController::takeStateForFormElement(const HTMLFormControlEl a/Source/WebCore/html/FormController.cpp_sec7
441
    if (m_savedFormStateMap.isEmpty())
436
    if (m_savedFormStateMap.isEmpty())
442
        return FormControlState();
437
        return FormControlState();
443
    if (!m_formKeyGenerator)
438
    if (!m_formKeyGenerator)
444
        m_formKeyGenerator = FormKeyGenerator::create();
439
        m_formKeyGenerator = std::make_unique<FormKeyGenerator>();
445
    SavedFormStateMap::iterator it = m_savedFormStateMap.find(m_formKeyGenerator->formKey(control).impl());
440
    SavedFormStateMap::iterator it = m_savedFormStateMap.find(m_formKeyGenerator->formKey(control).impl());
446
    if (it == m_savedFormStateMap.end())
441
    if (it == m_savedFormStateMap.end())
447
        return FormControlState();
442
        return FormControlState();
Lines 461-472 void FormController::formStatesFromStateVector(const Vector<String>& stateVector a/Source/WebCore/html/FormController.cpp_sec8
461
456
462
    while (i + 1 < stateVector.size()) {
457
    while (i + 1 < stateVector.size()) {
463
        AtomicString formKey = stateVector[i++];
458
        AtomicString formKey = stateVector[i++];
464
        OwnPtr<SavedFormState> state = SavedFormState::deserialize(stateVector, i);
459
        std::unique_ptr<SavedFormState> state = SavedFormState::deserialize(stateVector, i);
465
        if (!state) {
460
        if (!state) {
466
            i = 0;
461
            i = 0;
467
            break;
462
            break;
468
        }
463
        }
469
        map.add(formKey.impl(), state.release());
464
        map.add(formKey.impl(), std::move(state));
470
    }
465
    }
471
    if (i != stateVector.size())
466
    if (i != stateVector.size())
472
        map.clear();
467
        map.clear();
- a/Source/WebCore/html/FormController.h -3 / +3 lines
Lines 96-111 public: a/Source/WebCore/html/FormController.h_sec1
96
96
97
private:
97
private:
98
    typedef ListHashSet<RefPtr<HTMLFormControlElementWithState>, 64> FormElementListHashSet;
98
    typedef ListHashSet<RefPtr<HTMLFormControlElementWithState>, 64> FormElementListHashSet;
99
    typedef HashMap<RefPtr<AtomicStringImpl>, OwnPtr<SavedFormState>> SavedFormStateMap;
99
    typedef HashMap<RefPtr<AtomicStringImpl>, std::unique_ptr<SavedFormState>> SavedFormStateMap;
100
100
101
    static OwnPtr<SavedFormStateMap> createSavedFormStateMap(const FormElementListHashSet&);
101
    static std::unique_ptr<SavedFormStateMap> createSavedFormStateMap(const FormElementListHashSet&);
102
    FormControlState takeStateForFormElement(const HTMLFormControlElementWithState&);
102
    FormControlState takeStateForFormElement(const HTMLFormControlElementWithState&);
103
    static void formStatesFromStateVector(const Vector<String>&, SavedFormStateMap&);
103
    static void formStatesFromStateVector(const Vector<String>&, SavedFormStateMap&);
104
104
105
    CheckedRadioButtons m_checkedRadioButtons;
105
    CheckedRadioButtons m_checkedRadioButtons;
106
    FormElementListHashSet m_formElementsWithState;
106
    FormElementListHashSet m_formElementsWithState;
107
    SavedFormStateMap m_savedFormStateMap;
107
    SavedFormStateMap m_savedFormStateMap;
108
    OwnPtr<FormKeyGenerator> m_formKeyGenerator;
108
    std::unique_ptr<FormKeyGenerator> m_formKeyGenerator;
109
};
109
};
110
110
111
} // namespace WebCore
111
} // namespace WebCore
- a/Source/WebCore/html/HTMLAreaElement.cpp -1 / +1 lines
Lines 79-85 void HTMLAreaElement::invalidateCachedRegion() a/Source/WebCore/html/HTMLAreaElement.cpp_sec1
79
bool HTMLAreaElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size, HitTestResult& result)
79
bool HTMLAreaElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size, HitTestResult& result)
80
{
80
{
81
    if (m_lastSize != size) {
81
    if (m_lastSize != size) {
82
        m_region = adoptPtr(new Path(getRegion(size)));
82
        m_region = std::make_unique<Path>(getRegion(size));
83
        m_lastSize = size;
83
        m_lastSize = size;
84
    }
84
    }
85
85
- a/Source/WebCore/html/HTMLAreaElement.h -1 / +1 lines
Lines 64-70 private: a/Source/WebCore/html/HTMLAreaElement.h_sec1
64
    Path getRegion(const LayoutSize&) const;
64
    Path getRegion(const LayoutSize&) const;
65
    void invalidateCachedRegion();
65
    void invalidateCachedRegion();
66
66
67
    OwnPtr<Path> m_region;
67
    std::unique_ptr<Path> m_region;
68
    std::unique_ptr<Length[]> m_coords;
68
    std::unique_ptr<Length[]> m_coords;
69
    int m_coordsLen;
69
    int m_coordsLen;
70
    LayoutSize m_lastSize;
70
    LayoutSize m_lastSize;
- a/Source/WebCore/html/HTMLCanvasElement.cpp -2 / +2 lines
Lines 446-452 void HTMLCanvasElement::setSurfaceSize(const IntSize& size) a/Source/WebCore/html/HTMLCanvasElement.cpp_sec1
446
{
446
{
447
    m_size = size;
447
    m_size = size;
448
    m_hasCreatedImageBuffer = false;
448
    m_hasCreatedImageBuffer = false;
449
    m_contextStateSaver.clear();
449
    m_contextStateSaver = nullptr;
450
    m_imageBuffer.reset();
450
    m_imageBuffer.reset();
451
    clearCopiedImage();
451
    clearCopiedImage();
452
}
452
}
Lines 594-600 void HTMLCanvasElement::createImageBuffer() const a/Source/WebCore/html/HTMLCanvasElement.cpp_sec2
594
    if (document().settings() && !document().settings()->antialiased2dCanvasEnabled())
594
    if (document().settings() && !document().settings()->antialiased2dCanvasEnabled())
595
        m_imageBuffer->context()->setShouldAntialias(false);
595
        m_imageBuffer->context()->setShouldAntialias(false);
596
    m_imageBuffer->context()->setStrokeThickness(1);
596
    m_imageBuffer->context()->setStrokeThickness(1);
597
    m_contextStateSaver = adoptPtr(new GraphicsContextStateSaver(*m_imageBuffer->context()));
597
    m_contextStateSaver = std::make_unique<GraphicsContextStateSaver>(*m_imageBuffer->context());
598
598
599
    JSC::JSLockHolder lock(scriptExecutionContext()->vm());
599
    JSC::JSLockHolder lock(scriptExecutionContext()->vm());
600
    size_t numBytes = 4 * m_imageBuffer->internalSize().width() * m_imageBuffer->internalSize().height();
600
    size_t numBytes = 4 * m_imageBuffer->internalSize().width() * m_imageBuffer->internalSize().height();
- a/Source/WebCore/html/HTMLCanvasElement.h -1 / +1 lines
Lines 190-196 private: a/Source/WebCore/html/HTMLCanvasElement.h_sec1
190
    mutable bool m_hasCreatedImageBuffer;
190
    mutable bool m_hasCreatedImageBuffer;
191
    mutable bool m_didClearImageBuffer;
191
    mutable bool m_didClearImageBuffer;
192
    mutable std::unique_ptr<ImageBuffer> m_imageBuffer;
192
    mutable std::unique_ptr<ImageBuffer> m_imageBuffer;
193
    mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver;
193
    mutable std::unique_ptr<GraphicsContextStateSaver> m_contextStateSaver;
194
    
194
    
195
    mutable RefPtr<Image> m_presentedImage;
195
    mutable RefPtr<Image> m_presentedImage;
196
    mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platforms that have to copy the image buffer to render (and for CSSCanvasValue).
196
    mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platforms that have to copy the image buffer to render (and for CSSCanvasValue).
- a/Source/WebCore/html/HTMLCollection.h +1 lines
Lines 30-35 a/Source/WebCore/html/HTMLCollection.h_sec1
30
#include "HTMLNames.h"
30
#include "HTMLNames.h"
31
#include "LiveNodeList.h"
31
#include "LiveNodeList.h"
32
#include "ScriptWrappable.h"
32
#include "ScriptWrappable.h"
33
#include <memory>
33
#include <wtf/Forward.h>
34
#include <wtf/Forward.h>
34
#include <wtf/HashMap.h>
35
#include <wtf/HashMap.h>
35
#include <wtf/Vector.h>
36
#include <wtf/Vector.h>
- a/Source/WebCore/html/HTMLEmbedElement.cpp -1 / +1 lines
Lines 108-114 void HTMLEmbedElement::parseAttribute(const QualifiedName& name, const AtomicStr a/Source/WebCore/html/HTMLEmbedElement.cpp_sec1
108
        document().updateStyleIfNeeded();
108
        document().updateStyleIfNeeded();
109
        if (renderer() && isImageType()) {
109
        if (renderer() && isImageType()) {
110
            if (!m_imageLoader)
110
            if (!m_imageLoader)
111
                m_imageLoader = adoptPtr(new HTMLImageLoader(*this));
111
                m_imageLoader = std::make_unique<HTMLImageLoader>(*this);
112
            m_imageLoader->updateFromElementIgnoringPreviousError();
112
            m_imageLoader->updateFromElementIgnoringPreviousError();
113
        }
113
        }
114
    } else
114
    } else
- a/Source/WebCore/html/HTMLFormControlElement.cpp -1 / +1 lines
Lines 396-402 void HTMLFormControlElement::updateVisibleValidationMessage() a/Source/WebCore/html/HTMLFormControlElement.cpp_sec1
396
    if (renderer() && willValidate())
396
    if (renderer() && willValidate())
397
        message = validationMessage().stripWhiteSpace();
397
        message = validationMessage().stripWhiteSpace();
398
    if (!m_validationMessage)
398
    if (!m_validationMessage)
399
        m_validationMessage = ValidationMessage::create(this);
399
        m_validationMessage = std::make_unique<ValidationMessage>(this);
400
    m_validationMessage->updateValidationMessage(message);
400
    m_validationMessage->updateValidationMessage(message);
401
}
401
}
402
402
- a/Source/WebCore/html/HTMLFormControlElement.h -1 / +1 lines
Lines 165-171 private: a/Source/WebCore/html/HTMLFormControlElement.h_sec1
165
    virtual const HTMLFormControlElement& asHTMLElement() const override final { return *this; }
165
    virtual const HTMLFormControlElement& asHTMLElement() const override final { return *this; }
166
    virtual HTMLFormControlElement* asFormNamedItem() override final { return this; }
166
    virtual HTMLFormControlElement* asFormNamedItem() override final { return this; }
167
167
168
    OwnPtr<ValidationMessage> m_validationMessage;
168
    std::unique_ptr<ValidationMessage> m_validationMessage;
169
    bool m_disabled : 1;
169
    bool m_disabled : 1;
170
    bool m_isReadOnly : 1;
170
    bool m_isReadOnly : 1;
171
    bool m_isRequired : 1;
171
    bool m_isRequired : 1;
- a/Source/WebCore/html/HTMLFormElement.cpp -1 / +1 lines
Lines 699-705 void HTMLFormElement::addToPastNamesMap(FormNamedItem* item, const AtomicString& a/Source/WebCore/html/HTMLFormElement.cpp_sec1
699
    if (pastName.isEmpty())
699
    if (pastName.isEmpty())
700
        return;
700
        return;
701
    if (!m_pastNamesMap)
701
    if (!m_pastNamesMap)
702
        m_pastNamesMap = adoptPtr(new PastNamesMap);
702
        m_pastNamesMap = std::make_unique<PastNamesMap>();
703
    m_pastNamesMap->set(pastName.impl(), item);
703
    m_pastNamesMap->set(pastName.impl(), item);
704
}
704
}
705
705
- a/Source/WebCore/html/HTMLFormElement.h -2 / +2 lines
Lines 28-34 a/Source/WebCore/html/HTMLFormElement.h_sec1
28
#include "FormState.h"
28
#include "FormState.h"
29
#include "FormSubmission.h"
29
#include "FormSubmission.h"
30
#include "HTMLElement.h"
30
#include "HTMLElement.h"
31
#include <wtf/OwnPtr.h>
31
#include <memory>
32
32
33
#if ENABLE(IOS_AUTOCORRECT_AND_AUTOCAPITALIZE)
33
#if ENABLE(IOS_AUTOCORRECT_AND_AUTOCAPITALIZE)
34
#include "Autocapitalize.h"
34
#include "Autocapitalize.h"
Lines 161-167 private: a/Source/WebCore/html/HTMLFormElement.h_sec2
161
    typedef HashMap<RefPtr<AtomicStringImpl>, FormNamedItem*> PastNamesMap;
161
    typedef HashMap<RefPtr<AtomicStringImpl>, FormNamedItem*> PastNamesMap;
162
162
163
    FormSubmission::Attributes m_attributes;
163
    FormSubmission::Attributes m_attributes;
164
    OwnPtr<PastNamesMap> m_pastNamesMap;
164
    std::unique_ptr<PastNamesMap> m_pastNamesMap;
165
165
166
    CheckedRadioButtons m_checkedRadioButtons;
166
    CheckedRadioButtons m_checkedRadioButtons;
167
167
- a/Source/WebCore/html/HTMLInputElement.cpp -10 / +4 lines
Lines 85-96 using namespace HTMLNames; a/Source/WebCore/html/HTMLInputElement.cpp_sec1
85
class ListAttributeTargetObserver : IdTargetObserver {
85
class ListAttributeTargetObserver : IdTargetObserver {
86
    WTF_MAKE_FAST_ALLOCATED;
86
    WTF_MAKE_FAST_ALLOCATED;
87
public:
87
public:
88
    static OwnPtr<ListAttributeTargetObserver> create(const AtomicString& id, HTMLInputElement*);
88
    ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*);
89
89
    virtual void idTargetChanged() override;
90
    virtual void idTargetChanged() override;
90
91
91
private:
92
private:
92
    ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*);
93
94
    HTMLInputElement* m_element;
93
    HTMLInputElement* m_element;
95
};
94
};
96
#endif
95
#endif
Lines 142-148 PassRefPtr<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagNa a/Source/WebCore/html/HTMLInputElement.cpp_sec2
142
HTMLImageLoader* HTMLInputElement::imageLoader()
141
HTMLImageLoader* HTMLInputElement::imageLoader()
143
{
142
{
144
    if (!m_imageLoader)
143
    if (!m_imageLoader)
145
        m_imageLoader = adoptPtr(new HTMLImageLoader(*this));
144
        m_imageLoader = std::make_unique<HTMLImageLoader>(*this);
146
    return m_imageLoader.get();
145
    return m_imageLoader.get();
147
}
146
}
148
147
Lines 1588-1594 HTMLDataListElement* HTMLInputElement::dataList() const a/Source/WebCore/html/HTMLInputElement.cpp_sec3
1588
void HTMLInputElement::resetListAttributeTargetObserver()
1587
void HTMLInputElement::resetListAttributeTargetObserver()
1589
{
1588
{
1590
    if (inDocument())
1589
    if (inDocument())
1591
        m_listAttributeTargetObserver = ListAttributeTargetObserver::create(fastGetAttribute(listAttr), this);
1590
        m_listAttributeTargetObserver = std::make_unique<ListAttributeTargetObserver>(fastGetAttribute(listAttr), this);
1592
    else
1591
    else
1593
        m_listAttributeTargetObserver = nullptr;
1592
        m_listAttributeTargetObserver = nullptr;
1594
}
1593
}
Lines 1857-1867 void HTMLInputElement::setWidth(unsigned width) a/Source/WebCore/html/HTMLInputElement.cpp_sec4
1857
}
1856
}
1858
1857
1859
#if ENABLE(DATALIST_ELEMENT)
1858
#if ENABLE(DATALIST_ELEMENT)
1860
OwnPtr<ListAttributeTargetObserver> ListAttributeTargetObserver::create(const AtomicString& id, HTMLInputElement* element)
1861
{
1862
    return adoptPtr(new ListAttributeTargetObserver(id, element));
1863
}
1864
1865
ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement* element)
1859
ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement* element)
1866
    : IdTargetObserver(element->treeScope().idTargetObserverRegistry(), id)
1860
    : IdTargetObserver(element->treeScope().idTargetObserverRegistry(), id)
1867
    , m_element(element)
1861
    , m_element(element)
- a/Source/WebCore/html/HTMLInputElement.h -3 / +4 lines
Lines 28-33 a/Source/WebCore/html/HTMLInputElement.h_sec1
28
#include "FileChooser.h"
28
#include "FileChooser.h"
29
#include "HTMLTextFormControlElement.h"
29
#include "HTMLTextFormControlElement.h"
30
#include "StepRange.h"
30
#include "StepRange.h"
31
#include <memory>
31
32
32
#if PLATFORM(IOS)
33
#if PLATFORM(IOS)
33
#include "DateComponents.h"
34
#include "DateComponents.h"
Lines 322-328 public: a/Source/WebCore/html/HTMLInputElement.h_sec2
322
    virtual void setRangeText(const String& replacement, ExceptionCode&) override;
323
    virtual void setRangeText(const String& replacement, ExceptionCode&) override;
323
    virtual void setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode&) override;
324
    virtual void setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode&) override;
324
325
325
    bool hasImageLoader() const { return m_imageLoader; }
326
    bool hasImageLoader() const { return !!m_imageLoader; }
326
    HTMLImageLoader* imageLoader();
327
    HTMLImageLoader* imageLoader();
327
328
328
#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
329
#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
Lines 454-462 private: a/Source/WebCore/html/HTMLInputElement.h_sec3
454
    // The ImageLoader must be owned by this element because the loader code assumes
455
    // The ImageLoader must be owned by this element because the loader code assumes
455
    // that it lives as long as its owning element lives. If we move the loader into
456
    // that it lives as long as its owning element lives. If we move the loader into
456
    // the ImageInput object we may delete the loader while this element lives on.
457
    // the ImageInput object we may delete the loader while this element lives on.
457
    OwnPtr<HTMLImageLoader> m_imageLoader;
458
    std::unique_ptr<HTMLImageLoader> m_imageLoader;
458
#if ENABLE(DATALIST_ELEMENT)
459
#if ENABLE(DATALIST_ELEMENT)
459
    OwnPtr<ListAttributeTargetObserver> m_listAttributeTargetObserver;
460
    std::unique_ptr<ListAttributeTargetObserver> m_listAttributeTargetObserver;
460
#endif
461
#endif
461
};
462
};
462
463
- a/Source/WebCore/html/HTMLObjectElement.cpp -1 / +1 lines
Lines 120-126 void HTMLObjectElement::parseAttribute(const QualifiedName& name, const AtomicSt a/Source/WebCore/html/HTMLObjectElement.cpp_sec1
120
            setNeedsWidgetUpdate(true);
120
            setNeedsWidgetUpdate(true);
121
            if (isImageType()) {
121
            if (isImageType()) {
122
                if (!m_imageLoader)
122
                if (!m_imageLoader)
123
                    m_imageLoader = adoptPtr(new HTMLImageLoader(*this));
123
                    m_imageLoader = std::make_unique<HTMLImageLoader>(*this);
124
                m_imageLoader->updateFromElementIgnoringPreviousError();
124
                m_imageLoader->updateFromElementIgnoringPreviousError();
125
            }
125
            }
126
        }
126
        }
- a/Source/WebCore/html/HTMLPlugInImageElement.cpp -1 / +1 lines
Lines 329-335 void HTMLPlugInImageElement::updateWidgetCallback(Node& node, unsigned) a/Source/WebCore/html/HTMLPlugInImageElement.cpp_sec1
329
void HTMLPlugInImageElement::startLoadingImage()
329
void HTMLPlugInImageElement::startLoadingImage()
330
{
330
{
331
    if (!m_imageLoader)
331
    if (!m_imageLoader)
332
        m_imageLoader = adoptPtr(new HTMLImageLoader(*this));
332
        m_imageLoader = std::make_unique<HTMLImageLoader>(*this);
333
    m_imageLoader->updateFromElement();
333
    m_imageLoader->updateFromElement();
334
}
334
}
335
335
- a/Source/WebCore/html/HTMLPlugInImageElement.h -2 / +2 lines
Lines 24-30 a/Source/WebCore/html/HTMLPlugInImageElement.h_sec1
24
#include "HTMLPlugInElement.h"
24
#include "HTMLPlugInElement.h"
25
25
26
#include "RenderStyle.h"
26
#include "RenderStyle.h"
27
#include <wtf/OwnPtr.h>
27
#include <memory>
28
28
29
namespace WebCore {
29
namespace WebCore {
30
30
Lines 108-114 protected: a/Source/WebCore/html/HTMLPlugInImageElement.h_sec2
108
108
109
    bool isImageType();
109
    bool isImageType();
110
110
111
    OwnPtr<HTMLImageLoader> m_imageLoader;
111
    std::unique_ptr<HTMLImageLoader> m_imageLoader;
112
    String m_serviceType;
112
    String m_serviceType;
113
    String m_url;
113
    String m_url;
114
    URL m_loadedUrl;
114
    URL m_loadedUrl;
- a/Source/WebCore/html/HTMLVideoElement.cpp -2 / +2 lines
Lines 86-92 void HTMLVideoElement::didAttachRenderers() a/Source/WebCore/html/HTMLVideoElement.cpp_sec1
86
        updateDisplayState();
86
        updateDisplayState();
87
        if (shouldDisplayPosterImage()) {
87
        if (shouldDisplayPosterImage()) {
88
            if (!m_imageLoader)
88
            if (!m_imageLoader)
89
                m_imageLoader = adoptPtr(new HTMLImageLoader(*this));
89
                m_imageLoader = std::make_unique<HTMLImageLoader>(*this);
90
            m_imageLoader->updateFromElement();
90
            m_imageLoader->updateFromElement();
91
            if (renderer())
91
            if (renderer())
92
                toRenderImage(renderer())->imageResource().setCachedImage(m_imageLoader->image());
92
                toRenderImage(renderer())->imageResource().setCachedImage(m_imageLoader->image());
Lines 125-131 void HTMLVideoElement::parseAttribute(const QualifiedName& name, const AtomicStr a/Source/WebCore/html/HTMLVideoElement.cpp_sec2
125
#endif
125
#endif
126
        if (shouldDisplayPosterImage()) {
126
        if (shouldDisplayPosterImage()) {
127
            if (!m_imageLoader)
127
            if (!m_imageLoader)
128
                m_imageLoader = adoptPtr(new HTMLImageLoader(*this));
128
                m_imageLoader = std::make_unique<HTMLImageLoader>(*this);
129
            m_imageLoader->updateFromElementIgnoringPreviousError();
129
            m_imageLoader->updateFromElementIgnoringPreviousError();
130
        } else {
130
        } else {
131
            if (renderer())
131
            if (renderer())
- a/Source/WebCore/html/HTMLVideoElement.h -1 / +3 lines
Lines 27-33 a/Source/WebCore/html/HTMLVideoElement.h_sec1
27
#define HTMLVideoElement_h
27
#define HTMLVideoElement_h
28
28
29
#if ENABLE(VIDEO)
29
#if ENABLE(VIDEO)
30
30
#include "HTMLMediaElement.h"
31
#include "HTMLMediaElement.h"
32
#include <memory>
31
33
32
namespace WebCore {
34
namespace WebCore {
33
35
Lines 95-101 private: a/Source/WebCore/html/HTMLVideoElement.h_sec2
95
    virtual void didMoveToNewDocument(Document* oldDocument) override;
97
    virtual void didMoveToNewDocument(Document* oldDocument) override;
96
    virtual void setDisplayMode(DisplayMode) override;
98
    virtual void setDisplayMode(DisplayMode) override;
97
99
98
    OwnPtr<HTMLImageLoader> m_imageLoader;
100
    std::unique_ptr<HTMLImageLoader> m_imageLoader;
99
101
100
    AtomicString m_defaultPosterURL;
102
    AtomicString m_defaultPosterURL;
101
};
103
};
- a/Source/WebCore/html/ValidationMessage.cpp -12 / +6 lines
Lines 46-58 a/Source/WebCore/html/ValidationMessage.cpp_sec1
46
#include "StyleResolver.h"
46
#include "StyleResolver.h"
47
#include "Text.h"
47
#include "Text.h"
48
#include "ValidationMessageClient.h"
48
#include "ValidationMessageClient.h"
49
#include <wtf/PassOwnPtr.h>
50
49
51
namespace WebCore {
50
namespace WebCore {
52
51
53
using namespace HTMLNames;
52
using namespace HTMLNames;
54
53
55
ALWAYS_INLINE ValidationMessage::ValidationMessage(HTMLFormControlElement* element)
54
ValidationMessage::ValidationMessage(HTMLFormControlElement* element)
56
    : m_element(element)
55
    : m_element(element)
57
{
56
{
58
    ASSERT(m_element);
57
    ASSERT(m_element);
Lines 68-78 ValidationMessage::~ValidationMessage() a/Source/WebCore/html/ValidationMessage.cpp_sec2
68
    deleteBubbleTree();
67
    deleteBubbleTree();
69
}
68
}
70
69
71
OwnPtr<ValidationMessage> ValidationMessage::create(HTMLFormControlElement* element)
72
{
73
    return adoptPtr(new ValidationMessage(element));
74
}
75
76
ValidationMessageClient* ValidationMessage::validationMessageClient() const
70
ValidationMessageClient* ValidationMessage::validationMessageClient() const
77
{
71
{
78
    if (Page* page = m_element->document().page())
72
    if (Page* page = m_element->document().page())
Lines 113-121 void ValidationMessage::setMessage(const String& message) a/Source/WebCore/html/ValidationMessage.cpp_sec3
113
    ASSERT(!message.isEmpty());
107
    ASSERT(!message.isEmpty());
114
    m_message = message;
108
    m_message = message;
115
    if (!m_bubble)
109
    if (!m_bubble)
116
        m_timer = adoptPtr(new Timer<ValidationMessage>(this, &ValidationMessage::buildBubbleTree));
110
        m_timer = std::make_unique<Timer<ValidationMessage>>(this, &ValidationMessage::buildBubbleTree);
117
    else
111
    else
118
        m_timer = adoptPtr(new Timer<ValidationMessage>(this, &ValidationMessage::setMessageDOMAndStartTimer));
112
        m_timer = std::make_unique<Timer<ValidationMessage>>(this, &ValidationMessage::setMessageDOMAndStartTimer);
119
    m_timer->startOneShot(0);
113
    m_timer->startOneShot(0);
120
}
114
}
121
115
Lines 140-148 void ValidationMessage::setMessageDOMAndStartTimer(Timer<ValidationMessage>*) a/Source/WebCore/html/ValidationMessage.cpp_sec4
140
134
141
    int magnification = document.page() ? document.page()->settings().validationMessageTimerMagnification() : -1;
135
    int magnification = document.page() ? document.page()->settings().validationMessageTimerMagnification() : -1;
142
    if (magnification <= 0)
136
    if (magnification <= 0)
143
        m_timer.clear();
137
        m_timer = nullptr;
144
    else {
138
    else {
145
        m_timer = adoptPtr(new Timer<ValidationMessage>(this, &ValidationMessage::deleteBubbleTree));
139
        m_timer = std::make_unique<Timer<ValidationMessage>>(this, &ValidationMessage::deleteBubbleTree);
146
        m_timer->startOneShot(std::max(5.0, static_cast<double>(m_message.length()) * magnification / 1000));
140
        m_timer->startOneShot(std::max(5.0, static_cast<double>(m_message.length()) * magnification / 1000));
147
    }
141
    }
148
}
142
}
Lines 222-228 void ValidationMessage::requestToHideMessage() a/Source/WebCore/html/ValidationMessage.cpp_sec5
222
    }
216
    }
223
217
224
    // We must not modify the DOM tree in this context by the same reason as setMessage().
218
    // We must not modify the DOM tree in this context by the same reason as setMessage().
225
    m_timer = adoptPtr(new Timer<ValidationMessage>(this, &ValidationMessage::deleteBubbleTree));
219
    m_timer = std::make_unique<Timer<ValidationMessage>>(this, &ValidationMessage::deleteBubbleTree);
226
    m_timer->startOneShot(0);
220
    m_timer->startOneShot(0);
227
}
221
}
228
222
- a/Source/WebCore/html/ValidationMessage.h -4 / +4 lines
Lines 32-39 a/Source/WebCore/html/ValidationMessage.h_sec1
32
#define ValidationMessage_h
32
#define ValidationMessage_h
33
33
34
#include "Timer.h"
34
#include "Timer.h"
35
#include <memory>
35
#include <wtf/Noncopyable.h>
36
#include <wtf/Noncopyable.h>
36
#include <wtf/OwnPtr.h>
37
#include <wtf/RefPtr.h>
37
#include <wtf/RefPtr.h>
38
#include <wtf/text/WTFString.h>
38
#include <wtf/text/WTFString.h>
39
39
Lines 49-63 class ValidationMessageClient; a/Source/WebCore/html/ValidationMessage.h_sec2
49
class ValidationMessage {
49
class ValidationMessage {
50
    WTF_MAKE_NONCOPYABLE(ValidationMessage); WTF_MAKE_FAST_ALLOCATED;
50
    WTF_MAKE_NONCOPYABLE(ValidationMessage); WTF_MAKE_FAST_ALLOCATED;
51
public:
51
public:
52
    static OwnPtr<ValidationMessage> create(HTMLFormControlElement*);
52
    explicit ValidationMessage(HTMLFormControlElement*);
53
    ~ValidationMessage();
53
    ~ValidationMessage();
54
54
    void updateValidationMessage(const String&);
55
    void updateValidationMessage(const String&);
55
    void requestToHideMessage();
56
    void requestToHideMessage();
56
    bool isVisible() const;
57
    bool isVisible() const;
57
    bool shadowTreeContains(const Node&) const;
58
    bool shadowTreeContains(const Node&) const;
58
59
59
private:
60
private:
60
    explicit ValidationMessage(HTMLFormControlElement*);
61
    ValidationMessageClient* validationMessageClient() const;
61
    ValidationMessageClient* validationMessageClient() const;
62
    void setMessage(const String&);
62
    void setMessage(const String&);
63
    void setMessageDOMAndStartTimer(Timer<ValidationMessage>* = 0);
63
    void setMessageDOMAndStartTimer(Timer<ValidationMessage>* = 0);
Lines 66-72 private: a/Source/WebCore/html/ValidationMessage.h_sec3
66
66
67
    HTMLFormControlElement* m_element;
67
    HTMLFormControlElement* m_element;
68
    String m_message;
68
    String m_message;
69
    OwnPtr<Timer<ValidationMessage>> m_timer;
69
    std::unique_ptr<Timer<ValidationMessage>> m_timer;
70
    RefPtr<HTMLElement> m_bubble;
70
    RefPtr<HTMLElement> m_bubble;
71
    RefPtr<HTMLElement> m_messageHeading;
71
    RefPtr<HTMLElement> m_messageHeading;
72
    RefPtr<HTMLElement> m_messageBody;
72
    RefPtr<HTMLElement> m_messageBody;

Return to Bug 129669