Diff
Modified: trunk/ChangeLog (92123 => 92124)
--- trunk/ChangeLog 2011-08-01 11:53:51 UTC (rev 92123)
+++ trunk/ChangeLog 2011-08-01 12:25:53 UTC (rev 92124)
@@ -1,3 +1,12 @@
+2011-08-01 Hayato Ito <[email protected]>
+
+ Add support for getting an element in shadow root by its id into a window.internals object.
+ https://bugs.webkit.org/show_bug.cgi?id=64587
+
+ Reviewed by Hajime Morita.
+
+ * Source/autotools/symbols.filter:
+
2011-08-01 Neil Roberts <[email protected]>
build: Fix finding the headers for GStreamer
Modified: trunk/LayoutTests/ChangeLog (92123 => 92124)
--- trunk/LayoutTests/ChangeLog 2011-08-01 11:53:51 UTC (rev 92123)
+++ trunk/LayoutTests/ChangeLog 2011-08-01 12:25:53 UTC (rev 92124)
@@ -1,3 +1,16 @@
+2011-08-01 Hayato Ito <[email protected]>
+
+ Add support for getting an element in shadow root by its id into a window.internals object.
+ https://bugs.webkit.org/show_bug.cgi?id=64587
+
+ Reviewed by Hajime Morita.
+
+ * fast/dom/shadow/get-element-by-id-in-shadow-root-expected.txt: Added.
+ * fast/dom/shadow/get-element-by-id-in-shadow-root.html: Added.
+ * fast/dom/shadow/resources/create-dom.js: Added.
+ (createShadow):
+ (createDom):
+
2011-08-01 Yury Semikhatsky <[email protected]>
Web Inspector: typing an _expression_ in an iframe leads to multiple "Unsafe _javascript_ attempt to access frame..." errors
Added: trunk/LayoutTests/fast/dom/shadow/get-element-by-id-in-shadow-root-expected.txt (0 => 92124)
--- trunk/LayoutTests/fast/dom/shadow/get-element-by-id-in-shadow-root-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/get-element-by-id-in-shadow-root-expected.txt 2011-08-01 12:25:53 UTC (rev 92124)
@@ -0,0 +1,12 @@
+Tests to ensure that internals.getElementByIdInTreeScope can get an element in TreeScope by its id. Can only run within DRT
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getElementInShadow('divA/inputB').id is "inputB"
+PASS getElementInShadow('divA/divC').id is "divC"
+PASS getElementInShadow('divA/divC/inputD').id is "inputD"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/dom/shadow/get-element-by-id-in-shadow-root-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/fast/dom/shadow/get-element-by-id-in-shadow-root.html (0 => 92124)
--- trunk/LayoutTests/fast/dom/shadow/get-element-by-id-in-shadow-root.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/get-element-by-id-in-shadow-root.html 2011-08-01 12:25:53 UTC (rev 92124)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Tests to ensure that internals.getElementByIdInTreeScope can get an element in TreeScope by its id. Can only run within DRT");
+
+function getElementInShadow(path)
+{
+ var ids = path.split('/');
+ var element = document.getElementById(ids[0]);
+ for (var i = 1; element != null && i < ids.length; ++i) {
+ var shadowRoot = internals.shadowRoot(element);
+ element = internals.getElementByIdInShadowRoot(shadowRoot, ids[i]);
+ }
+ return element;
+}
+
+function prepareDomTree(parent)
+{
+ parent.appendChild(
+ createShadow('div', {'id': 'divA'},
+ createDom('input', {'id': 'inputB'}),
+ createShadow('div', {'id': 'divC'},
+ createDom('input', {'id': 'inputD'}))));
+}
+
+function test()
+{
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+ prepareDomTree(document.body);
+ shouldBeEqualToString("getElementInShadow('divA/inputB').id", 'inputB');
+ shouldBeEqualToString("getElementInShadow('divA/divC').id", 'divC');
+ shouldBeEqualToString("getElementInShadow('divA/divC/inputD').id", 'inputD');
+}
+
+test();
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/dom/shadow/get-element-by-id-in-shadow-root.html
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/fast/dom/shadow/resources/create-dom.js (0 => 92124)
--- trunk/LayoutTests/fast/dom/shadow/resources/create-dom.js (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/resources/create-dom.js 2011-08-01 12:25:53 UTC (rev 92124)
@@ -0,0 +1,24 @@
+// This function can take optional child elements as arguments[2:].
+function createShadow(tagName, attributes)
+{
+ var element = document.createElement(tagName);
+ for (var name in attributes)
+ element.setAttribute(name, attributes[name]);
+ var shadow = internals.ensureShadowRoot(element);
+ var childElements = Array.prototype.slice.call(arguments, 2);
+ for (var i = 0; i < childElements.length; ++i)
+ shadow.appendChild(childElements[i]);
+ return element;
+}
+
+// This function can take optional child elements as arguments[2:].
+function createDom(tagName, attributes)
+{
+ var element = document.createElement(tagName);
+ for (var name in attributes)
+ element.setAttribute(name, attributes[name]);
+ var childElements = Array.prototype.slice.call(arguments, 2);
+ for (var i = 0; i < childElements.length; ++i)
+ element.appendChild(childElements[i]);
+ return element;
+}
Property changes on: trunk/LayoutTests/fast/dom/shadow/resources/create-dom.js
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (92123 => 92124)
--- trunk/Source/WebCore/ChangeLog 2011-08-01 11:53:51 UTC (rev 92123)
+++ trunk/Source/WebCore/ChangeLog 2011-08-01 12:25:53 UTC (rev 92124)
@@ -1,3 +1,33 @@
+2011-08-01 Hayato Ito <[email protected]>
+
+ Add support for getting an element in shadow root by its id into a window.internals object.
+ https://bugs.webkit.org/show_bug.cgi?id=64587
+
+ Reviewed by Hajime Morita.
+
+ Test: fast/dom/shadow/get-element-by-id-in-shadow-root.html
+
+ * WebCore.exp.in:
+ * testing/Internals.cpp:
+ (WebCore::Internals::getElementByIdInShadowRoot):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
+2011-07-15 Hayato Ito <[email protected]>
+
+ Add support for retrieving an element in TreeScope by id to window.internals object.
+ https://bugs.webkit.org/show_bug.cgi?id=64587
+
+ Reviewed by Hajime Morita.
+
+ Test: fast/dom/shadow/get-element-by-id-in-shadow.html
+
+ * WebCore.exp.in:
+ * testing/Internals.cpp:
+ (WebCore::Internals::getElementByIdInTreeScope):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2011-08-01 Yury Semikhatsky <[email protected]>
Web Inspector: typing an _expression_ in an iframe leads to multiple "Unsafe _javascript_ attempt to access frame..." errors
Modified: trunk/Source/WebCore/WebCore.exp.in (92123 => 92124)
--- trunk/Source/WebCore/WebCore.exp.in 2011-08-01 11:53:51 UTC (rev 92123)
+++ trunk/Source/WebCore/WebCore.exp.in 2011-08-01 12:25:53 UTC (rev 92124)
@@ -1342,6 +1342,7 @@
__ZNK7WebCore9FrameView28isEnclosedInCompositingLayerEv
__ZNK7WebCore9PageCache10frameCountEv
__ZNK7WebCore9PageCache21autoreleasedPageCountEv
+__ZNK7WebCore9TreeScope14getElementByIdERKN3WTF12AtomicStringE
__ZTVN7WebCore12ChromeClientE
__ZTVN7WebCore12JSDOMWrapperE
__ZTVN7WebCore16IconDatabaseBaseE
Modified: trunk/Source/WebCore/testing/Internals.cpp (92123 => 92124)
--- trunk/Source/WebCore/testing/Internals.cpp 2011-08-01 11:53:51 UTC (rev 92123)
+++ trunk/Source/WebCore/testing/Internals.cpp 2011-08-01 12:25:53 UTC (rev 92124)
@@ -72,6 +72,15 @@
return ShadowContentElement::create(document);
}
+Element* Internals::getElementByIdInShadowRoot(Node* shadowRoot, const String& id, ExceptionCode& ec)
+{
+ if (!shadowRoot || !shadowRoot->isShadowRoot()) {
+ ec = INVALID_ACCESS_ERR;
+ return 0;
+ }
+ return toShadowRoot(shadowRoot)->getElementById(id);
+}
+
String Internals::elementRenderTreeAsText(Element* element, ExceptionCode& ec)
{
if (!element) {
Modified: trunk/Source/WebCore/testing/Internals.h (92123 => 92124)
--- trunk/Source/WebCore/testing/Internals.h 2011-08-01 11:53:51 UTC (rev 92123)
+++ trunk/Source/WebCore/testing/Internals.h 2011-08-01 12:25:53 UTC (rev 92124)
@@ -54,6 +54,7 @@
Element* includerFor(Node*, ExceptionCode&);
String shadowPseudoId(Element*, ExceptionCode&);
PassRefPtr<Element> createShadowContentElement(Document*, ExceptionCode&);
+ Element* getElementByIdInShadowRoot(Node* shadowRoot, const String& id, ExceptionCode&);
#if ENABLE(INSPECTOR)
void setInspectorResourcesDataSizeLimits(Document*, int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode&);
Modified: trunk/Source/WebCore/testing/Internals.idl (92123 => 92124)
--- trunk/Source/WebCore/testing/Internals.idl 2011-08-01 11:53:51 UTC (rev 92123)
+++ trunk/Source/WebCore/testing/Internals.idl 2011-08-01 12:25:53 UTC (rev 92124)
@@ -36,6 +36,7 @@
void removeShadowRoot(in Element host) raises (DOMException);
DOMString shadowPseudoId(in Element element) raises (DOMException);
Element createShadowContentElement(in Document document) raises(DOMException);
+ Element getElementByIdInShadowRoot(in Node shadowRoot, in DOMString id) raises(DOMException);
void setInspectorResourcesDataSizeLimits(in Document document, in long maximumResourcesContentSize, in long maximumSingleResourceContentSize) raises(DOMException);
Modified: trunk/Source/WebKit2/ChangeLog (92123 => 92124)
--- trunk/Source/WebKit2/ChangeLog 2011-08-01 11:53:51 UTC (rev 92123)
+++ trunk/Source/WebKit2/ChangeLog 2011-08-01 12:25:53 UTC (rev 92124)
@@ -1,3 +1,13 @@
+2011-08-01 Hayato Ito <[email protected]>
+
+ Add support for getting an element in shadow root by its id into a window.internals object.
+ https://bugs.webkit.org/show_bug.cgi?id=64587
+
+ Reviewed by Hajime Morita.
+
+ * win/WebKit2.def:
+ * win/WebKit2CFLite.def:
+
2011-08-01 Sheriff Bot <[email protected]>
Unreviewed, rolling out r92108.
Modified: trunk/Source/WebKit2/win/WebKit2.def (92123 => 92124)
--- trunk/Source/WebKit2/win/WebKit2.def 2011-08-01 11:53:51 UTC (rev 92123)
+++ trunk/Source/WebKit2/win/WebKit2.def 2011-08-01 12:25:53 UTC (rev 92124)
@@ -151,6 +151,7 @@
?ensureShadowRoot@Element@WebCore@@QAEPAVShadowRoot@2@XZ
?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z
?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
+ ?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z
?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@UStringHash@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z
?page@Document@WebCore@@QBEPAVPage@2@XZ
Modified: trunk/Source/WebKit2/win/WebKit2CFLite.def (92123 => 92124)
--- trunk/Source/WebKit2/win/WebKit2CFLite.def 2011-08-01 11:53:51 UTC (rev 92123)
+++ trunk/Source/WebKit2/win/WebKit2CFLite.def 2011-08-01 12:25:53 UTC (rev 92124)
@@ -143,6 +143,7 @@
?ensureShadowRoot@Element@WebCore@@QAEPAVShadowRoot@2@XZ
?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z
?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
+ ?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z
?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVClientRect@1@@Z
?updateLayoutIgnorePendingStylesheets@Document@WebCore@@QAEXXZ
@@ -156,4 +157,4 @@
?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@Z
?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
?toNode@WebCore@@YAPAVNode@1@VJSValue@JSC@@@Z
- ?virtualFunctionToPreventWeakVtable@JSDOMWrapper@WebCore@@MAEXXZ
\ No newline at end of file
+ ?virtualFunctionToPreventWeakVtable@JSDOMWrapper@WebCore@@MAEXXZ
Modified: trunk/Source/autotools/symbols.filter (92123 => 92124)
--- trunk/Source/autotools/symbols.filter 2011-08-01 11:53:51 UTC (rev 92123)
+++ trunk/Source/autotools/symbols.filter 2011-08-01 12:25:53 UTC (rev 92124)
@@ -60,6 +60,7 @@
_ZNK7WebCore6JSNode21pushEventHandlerScopeEPN3JSC9ExecStateEPNS1_14ScopeChainNodeE;
_ZNK7WebCore7Element10shadowRootEv;
_ZNK7WebCore8Document4pageEv;
+_ZNK7WebCore9TreeScope14getElementByIdERKN3WTF12AtomicStringE;
local:
_Z*;
cti*;