| Differences between
and this patch
- a/LayoutTests/ChangeLog +10 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2011-08-02  Kent Tamura  <tkent@chromium.org>
2
3
        Support <iframe> in shadow trees
4
        https://bugs.webkit.org/show_bug.cgi?id=65595
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * fast/dom/shadow/shadow-iframe-expected.txt: Added.
9
        * fast/dom/shadow/shadow-iframe.html: Added.
10
1
2011-07-31  Gavin Barraclough  <barraclough@apple.com>
11
2011-07-31  Gavin Barraclough  <barraclough@apple.com>
2
12
3
        https://bugs.webkit.org/show_bug.cgi?id=64679
13
        https://bugs.webkit.org/show_bug.cgi?id=64679
- a/LayoutTests/fast/dom/shadow/resources/subframe1.html +1 lines
Line 0 a/LayoutTests/fast/dom/shadow/resources/subframe1.html_sec1
1
<p>Subframe 1</p>
- a/LayoutTests/fast/dom/shadow/resources/subframe2.html +1 lines
Line 0 a/LayoutTests/fast/dom/shadow/resources/subframe2.html_sec1
1
<p>Subframe 2</p>
- a/LayoutTests/fast/dom/shadow/shadow-iframe-expected.txt +12 lines
Line 0 a/LayoutTests/fast/dom/shadow/shadow-iframe-expected.txt_sec1
1
The resource for a shaodow iframe should be loaded, and the iframe should be invisible in window.frames.
2
3
==> subframe1 has been loaded.
4
==> subframe2 has been loaded.
5
PASS window.frames.length is 0
6
PASS window.frames["shadowFrameName"] is undefined.
7
PASS document["shadowFrameName"] is undefined.
8
9
10
============== Back Forward List ==============
11
curr->  (file test):fast/dom/shadow/shadow-iframe.html  **nav target**
12
===============================================
- a/LayoutTests/fast/dom/shadow/shadow-iframe.html +51 lines
Line 0 a/LayoutTests/fast/dom/shadow/shadow-iframe.html_sec1
1
<!DOCTYPE>
2
<html>
3
<body onload="addShadowFrame()">
4
<script src="../../js/resources/js-test-pre.js"></script>
5
<p>The resource for a shaodow iframe should be loaded, and the iframe should be invisible in window.frames.</p>
6
<div id="console"></div>
7
<div id="host"></div>
8
9
<script>
10
var shadowFrame;
11
var count = 0;
12
13
function addShadowFrame() {
14
    if (!window.internals) {
15
        debug('This test needs window.internals.');
16
        return;
17
    }
18
    var host = document.getElementById('host');
19
    var shadowRoot = internals.ensureShadowRoot(host);
20
    shadowFrame = document.createElement('iframe');
21
    shadowFrame.addEventListener('load', shadowFrameLoaded);
22
    shadowFrame.src = 'resources/subframe1.html';
23
    shadowFrame.name = 'shadowFrameName';
24
    shadowRoot.appendChild(shadowFrame);
25
}
26
27
function shadowFrameLoaded() {
28
    count++;
29
    if (count == 1) {
30
        debug('==> subframe1 has been loaded.');
31
        shadowFrame.src = 'resources/subframe2.html';
32
        return;
33
    }
34
    debug('==> subframe2 has been loaded.');
35
    shouldBe('window.frames.length', '0');
36
    for (var i = 0; i < window.frames.length; ++i)
37
        debug('[' + i + ']: name="' + window.frames[i].name +'"');
38
    shouldBeUndefined('window.frames["shadowFrameName"]');
39
    shouldBeUndefined('document["shadowFrameName"]');
40
41
    layoutTestController.notifyDone();
42
}
43
44
if (window.layoutTestController) {
45
    // The back forward list should contain just one line.
46
    layoutTestController.dumpBackForwardList();
47
    layoutTestController.waitUntilDone();
48
}
49
</script>
50
</body>
51
</html>
- a/Source/WebCore/ChangeLog +41 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-08-02  Kent Tamura  <tkent@chromium.org>
2
3
        Support <iframe> in shadow trees
4
        https://bugs.webkit.org/show_bug.cgi?id=65595
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Traversing functions of FrameTree excludes shadow frames. This means:
9
        - window.frames[] doesn't include shadow frames.
10
        - Loadings in shadow frames don't update browser history.
11
12
        Test: fast/dom/shadow/shadow-iframe.html
13
14
        * WebCore.exp.in:
15
        Add FrameTree::firstChild() and nextSibling() because WebFrame.mm calls them.
16
        * loader/FrameLoader.cpp:
17
        (WebCore::FrameLoader::checkLoadComplete):
18
        Use traverseNextIncludingShadows() instead of traverseNext().
19
        * loader/HistoryController.cpp:
20
        (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
21
        Don't update a hisotry item for shadow frames.
22
        * page/Frame.cpp:
23
        (WebCore::Frame::isInShadowTree): Added.
24
        * page/Frame.h:
25
        * page/FrameTree.cpp:
26
        (WebCore::FrameTree::nextSibling): Don't return shadow frames.
27
        (WebCore::FrameTree::previousSibling): ditto.
28
        (WebCore::FrameTree::firstChild): ditto.
29
        (WebCore::FrameTree::lastChild): ditto.
30
        (WebCore::FrameTree::actuallyAppendChild): Update m_shadowChildCount.
31
        (WebCore::FrameTree::removeChild): ditto.
32
        (WebCore::FrameTree::traverseNextIncludingShadows):
33
        Added. This functions traverses the tree including shadow frames.
34
        * page/FrameTree.h:
35
        (WebCore::FrameTree::FrameTree): Initialize m_shadowChildCount.
36
        (WebCore::FrameTree::childCount): This returns the number of non-shadow frames.
37
        * page/Page.cpp:
38
        (WebCore::Page::checkFrameCountConsistency):
39
        Use traverseNextIncludingShadows() because Page::m_frameCount includes
40
        the number of shadow frames.
41
1
2011-07-31  Sam Weinig  <sam@webkit.org>
42
2011-07-31  Sam Weinig  <sam@webkit.org>
2
43
3
        REGRESSION: getBoundingClientRect() method of Range incorrectly returns null for collapsed Range
44
        REGRESSION: getBoundingClientRect() method of Range incorrectly returns null for collapsed Range
- a/Source/WebCore/WebCore.exp.in +2 lines
Lines 1326-1331 __ZNK7WebCore8Position8upstreamENS_27EditingBoundaryCrossingRuleE a/Source/WebCore/WebCore.exp.in_sec1
1326
__ZNK7WebCore9DOMWindow27pendingUnloadEventListenersEv
1326
__ZNK7WebCore9DOMWindow27pendingUnloadEventListenersEv
1327
__ZNK7WebCore9FloatQuad11boundingBoxEv
1327
__ZNK7WebCore9FloatQuad11boundingBoxEv
1328
__ZNK7WebCore9FloatRectcv7_NSRectEv
1328
__ZNK7WebCore9FloatRectcv7_NSRectEv
1329
__ZNK7WebCore9FrameTree10firstChildEv
1330
__ZNK7WebCore9FrameTree11nextSiblingEv
1329
__ZNK7WebCore9FrameTree12traverseNextEPKNS_5FrameE
1331
__ZNK7WebCore9FrameTree12traverseNextEPKNS_5FrameE
1330
__ZNK7WebCore9FrameTree14isDescendantOfEPKNS_5FrameE
1332
__ZNK7WebCore9FrameTree14isDescendantOfEPKNS_5FrameE
1331
__ZNK7WebCore9FrameTree20traverseNextWithWrapEb
1333
__ZNK7WebCore9FrameTree20traverseNextWithWrapEb
- a/Source/WebCore/loader/FrameLoader.cpp -1 / +1 lines
Lines 2361-2367 void FrameLoader::checkLoadComplete() a/Source/WebCore/loader/FrameLoader.cpp_sec1
2361
    // is currently needed in order to null out the previous history item for all frames.
2361
    // is currently needed in order to null out the previous history item for all frames.
2362
    if (Page* page = m_frame->page()) {
2362
    if (Page* page = m_frame->page()) {
2363
        Vector<RefPtr<Frame>, 10> frames;
2363
        Vector<RefPtr<Frame>, 10> frames;
2364
        for (RefPtr<Frame> frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
2364
        for (RefPtr<Frame> frame = page->mainFrame(); frame; frame = frame->tree()->traverseNextIncludingShadows())
2365
            frames.append(frame);
2365
            frames.append(frame);
2366
        // To process children before their parents, iterate the vector backwards.
2366
        // To process children before their parents, iterate the vector backwards.
2367
        for (size_t i = frames.size(); i; --i)
2367
        for (size_t i = frames.size(); i; --i)
- a/Source/WebCore/loader/HistoryController.cpp -1 / +1 lines
Lines 385-391 void HistoryController::updateForRedirectWithLockedBackForwardList() a/Source/WebCore/loader/HistoryController.cpp_sec1
385
        }
385
        }
386
        // The client redirect replaces the current history item.
386
        // The client redirect replaces the current history item.
387
        updateCurrentItem();
387
        updateCurrentItem();
388
    } else {
388
    } else if (!m_frame->isInShadowTree()) {
389
        Frame* parentFrame = m_frame->tree()->parent();
389
        Frame* parentFrame = m_frame->tree()->parent();
390
        if (parentFrame && parentFrame->loader()->history()->m_currentItem)
390
        if (parentFrame && parentFrame->loader()->history()->m_currentItem)
391
            parentFrame->loader()->history()->m_currentItem->setChildItem(createItem());
391
            parentFrame->loader()->history()->m_currentItem->setChildItem(createItem());
- a/Source/WebCore/page/Frame.cpp +5 lines
Lines 1115-1118 void Frame::notifyChromeClientWheelEventHandlerCountChanged() const a/Source/WebCore/page/Frame.cpp_sec1
1115
    m_page->chrome()->client()->numWheelEventHandlersChanged(count);
1115
    m_page->chrome()->client()->numWheelEventHandlersChanged(count);
1116
}
1116
}
1117
1117
1118
bool Frame::isInShadowTree() const
1119
{
1120
    return this && ownerElement() && ownerElement()->isInShadowTree();
1121
}
1122
1118
} // namespace WebCore
1123
} // namespace WebCore
- a/Source/WebCore/page/Frame.h +1 lines
Lines 102-107 namespace WebCore { a/Source/WebCore/page/Frame.h_sec1
102
102
103
        Page* page() const;
103
        Page* page() const;
104
        HTMLFrameOwnerElement* ownerElement() const;
104
        HTMLFrameOwnerElement* ownerElement() const;
105
        bool isInShadowTree() const;
105
106
106
        Document* document() const;
107
        Document* document() const;
107
        FrameView* view() const;
108
        FrameView* view() const;
- a/Source/WebCore/page/FrameTree.cpp +63 lines
Lines 23-28 a/Source/WebCore/page/FrameTree.cpp_sec1
23
23
24
#include "Frame.h"
24
#include "Frame.h"
25
#include "FrameView.h"
25
#include "FrameView.h"
26
#include "HTMLFrameOwnerElement.h"
26
#include "Page.h"
27
#include "Page.h"
27
#include "PageGroup.h"
28
#include "PageGroup.h"
28
#include <stdarg.h>
29
#include <stdarg.h>
Lines 63-68 Frame* FrameTree::parent(bool checkForDisconnectedFrame) const a/Source/WebCore/page/FrameTree.cpp_sec2
63
    return m_parent;
64
    return m_parent;
64
}
65
}
65
66
67
Frame* FrameTree::nextSibling() const
68
{
69
    Frame* frame = m_nextSibling.get();
70
    while (frame->isInShadowTree())
71
        frame = frame->tree()->m_nextSibling.get();
72
    return frame;
73
}
74
75
Frame* FrameTree::previousSibling() const
76
{
77
    Frame* frame = m_previousSibling;
78
    while (frame->isInShadowTree())
79
        frame = frame->tree()->m_previousSibling;
80
    return frame;
81
}
82
83
Frame* FrameTree::firstChild() const
84
{
85
    Frame* frame = m_firstChild.get();
86
    if (frame->isInShadowTree())
87
        frame = frame->tree()->nextSibling();
88
    ASSERT(!frame->isInShadowTree());
89
    return frame;
90
}
91
92
Frame* FrameTree::lastChild() const
93
{
94
    Frame* frame = m_lastChild;
95
    if (frame->isInShadowTree())
96
        frame = frame->tree()->previousSibling();
97
    ASSERT(!frame->isInShadowTree());
98
    return frame;
99
}
100
66
bool FrameTree::transferChild(PassRefPtr<Frame> child)
101
bool FrameTree::transferChild(PassRefPtr<Frame> child)
67
{
102
{
68
    Frame* oldParent = child->tree()->parent();
103
    Frame* oldParent = child->tree()->parent();
Lines 102-107 void FrameTree::actuallyAppendChild(PassRefPtr<Frame> child) a/Source/WebCore/page/FrameTree.cpp_sec3
102
        m_firstChild = child;
137
        m_firstChild = child;
103
138
104
    m_childCount++;
139
    m_childCount++;
140
    if (m_lastChild->isInShadowTree())
141
        m_shadowChildCount++;
105
142
106
    ASSERT(!m_lastChild->tree()->m_nextSibling);
143
    ASSERT(!m_lastChild->tree()->m_nextSibling);
107
}
144
}
Lines 124-129 void FrameTree::removeChild(Frame* child) a/Source/WebCore/page/FrameTree.cpp_sec4
124
    child->tree()->m_nextSibling = 0;
161
    child->tree()->m_nextSibling = 0;
125
162
126
    m_childCount--;
163
    m_childCount--;
164
    if (child->isInShadowTree())
165
        m_shadowChildCount--;
127
}
166
}
128
167
129
AtomicString FrameTree::uniqueChildName(const AtomicString& requestedName) const
168
AtomicString FrameTree::uniqueChildName(const AtomicString& requestedName) const
Lines 286-291 Frame* FrameTree::traverseNext(const Frame* stayWithin) const a/Source/WebCore/page/FrameTree.cpp_sec5
286
    return 0;
325
    return 0;
287
}
326
}
288
327
328
Frame* FrameTree::traverseNextIncludingShadows() const
329
{
330
    Frame* child = m_firstChild.get();
331
    if (child)
332
        return child;
333
334
    Frame* sibling = m_nextSibling.get();
335
    if (sibling)
336
        return sibling;
337
338
    Frame* frame = m_thisFrame;
339
    while (!sibling) {
340
        frame = frame->tree()->parent();
341
        if (!frame)
342
            return 0;
343
        sibling = frame->tree()->m_nextSibling.get();
344
    }
345
346
    if (frame)
347
        return sibling;
348
349
    return 0;
350
}
351
289
Frame* FrameTree::traverseNextWithWrap(bool wrap) const
352
Frame* FrameTree::traverseNextWithWrap(bool wrap) const
290
{
353
{
291
    if (Frame* result = traverseNext())
354
    if (Frame* result = traverseNext())
- a/Source/WebCore/page/FrameTree.h -6 / +11 lines
Lines 35-40 namespace WebCore { a/Source/WebCore/page/FrameTree.h_sec1
35
            , m_previousSibling(0)
35
            , m_previousSibling(0)
36
            , m_lastChild(0)
36
            , m_lastChild(0)
37
            , m_childCount(0)
37
            , m_childCount(0)
38
            , m_shadowChildCount(0)
38
        {
39
        {
39
        }
40
        }
40
        ~FrameTree();
41
        ~FrameTree();
Lines 45-59 namespace WebCore { a/Source/WebCore/page/FrameTree.h_sec2
45
        void clearName();
46
        void clearName();
46
        Frame* parent(bool checkForDisconnectedFrame = false) const;
47
        Frame* parent(bool checkForDisconnectedFrame = false) const;
47
        void setParent(Frame* parent) { m_parent = parent; }
48
        void setParent(Frame* parent) { m_parent = parent; }
48
        
49
49
        Frame* nextSibling() const { return m_nextSibling.get(); }
50
        // nextSibling(), previousSibling(), firstChild(), and lastChild() exclude shadow frames.
50
        Frame* previousSibling() const { return m_previousSibling; }
51
        Frame* nextSibling() const;
51
        Frame* firstChild() const { return m_firstChild.get(); }
52
        Frame* previousSibling() const;
52
        Frame* lastChild() const { return m_lastChild; }
53
        Frame* firstChild() const;
53
        unsigned childCount() const { return m_childCount; }
54
        Frame* lastChild() const;
55
        // The number of child frames excluding shadow frames.
56
        unsigned childCount() const { return m_childCount - m_shadowChildCount; }
54
57
55
        bool isDescendantOf(const Frame* ancestor) const;
58
        bool isDescendantOf(const Frame* ancestor) const;
56
        Frame* traverseNext(const Frame* stayWithin = 0) const;
59
        Frame* traverseNext(const Frame* stayWithin = 0) const;
60
        Frame* traverseNextIncludingShadows() const;
57
        Frame* traverseNextWithWrap(bool) const;
61
        Frame* traverseNextWithWrap(bool) const;
58
        Frame* traversePreviousWithWrap(bool) const;
62
        Frame* traversePreviousWithWrap(bool) const;
59
        
63
        
Lines 86-91 namespace WebCore { a/Source/WebCore/page/FrameTree.h_sec3
86
        RefPtr<Frame> m_firstChild;
90
        RefPtr<Frame> m_firstChild;
87
        Frame* m_lastChild;
91
        Frame* m_lastChild;
88
        unsigned m_childCount;
92
        unsigned m_childCount;
93
        unsigned m_shadowChildCount;
89
    };
94
    };
90
95
91
} // namespace WebCore
96
} // namespace WebCore
- a/Source/WebCore/page/Page.cpp -1 / +1 lines
Lines 931-937 void Page::checkFrameCountConsistency() const a/Source/WebCore/page/Page.cpp_sec1
931
    ASSERT(m_frameCount >= 0);
931
    ASSERT(m_frameCount >= 0);
932
932
933
    int frameCount = 0;
933
    int frameCount = 0;
934
    for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext())
934
    for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNextIncludingShadows())
935
        ++frameCount;
935
        ++frameCount;
936
936
937
    ASSERT(m_frameCount + 1 == frameCount);
937
    ASSERT(m_frameCount + 1 == frameCount);

Return to Bug 65595