| Differences between
and this patch
- a/Source/WebCore/ChangeLog +79 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2015-11-20  Katlyn Graff  <kgraff@apple.com>
2
3
        Safari background tabs should be fully suspended where possible.
4
        https://bugs.webkit.org/show_bug.cgi?id=151527
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        No new tests because this is simply a refactor.
9
10
        Renamed Element:: and Document:: documentWillSuspendForPageCache(),
11
        documentDidResumeFromPageCache(),
12
        registerForPageCacheSuspensionCallbacks(),
13
        unregisterForPageCacheSuspensionCallbacks() to prepare to support
14
        alternate reasons for document-level suspension.
15
16
        * dom/Document.cpp:
17
        (WebCore::Document::suspend):
18
        (WebCore::Document::resume):
19
        (WebCore::Document::registerForDocumentSuspensionCallbacks):
20
        (WebCore::Document::unregisterForDocumentSuspensionCallbacks):
21
        (WebCore::Document::documentWillSuspendForPageCache): Deleted.
22
        (WebCore::Document::documentDidResumeFromPageCache): Deleted.
23
        (WebCore::Document::registerForPageCacheSuspensionCallbacks): Deleted.
24
        (WebCore::Document::unregisterForPageCacheSuspensionCallbacks): Deleted.
25
        * dom/Document.h:
26
        * dom/Element.h:
27
        (WebCore::Element::prepareForDocumentSuspension):
28
        (WebCore::Element::resumeFromDocumentSuspension):
29
        (WebCore::Element::documentWillSuspendForPageCache): Deleted.
30
        (WebCore::Element::documentDidResumeFromPageCache): Deleted.
31
        * history/CachedFrame.cpp:
32
        (WebCore::CachedFrameBase::restore):
33
        (WebCore::CachedFrame::CachedFrame):
34
        * html/HTMLFormElement.cpp:
35
        (WebCore::HTMLFormElement::~HTMLFormElement):
36
        (WebCore::HTMLFormElement::parseAttribute):
37
        (WebCore::HTMLFormElement::resumeFromDocumentSuspension):
38
        (WebCore::HTMLFormElement::didMoveToNewDocument):
39
        (WebCore::HTMLFormElement::documentDidResumeFromPageCache): Deleted.
40
        * html/HTMLFormElement.h:
41
        * html/HTMLInputElement.cpp:
42
        (WebCore::HTMLInputElement::~HTMLInputElement):
43
        (WebCore::HTMLInputElement::registerForSuspensionCallbackIfNeeded):
44
        (WebCore::HTMLInputElement::unregisterForSuspensionCallbackIfNeeded):
45
        (WebCore::HTMLInputElement::resumeFromDocumentSuspension):
46
        (WebCore::HTMLInputElement::prepareForDocumentSuspension):
47
        (WebCore::HTMLInputElement::didMoveToNewDocument):
48
        (WebCore::HTMLInputElement::documentDidResumeFromPageCache): Deleted.
49
        (WebCore::HTMLInputElement::documentWillSuspendForPageCache): Deleted.
50
        * html/HTMLInputElement.h:
51
        * html/HTMLMediaElement.cpp:
52
        (WebCore::HTMLMediaElement::registerWithDocument):
53
        (WebCore::HTMLMediaElement::unregisterWithDocument):
54
        (WebCore::HTMLMediaElement::prepareForDocumentSuspension):
55
        (WebCore::HTMLMediaElement::resumeFromDocumentSuspension):
56
        (WebCore::HTMLMediaElement::documentWillSuspendForPageCache): Deleted.
57
        (WebCore::HTMLMediaElement::documentDidResumeFromPageCache): Deleted.
58
        * html/HTMLMediaElement.h:
59
        * html/HTMLPlugInImageElement.cpp:
60
        (WebCore::HTMLPlugInImageElement::~HTMLPlugInImageElement):
61
        (WebCore::HTMLPlugInImageElement::createElementRenderer):
62
        (WebCore::HTMLPlugInImageElement::didMoveToNewDocument):
63
        (WebCore::HTMLPlugInImageElement::prepareForDocumentSuspension):
64
        (WebCore::HTMLPlugInImageElement::resumeFromDocumentSuspension):
65
        (WebCore::HTMLPlugInImageElement::documentWillSuspendForPageCache): Deleted.
66
        (WebCore::HTMLPlugInImageElement::documentDidResumeFromPageCache): Deleted.
67
        * html/HTMLPlugInImageElement.h:
68
        * loader/FrameLoader.cpp:
69
        (WebCore::FrameLoader::commitProvisionalLoad):
70
        * svg/SVGSVGElement.cpp:
71
        (WebCore::SVGSVGElement::SVGSVGElement):
72
        (WebCore::SVGSVGElement::~SVGSVGElement):
73
        (WebCore::SVGSVGElement::didMoveToNewDocument):
74
        (WebCore::SVGSVGElement::prepareForDocumentSuspension):
75
        (WebCore::SVGSVGElement::resumeFromDocumentSuspension):
76
        (WebCore::SVGSVGElement::documentWillSuspendForPageCache): Deleted.
77
        (WebCore::SVGSVGElement::documentDidResumeFromPageCache): Deleted.
78
        * svg/SVGSVGElement.h:
79
1
2015-11-19  Adam Bergkvist  <adam.bergkvist@ericsson.com>
80
2015-11-19  Adam Bergkvist  <adam.bergkvist@ericsson.com>
2
81
3
        WebRTC: Initial testing of updated RTCPeerConnection API
82
        WebRTC: Initial testing of updated RTCPeerConnection API
- a/Source/WebCore/dom/Document.cpp -6 / +6 lines
Lines 4504-4515 void Document::documentWillBecomeInactive() a/Source/WebCore/dom/Document.cpp_sec1
4504
        renderView()->setIsInWindow(false);
4504
        renderView()->setIsInWindow(false);
4505
}
4505
}
4506
4506
4507
void Document::documentWillSuspendForPageCache()
4507
void Document::suspend()
4508
{
4508
{
4509
    documentWillBecomeInactive();
4509
    documentWillBecomeInactive();
4510
4510
4511
    for (auto* element : m_documentSuspensionCallbackElements)
4511
    for (auto* element : m_documentSuspensionCallbackElements)
4512
        element->documentWillSuspendForPageCache();
4512
        element->prepareForDocumentSuspension();
4513
4513
4514
#ifndef NDEBUG
4514
#ifndef NDEBUG
4515
    // Clear the update flag to be able to check if the viewport arguments update
4515
    // Clear the update flag to be able to check if the viewport arguments update
Lines 4523-4534 void Document::documentWillSuspendForPageCache() a/Source/WebCore/dom/Document.cpp_sec2
4523
    }
4523
    }
4524
}
4524
}
4525
4525
4526
void Document::documentDidResumeFromPageCache() 
4526
void Document::resume()
4527
{
4527
{
4528
    Vector<Element*> elements;
4528
    Vector<Element*> elements;
4529
    copyToVector(m_documentSuspensionCallbackElements, elements);
4529
    copyToVector(m_documentSuspensionCallbackElements, elements);
4530
    for (auto* element : elements)
4530
    for (auto* element : elements)
4531
        element->documentDidResumeFromPageCache();
4531
        element->resumeFromDocumentSuspension();
4532
4532
4533
    if (renderView())
4533
    if (renderView())
4534
        renderView()->setIsInWindow(true);
4534
        renderView()->setIsInWindow(true);
Lines 4540-4551 void Document::documentDidResumeFromPageCache() a/Source/WebCore/dom/Document.cpp_sec3
4540
    m_frame->loader().client().dispatchDidBecomeFrameset(isFrameSet());
4540
    m_frame->loader().client().dispatchDidBecomeFrameset(isFrameSet());
4541
}
4541
}
4542
4542
4543
void Document::registerForPageCacheSuspensionCallbacks(Element* e)
4543
void Document::registerForDocumentSuspensionCallbacks(Element* e)
4544
{
4544
{
4545
    m_documentSuspensionCallbackElements.add(e);
4545
    m_documentSuspensionCallbackElements.add(e);
4546
}
4546
}
4547
4547
4548
void Document::unregisterForPageCacheSuspensionCallbacks(Element* e)
4548
void Document::unregisterForDocumentSuspensionCallbacks(Element* e)
4549
{
4549
{
4550
    m_documentSuspensionCallbackElements.remove(e);
4550
    m_documentSuspensionCallbackElements.remove(e);
4551
}
4551
}
- a/Source/WebCore/dom/Document.h -6 / +6 lines
Lines 1002-1015 public: a/Source/WebCore/dom/Document.h_sec1
1002
    bool inPageCache() const { return m_inPageCache; }
1002
    bool inPageCache() const { return m_inPageCache; }
1003
    void setInPageCache(bool flag);
1003
    void setInPageCache(bool flag);
1004
1004
1005
    // Elements can register themselves for the "documentWillSuspendForPageCache()" and  
1005
    // Elements can register themselves for the "suspend()" and
1006
    // "documentDidResumeFromPageCache()" callbacks
1006
    // "resume()" callbacks
1007
    void registerForPageCacheSuspensionCallbacks(Element*);
1007
    void registerForDocumentSuspensionCallbacks(Element*);
1008
    void unregisterForPageCacheSuspensionCallbacks(Element*);
1008
    void unregisterForDocumentSuspensionCallbacks(Element*);
1009
1009
1010
    void documentWillBecomeInactive();
1010
    void documentWillBecomeInactive();
1011
    void documentWillSuspendForPageCache();
1011
    void suspend();
1012
    void documentDidResumeFromPageCache();
1012
    void resume();
1013
1013
1014
    void registerForMediaVolumeCallbacks(Element*);
1014
    void registerForMediaVolumeCallbacks(Element*);
1015
    void unregisterForMediaVolumeCallbacks(Element*);
1015
    void unregisterForMediaVolumeCallbacks(Element*);
- a/Source/WebCore/dom/Element.h -2 / +2 lines
Lines 346-353 public: a/Source/WebCore/dom/Element.h_sec1
346
    void setMinimumSizeForResizing(const LayoutSize&);
346
    void setMinimumSizeForResizing(const LayoutSize&);
347
347
348
    // Use Document::registerForDocumentActivationCallbacks() to subscribe to these
348
    // Use Document::registerForDocumentActivationCallbacks() to subscribe to these
349
    virtual void documentWillSuspendForPageCache() { }
349
    virtual void prepareForDocumentSuspension() { }
350
    virtual void documentDidResumeFromPageCache() { }
350
    virtual void resumeFromDocumentSuspension() { }
351
351
352
    // Use Document::registerForMediaVolumeCallbacks() to subscribe to this
352
    // Use Document::registerForMediaVolumeCallbacks() to subscribe to this
353
    virtual void mediaVolumeDidChange() { }
353
    virtual void mediaVolumeDidChange() { }
- a/Source/WebCore/history/CachedFrame.cpp -3 / +3 lines
Lines 135-141 void CachedFrameBase::restore() a/Source/WebCore/history/CachedFrame.cpp_sec1
135
        m_document->page()->chrome().client().needTouchEvents(true);
135
        m_document->page()->chrome().client().needTouchEvents(true);
136
#endif
136
#endif
137
137
138
    m_document->documentDidResumeFromPageCache();
138
    m_document->resume();
139
}
139
}
140
140
141
CachedFrame::CachedFrame(Frame& frame)
141
CachedFrame::CachedFrame(Frame& frame)
Lines 165-171 CachedFrame::CachedFrame(Frame& frame) a/Source/WebCore/history/CachedFrame.cpp_sec2
165
    // but after we've fired the pagehide event, in case that creates more objects.
165
    // but after we've fired the pagehide event, in case that creates more objects.
166
    // Suspending must also happen after we've recursed over child frames, in case
166
    // Suspending must also happen after we've recursed over child frames, in case
167
    // those create more objects.
167
    // those create more objects.
168
    m_document->documentWillSuspendForPageCache();
168
    m_document->suspend();
169
    m_document->suspendScriptedAnimationControllerCallbacks();
169
    m_document->suspendScriptedAnimationControllerCallbacks();
170
    m_document->suspendActiveDOMObjects(ActiveDOMObject::PageCache);
170
    m_document->suspendActiveDOMObjects(ActiveDOMObject::PageCache);
171
    m_cachedFrameScriptData = std::make_unique<ScriptCachedFrameData>(frame);
171
    m_cachedFrameScriptData = std::make_unique<ScriptCachedFrameData>(frame);
Lines 179-185 CachedFrame::CachedFrame(Frame& frame) a/Source/WebCore/history/CachedFrame.cpp_sec3
179
179
180
    frame.view()->clearScrollableAreas();
180
    frame.view()->clearScrollableAreas();
181
181
182
    // documentWillSuspendForPageCache() can set up a layout timer on the FrameView, so clear timers after that.
182
    // suspend() can set up a layout timer on the FrameView, so clear timers after that.
183
    frame.clearTimers();
183
    frame.clearTimers();
184
184
185
    // Deconstruct the FrameTree, to restore it later.
185
    // Deconstruct the FrameTree, to restore it later.
- a/Source/WebCore/html/HTMLFormElement.cpp -6 / +6 lines
Lines 84-90 HTMLFormElement::~HTMLFormElement() a/Source/WebCore/html/HTMLFormElement.cpp_sec1
84
{
84
{
85
    document().formController().willDeleteForm(this);
85
    document().formController().willDeleteForm(this);
86
    if (!shouldAutocomplete())
86
    if (!shouldAutocomplete())
87
        document().unregisterForPageCacheSuspensionCallbacks(this);
87
        document().unregisterForDocumentSuspensionCallbacks(this);
88
88
89
    for (auto& associatedElement : m_associatedElements)
89
    for (auto& associatedElement : m_associatedElements)
90
        associatedElement->formWillBeDestroyed();
90
        associatedElement->formWillBeDestroyed();
Lines 492-500 void HTMLFormElement::parseAttribute(const QualifiedName& name, const AtomicStri a/Source/WebCore/html/HTMLFormElement.cpp_sec2
492
        m_attributes.setAcceptCharset(value);
492
        m_attributes.setAcceptCharset(value);
493
    else if (name == autocompleteAttr) {
493
    else if (name == autocompleteAttr) {
494
        if (!shouldAutocomplete())
494
        if (!shouldAutocomplete())
495
            document().registerForPageCacheSuspensionCallbacks(this);
495
            document().registerForDocumentSuspensionCallbacks(this);
496
        else
496
        else
497
            document().unregisterForPageCacheSuspensionCallbacks(this);
497
            document().unregisterForDocumentSuspensionCallbacks(this);
498
    }
498
    }
499
    else
499
    else
500
        HTMLElement::parseAttribute(name, value);
500
        HTMLElement::parseAttribute(name, value);
Lines 810-816 Vector<Ref<Element>> HTMLFormElement::namedElements(const AtomicString& name) a/Source/WebCore/html/HTMLFormElement.cpp_sec3
810
    return namedItems;
810
    return namedItems;
811
}
811
}
812
812
813
void HTMLFormElement::documentDidResumeFromPageCache()
813
void HTMLFormElement::resumeFromDocumentSuspension()
814
{
814
{
815
    ASSERT(!shouldAutocomplete());
815
    ASSERT(!shouldAutocomplete());
816
816
Lines 824-831 void HTMLFormElement::didMoveToNewDocument(Document* oldDocument) a/Source/WebCore/html/HTMLFormElement.cpp_sec4
824
{
824
{
825
    if (!shouldAutocomplete()) {
825
    if (!shouldAutocomplete()) {
826
        if (oldDocument)
826
        if (oldDocument)
827
            oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
827
            oldDocument->unregisterForDocumentSuspensionCallbacks(this);
828
        document().registerForPageCacheSuspensionCallbacks(this);
828
        document().registerForDocumentSuspensionCallbacks(this);
829
    }
829
    }
830
830
831
    HTMLElement::didMoveToNewDocument(oldDocument);
831
    HTMLElement::didMoveToNewDocument(oldDocument);
- a/Source/WebCore/html/HTMLFormElement.h -1 / +1 lines
Lines 150-156 private: a/Source/WebCore/html/HTMLFormElement.h_sec1
150
    virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
150
    virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
151
    virtual bool isURLAttribute(const Attribute&) const override;
151
    virtual bool isURLAttribute(const Attribute&) const override;
152
152
153
    virtual void documentDidResumeFromPageCache() override;
153
    virtual void resumeFromDocumentSuspension() override;
154
154
155
    virtual void didMoveToNewDocument(Document* oldDocument) override;
155
    virtual void didMoveToNewDocument(Document* oldDocument) override;
156
156
- a/Source/WebCore/html/HTMLInputElement.cpp -8 / +8 lines
Lines 150-156 void HTMLInputElement::didAddUserAgentShadowRoot(ShadowRoot*) a/Source/WebCore/html/HTMLInputElement.cpp_sec1
150
HTMLInputElement::~HTMLInputElement()
150
HTMLInputElement::~HTMLInputElement()
151
{
151
{
152
    if (needsSuspensionCallback())
152
    if (needsSuspensionCallback())
153
        document().unregisterForPageCacheSuspensionCallbacks(this);
153
        document().unregisterForDocumentSuspensionCallbacks(this);
154
154
155
    // Need to remove form association while this is still an HTMLInputElement
155
    // Need to remove form association while this is still an HTMLInputElement
156
    // so that virtual functions are called correctly.
156
    // so that virtual functions are called correctly.
Lines 1399-1411 bool HTMLInputElement::needsSuspensionCallback() a/Source/WebCore/html/HTMLInputElement.cpp_sec2
1399
void HTMLInputElement::registerForSuspensionCallbackIfNeeded()
1399
void HTMLInputElement::registerForSuspensionCallbackIfNeeded()
1400
{
1400
{
1401
    if (needsSuspensionCallback())
1401
    if (needsSuspensionCallback())
1402
        document().registerForPageCacheSuspensionCallbacks(this);
1402
        document().registerForDocumentSuspensionCallbacks(this);
1403
}
1403
}
1404
1404
1405
void HTMLInputElement::unregisterForSuspensionCallbackIfNeeded()
1405
void HTMLInputElement::unregisterForSuspensionCallbackIfNeeded()
1406
{
1406
{
1407
    if (!needsSuspensionCallback())
1407
    if (!needsSuspensionCallback())
1408
        document().unregisterForPageCacheSuspensionCallbacks(this);
1408
        document().unregisterForDocumentSuspensionCallbacks(this);
1409
}
1409
}
1410
1410
1411
bool HTMLInputElement::isRequiredFormControl() const
1411
bool HTMLInputElement::isRequiredFormControl() const
Lines 1431-1442 void HTMLInputElement::onSearch() a/Source/WebCore/html/HTMLInputElement.cpp_sec3
1431
    dispatchEvent(Event::create(eventNames().searchEvent, true, false));
1431
    dispatchEvent(Event::create(eventNames().searchEvent, true, false));
1432
}
1432
}
1433
1433
1434
void HTMLInputElement::documentDidResumeFromPageCache()
1434
void HTMLInputElement::resumeFromDocumentSuspension()
1435
{
1435
{
1436
    ASSERT(needsSuspensionCallback());
1436
    ASSERT(needsSuspensionCallback());
1437
1437
1438
#if ENABLE(INPUT_TYPE_COLOR)
1438
#if ENABLE(INPUT_TYPE_COLOR)
1439
    // <input type=color> uses documentWillSuspendForPageCache to detach the color picker UI,
1439
    // <input type=color> uses prepareForDocumentSuspension to detach the color picker UI,
1440
    // so it should not be reset when being loaded from page cache.
1440
    // so it should not be reset when being loaded from page cache.
1441
    if (isColorControl()) 
1441
    if (isColorControl()) 
1442
        return;
1442
        return;
Lines 1445-1451 void HTMLInputElement::documentDidResumeFromPageCache() a/Source/WebCore/html/HTMLInputElement.cpp_sec4
1445
}
1445
}
1446
1446
1447
#if ENABLE(INPUT_TYPE_COLOR)
1447
#if ENABLE(INPUT_TYPE_COLOR)
1448
void HTMLInputElement::documentWillSuspendForPageCache()
1448
void HTMLInputElement::prepareForDocumentSuspension()
1449
{
1449
{
1450
    if (!isColorControl())
1450
    if (!isColorControl())
1451
        return;
1451
        return;
Lines 1502-1508 void HTMLInputElement::didMoveToNewDocument(Document* oldDocument) a/Source/WebCore/html/HTMLInputElement.cpp_sec5
1502
    if (oldDocument) {
1502
    if (oldDocument) {
1503
        // Always unregister for cache callbacks when leaving a document, even if we would otherwise like to be registered
1503
        // Always unregister for cache callbacks when leaving a document, even if we would otherwise like to be registered
1504
        if (needsSuspensionCallback)
1504
        if (needsSuspensionCallback)
1505
            oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
1505
            oldDocument->unregisterForDocumentSuspensionCallbacks(this);
1506
        if (isRadioButton())
1506
        if (isRadioButton())
1507
            oldDocument->formController().checkedRadioButtons().removeButton(this);
1507
            oldDocument->formController().checkedRadioButtons().removeButton(this);
1508
#if ENABLE(TOUCH_EVENTS)
1508
#if ENABLE(TOUCH_EVENTS)
Lines 1512-1518 void HTMLInputElement::didMoveToNewDocument(Document* oldDocument) a/Source/WebCore/html/HTMLInputElement.cpp_sec6
1512
    }
1512
    }
1513
1513
1514
    if (needsSuspensionCallback)
1514
    if (needsSuspensionCallback)
1515
        document().registerForPageCacheSuspensionCallbacks(this);
1515
        document().registerForDocumentSuspensionCallbacks(this);
1516
1516
1517
#if ENABLE(TOUCH_EVENTS)
1517
#if ENABLE(TOUCH_EVENTS)
1518
    if (m_hasTouchEventHandler)
1518
    if (m_hasTouchEventHandler)
- a/Source/WebCore/html/HTMLInputElement.h -2 / +2 lines
Lines 376-384 private: a/Source/WebCore/html/HTMLInputElement.h_sec1
376
    virtual bool isInRange() const override final;
376
    virtual bool isInRange() const override final;
377
    virtual bool isOutOfRange() const override final;
377
    virtual bool isOutOfRange() const override final;
378
378
379
    virtual void documentDidResumeFromPageCache() override final;
379
    virtual void resumeFromDocumentSuspension() override final;
380
#if ENABLE(INPUT_TYPE_COLOR)
380
#if ENABLE(INPUT_TYPE_COLOR)
381
    virtual void documentWillSuspendForPageCache() override final;
381
    virtual void prepareForDocumentSuspension() override final;
382
#endif
382
#endif
383
383
384
    virtual void addSubresourceAttributeURLs(ListHashSet<URL>&) const override final;
384
    virtual void addSubresourceAttributeURLs(ListHashSet<URL>&) const override final;
- a/Source/WebCore/html/HTMLMediaElement.cpp -4 / +4 lines
Lines 545-551 void HTMLMediaElement::registerWithDocument(Document& document) a/Source/WebCore/html/HTMLMediaElement.cpp_sec1
545
#endif
545
#endif
546
546
547
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
547
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
548
    document.registerForPageCacheSuspensionCallbacks(this);
548
    document.registerForDocumentSuspensionCallbacks(this);
549
#endif
549
#endif
550
550
551
    document.registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks(*this);
551
    document.registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks(*this);
Lines 579-585 void HTMLMediaElement::unregisterWithDocument(Document& document) a/Source/WebCore/html/HTMLMediaElement.cpp_sec2
579
#endif
579
#endif
580
580
581
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
581
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
582
    document.unregisterForPageCacheSuspensionCallbacks(this);
582
    document.unregisterForDocumentSuspensionCallbacks(this);
583
#endif
583
#endif
584
584
585
    document.unregisterForAllowsMediaDocumentInlinePlaybackChangedCallbacks(*this);
585
    document.unregisterForAllowsMediaDocumentInlinePlaybackChangedCallbacks(*this);
Lines 605-616 void HTMLMediaElement::didMoveToNewDocument(Document* oldDocument) a/Source/WebCore/html/HTMLMediaElement.cpp_sec3
605
}
605
}
606
606
607
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
607
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
608
void HTMLMediaElement::documentWillSuspendForPageCache()
608
void HTMLMediaElement::prepareForDocumentSuspension()
609
{
609
{
610
    m_mediaSession->unregisterWithDocument(document());
610
    m_mediaSession->unregisterWithDocument(document());
611
}
611
}
612
612
613
void HTMLMediaElement::documentDidResumeFromPageCache()
613
void HTMLMediaElement::resumeFromDocumentSuspension()
614
{
614
{
615
    m_mediaSession->registerWithDocument(document());
615
    m_mediaSession->registerWithDocument(document());
616
}
616
}
- a/Source/WebCore/html/HTMLMediaElement.h -2 / +2 lines
Lines 747-754 private: a/Source/WebCore/html/HTMLMediaElement.h_sec1
747
    void updateCaptionContainer();
747
    void updateCaptionContainer();
748
748
749
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
749
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
750
    virtual void documentWillSuspendForPageCache() override final;
750
    virtual void prepareForDocumentSuspension() override final;
751
    virtual void documentDidResumeFromPageCache() override final;
751
    virtual void resumeFromDocumentSuspension() override final;
752
752
753
    enum class UpdateMediaState {
753
    enum class UpdateMediaState {
754
        Asynchronously,
754
        Asynchronously,
- a/Source/WebCore/html/HTMLPlugInImageElement.cpp -8 / +8 lines
Lines 123-129 HTMLPlugInImageElement::HTMLPlugInImageElement(const QualifiedName& tagName, Doc a/Source/WebCore/html/HTMLPlugInImageElement.cpp_sec1
123
HTMLPlugInImageElement::~HTMLPlugInImageElement()
123
HTMLPlugInImageElement::~HTMLPlugInImageElement()
124
{
124
{
125
    if (m_needsDocumentActivationCallbacks)
125
    if (m_needsDocumentActivationCallbacks)
126
        document().unregisterForPageCacheSuspensionCallbacks(this);
126
        document().unregisterForDocumentSuspensionCallbacks(this);
127
}
127
}
128
128
129
void HTMLPlugInImageElement::setDisplayState(DisplayState state)
129
void HTMLPlugInImageElement::setDisplayState(DisplayState state)
Lines 200-206 RenderPtr<RenderElement> HTMLPlugInImageElement::createElementRenderer(Ref<Rende a/Source/WebCore/html/HTMLPlugInImageElement.cpp_sec2
200
    // inactive or reactivates so it can clear the renderer before going into the page cache.
200
    // inactive or reactivates so it can clear the renderer before going into the page cache.
201
    if (!m_needsDocumentActivationCallbacks) {
201
    if (!m_needsDocumentActivationCallbacks) {
202
        m_needsDocumentActivationCallbacks = true;
202
        m_needsDocumentActivationCallbacks = true;
203
        document().registerForPageCacheSuspensionCallbacks(this);
203
        document().registerForDocumentSuspensionCallbacks(this);
204
    }
204
    }
205
205
206
    if (displayState() == DisplayingSnapshot) {
206
    if (displayState() == DisplayingSnapshot) {
Lines 301-308 void HTMLPlugInImageElement::finishParsingChildren() a/Source/WebCore/html/HTMLPlugInImageElement.cpp_sec3
301
void HTMLPlugInImageElement::didMoveToNewDocument(Document* oldDocument)
301
void HTMLPlugInImageElement::didMoveToNewDocument(Document* oldDocument)
302
{
302
{
303
    if (m_needsDocumentActivationCallbacks) {
303
    if (m_needsDocumentActivationCallbacks) {
304
        oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
304
        oldDocument->unregisterForDocumentSuspensionCallbacks(this);
305
        document().registerForPageCacheSuspensionCallbacks(this);
305
        document().registerForDocumentSuspensionCallbacks(this);
306
    }
306
    }
307
307
308
    if (m_imageLoader)
308
    if (m_imageLoader)
Lines 311-329 void HTMLPlugInImageElement::didMoveToNewDocument(Document* oldDocument) a/Source/WebCore/html/HTMLPlugInImageElement.cpp_sec4
311
    HTMLPlugInElement::didMoveToNewDocument(oldDocument);
311
    HTMLPlugInElement::didMoveToNewDocument(oldDocument);
312
}
312
}
313
313
314
void HTMLPlugInImageElement::documentWillSuspendForPageCache()
314
void HTMLPlugInImageElement::prepareForDocumentSuspension()
315
{
315
{
316
    if (renderer())
316
    if (renderer())
317
        Style::detachRenderTree(*this);
317
        Style::detachRenderTree(*this);
318
318
319
    HTMLPlugInElement::documentWillSuspendForPageCache();
319
    HTMLPlugInElement::prepareForDocumentSuspension();
320
}
320
}
321
321
322
void HTMLPlugInImageElement::documentDidResumeFromPageCache()
322
void HTMLPlugInImageElement::resumeFromDocumentSuspension()
323
{
323
{
324
    setNeedsStyleRecalc(ReconstructRenderTree);
324
    setNeedsStyleRecalc(ReconstructRenderTree);
325
325
326
    HTMLPlugInElement::documentDidResumeFromPageCache();
326
    HTMLPlugInElement::resumeFromDocumentSuspension();
327
}
327
}
328
328
329
void HTMLPlugInImageElement::startLoadingImage()
329
void HTMLPlugInImageElement::startLoadingImage()
- a/Source/WebCore/html/HTMLPlugInImageElement.h -2 / +2 lines
Lines 120-127 private: a/Source/WebCore/html/HTMLPlugInImageElement.h_sec1
120
    virtual void didAttachRenderers() override final;
120
    virtual void didAttachRenderers() override final;
121
    virtual void willDetachRenderers() override final;
121
    virtual void willDetachRenderers() override final;
122
122
123
    virtual void documentWillSuspendForPageCache() override final;
123
    virtual void prepareForDocumentSuspension() override final;
124
    virtual void documentDidResumeFromPageCache() override final;
124
    virtual void resumeFromDocumentSuspension() override final;
125
125
126
    virtual void defaultEventHandler(Event*) override final;
126
    virtual void defaultEventHandler(Event*) override final;
127
    virtual void dispatchPendingMouseClick() override final;
127
    virtual void dispatchPendingMouseClick() override final;
- a/Source/WebCore/loader/FrameLoader.cpp -1 / +1 lines
Lines 1820-1826 void FrameLoader::commitProvisionalLoad() a/Source/WebCore/loader/FrameLoader.cpp_sec1
1820
        if (m_frame.document()->doctype() && m_frame.page())
1820
        if (m_frame.document()->doctype() && m_frame.page())
1821
            m_frame.page()->chrome().didReceiveDocType(&m_frame);
1821
            m_frame.page()->chrome().didReceiveDocType(&m_frame);
1822
#endif
1822
#endif
1823
        m_frame.document()->documentDidResumeFromPageCache();
1823
        m_frame.document()->resume();
1824
1824
1825
        // Force a layout to update view size and thereby update scrollbars.
1825
        // Force a layout to update view size and thereby update scrollbars.
1826
#if PLATFORM(IOS)
1826
#if PLATFORM(IOS)
- a/Source/WebCore/svg/SVGSVGElement.cpp -6 / +6 lines
Lines 68-74 inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document& docu a/Source/WebCore/svg/SVGSVGElement.cpp_sec1
68
{
68
{
69
    ASSERT(hasTagName(SVGNames::svgTag));
69
    ASSERT(hasTagName(SVGNames::svgTag));
70
    registerAnimatedPropertiesForSVGSVGElement();
70
    registerAnimatedPropertiesForSVGSVGElement();
71
    document.registerForPageCacheSuspensionCallbacks(this);
71
    document.registerForDocumentSuspensionCallbacks(this);
72
}
72
}
73
73
74
Ref<SVGSVGElement> SVGSVGElement::create(const QualifiedName& tagName, Document& document)
74
Ref<SVGSVGElement> SVGSVGElement::create(const QualifiedName& tagName, Document& document)
Lines 85-99 SVGSVGElement::~SVGSVGElement() a/Source/WebCore/svg/SVGSVGElement.cpp_sec2
85
{
85
{
86
    if (m_viewSpec)
86
    if (m_viewSpec)
87
        m_viewSpec->resetContextElement();
87
        m_viewSpec->resetContextElement();
88
    document().unregisterForPageCacheSuspensionCallbacks(this);
88
    document().unregisterForDocumentSuspensionCallbacks(this);
89
    document().accessSVGExtensions().removeTimeContainer(this);
89
    document().accessSVGExtensions().removeTimeContainer(this);
90
}
90
}
91
91
92
void SVGSVGElement::didMoveToNewDocument(Document* oldDocument)
92
void SVGSVGElement::didMoveToNewDocument(Document* oldDocument)
93
{
93
{
94
    if (oldDocument)
94
    if (oldDocument)
95
        oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
95
        oldDocument->unregisterForDocumentSuspensionCallbacks(this);
96
    document().registerForPageCacheSuspensionCallbacks(this);
96
    document().registerForDocumentSuspensionCallbacks(this);
97
    SVGGraphicsElement::didMoveToNewDocument(oldDocument);
97
    SVGGraphicsElement::didMoveToNewDocument(oldDocument);
98
}
98
}
99
99
Lines 658-669 void SVGSVGElement::inheritViewAttributes(const SVGViewElement& viewElement) a/Source/WebCore/svg/SVGSVGElement.cpp_sec3
658
        view.setZoomAndPanBaseValue(zoomAndPan());
658
        view.setZoomAndPanBaseValue(zoomAndPan());
659
}
659
}
660
660
661
void SVGSVGElement::documentWillSuspendForPageCache()
661
void SVGSVGElement::prepareForDocumentSuspension()
662
{
662
{
663
    pauseAnimations();
663
    pauseAnimations();
664
}
664
}
665
665
666
void SVGSVGElement::documentDidResumeFromPageCache()
666
void SVGSVGElement::resumeFromDocumentSuspension()
667
{
667
{
668
    unpauseAnimations();
668
    unpauseAnimations();
669
}
669
}
- a/Source/WebCore/svg/SVGSVGElement.h -2 / +2 lines
Lines 139-146 private: a/Source/WebCore/svg/SVGSVGElement.h_sec1
139
    virtual void removedFrom(ContainerNode&) override;
139
    virtual void removedFrom(ContainerNode&) override;
140
    virtual void svgAttributeChanged(const QualifiedName&) override;
140
    virtual void svgAttributeChanged(const QualifiedName&) override;
141
    virtual bool selfHasRelativeLengths() const override;
141
    virtual bool selfHasRelativeLengths() const override;
142
    virtual void documentWillSuspendForPageCache() override;
142
    virtual void prepareForDocumentSuspension() override;
143
    virtual void documentDidResumeFromPageCache() override;
143
    virtual void resumeFromDocumentSuspension() override;
144
    virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const override;
144
    virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const override;
145
145
146
    Frame* frameForCurrentScale() const;
146
    Frame* frameForCurrentScale() const;

Return to Bug 151527