2011-06-19 MORITA Hajime <morrita@google.com>
authormorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Jun 2011 05:08:10 +0000 (05:08 +0000)
committermorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Jun 2011 05:08:10 +0000 (05:08 +0000)
        Reviewed by Dimitri Glazkov.

        The internals object should have createShadowContentElement()
        https://bugs.webkit.org/show_bug.cgi?id=62432

        * Source/autotools/symbols.filter: Added some more symbols necessary for
        window.internals to function to the global symbol list.

2011-06-19  MORITA Hajime  <morrita@google.com>

        Reviewed by Dimitri Glazkov.

        The internals object should have createShadowContentElement()
        https://bugs.webkit.org/show_bug.cgi?id=62432

        * fast/dom/shadow/create-content-element-expected.txt: Added.
        * fast/dom/shadow/create-content-element.html: Added.
2011-06-19  MORITA Hajime  <morrita@google.com>

        Reviewed by Dimitri Glazkov.

        The internals object should have createShadowContentElement()
        https://bugs.webkit.org/show_bug.cgi?id=62432

        This change:
        - added Internals::createShadowContentElement(), which creates,
          ShadowContentElement instance which includes all host children,
        - added Internals::elementRenderTreeAsText() to help content layout testing, and
        - Unabstracted ShadowContentElement by giving a default shouldInclude() implementation.

        Test: fast/dom/shadow/create-content-element.html

        * WebCore.exp.in:
        * dom/ShadowContentElement.cpp:
        (WebCore::ShadowContentElement::create): Added.
        (WebCore::ShadowContentElement::ShadowContentElement):
        (WebCore::ShadowContentElement::~ShadowContentElement):
        (WebCore::ShadowContentElement::shouldInclude): Gave a default implementation which always returns true.
        * dom/ShadowContentElement.h:
        * html/HTMLSummaryElement.cpp:
        (WebCore::SummaryContentElement::SummaryContentElement):
        * rendering/RenderTreeAsText.cpp:
        (WebCore::externalRepresentation): Factored out for supportin per-element render tree dump.
        * rendering/RenderTreeAsText.h:
        * testing/Internals.cpp:
        (WebCore::Internals::createShadowContentElement): Added.
        (WebCore::Internals::elementRenderTreeAsText): dded.
        * testing/Internals.h:
        * testing/Internals.idl:
2011-06-19  MORITA Hajime  <morrita@google.com>

        Reviewed by Dimitri Glazkov.

        The internals object should have createShadowContentElement()
        https://bugs.webkit.org/show_bug.cgi?id=62432

        * win/WebKit2.def: Added some more symbols necessary for
        window.internals to function to the global symbol list.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@89230 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/fast/dom/shadow/create-content-element-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/shadow/create-content-element.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/dom/ShadowContentElement.cpp
Source/WebCore/dom/ShadowContentElement.h
Source/WebCore/html/HTMLSummaryElement.cpp
Source/WebCore/rendering/RenderTreeAsText.cpp
Source/WebCore/rendering/RenderTreeAsText.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit2/ChangeLog
Source/WebKit2/win/WebKit2.def
Source/autotools/symbols.filter

index 2e34109a203dc1aa8bdd8577ec1a8054a21969e9..855bc2dc43a1941efcea4ad9c5dcad5cad594a1d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-06-19  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Dimitri Glazkov.
+
+        The internals object should have createShadowContentElement()
+        https://bugs.webkit.org/show_bug.cgi?id=62432
+
+        * Source/autotools/symbols.filter: Added some more symbols necessary for
+        window.internals to function to the global symbol list.
+        
+
 2011-06-19  Adam Bergkvist  <adam.bergkvist@ericsson.com>
 
         Reviewed by Martin Robinson.
index 9303b5e724cdfcb561092cc4e5d048874bfd8c88..95b888290112a37838eda2952af78880b3717acb 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-19  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Dimitri Glazkov.
+
+        The internals object should have createShadowContentElement()
+        https://bugs.webkit.org/show_bug.cgi?id=62432
+
+        * fast/dom/shadow/create-content-element-expected.txt: Added.
+        * fast/dom/shadow/create-content-element.html: Added.
+
 2011-06-19  Keishi Hattori  <keishi@webkit.org>
 
         Reviewed by Kent Tamura.
diff --git a/LayoutTests/fast/dom/shadow/create-content-element-expected.txt b/LayoutTests/fast/dom/shadow/create-content-element-expected.txt
new file mode 100644 (file)
index 0000000..7c5d436
--- /dev/null
@@ -0,0 +1,3 @@
+This test compares a shadow-based render tree with one for a refrence DOM tree.
+PASS
+
diff --git a/LayoutTests/fast/dom/shadow/create-content-element.html b/LayoutTests/fast/dom/shadow/create-content-element.html
new file mode 100644 (file)
index 0000000..235de56
--- /dev/null
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+/* relative positioning ensures underlying RenderLayer */
+.container {
+    position: relative;
+}
+</style>
+<script>
+function log(message)
+{
+    document.getElementById("console").innerHTML += (message + "\n");
+}
+
+function removeContainerLines(text)
+{
+    var lines = text.split("\n");
+    lines.splice(0, 2);
+    return lines.join("\n");
+}
+
+function setupTargetTree()
+{
+    var target = document.createElement("div");
+    target.innerHTML = "<span>content</span>";
+    var root = layoutTestController.ensureShadowRoot(target);
+    
+    var child0 = document.createElement("span");
+    child0.innerHTML = "Hello,";
+    root.appendChild(child0);
+    root.appendChild(window.internals.createShadowContentElement(document));
+    var child1 = document.createElement("span");
+    child1.innerHTML = "World.";
+    root.appendChild(child1);
+
+    document.getElementById("target").appendChild(target);
+}
+
+function test()
+{
+    layoutTestController.dumpAsText();
+    log("This test compares a shadow-based render tree with one for a refrence DOM tree.");
+    setupTargetTree();
+    var targetContainerRenderTree = window.internals.elementRenderTreeAsText(document.getElementById("targetContainer"));
+    var targetRenderTree = removeContainerLines(targetContainerRenderTree);
+    var refContainerRenderTree = window.internals.elementRenderTreeAsText(document.getElementById("refContainer"));
+    var refRenderTree = removeContainerLines(refContainerRenderTree);
+    if (targetRenderTree == refRenderTree)
+        log("PASS");
+    else {
+        log("FAIL");
+        log("Expected:");
+        log(refRenderTree);
+        log("Actual:");
+        log(targetRenderTree);
+    }
+    
+    document.getElementById("test").style.display = "none";
+}
+</script>
+</head>
+<body onload="test()">
+<div id="test">
+<div class="container" id="targetContainer"><div id="target"></div></div>
+<div class="container" id="refContainer"><div><div><span>Hello,</span><span>content</span><span>World.</span></div></div></div>
+</div>
+<pre id="console"></pre>
+</body>
+</html>
index ddc78577b35dae7aefa25ca9012d9f0f0cbca2e0..1f56bf455e12ed10e12495022d787010d529de3f 100644 (file)
@@ -1,3 +1,36 @@
+2011-06-19  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Dimitri Glazkov.
+
+        The internals object should have createShadowContentElement()
+        https://bugs.webkit.org/show_bug.cgi?id=62432
+
+        This change:
+        - added Internals::createShadowContentElement(), which creates,
+          ShadowContentElement instance which includes all host children,
+        - added Internals::elementRenderTreeAsText() to help content layout testing, and
+        - Unabstracted ShadowContentElement by giving a default shouldInclude() implementation.
+        
+        Test: fast/dom/shadow/create-content-element.html
+
+        * WebCore.exp.in:
+        * dom/ShadowContentElement.cpp:
+        (WebCore::ShadowContentElement::create): Added.
+        (WebCore::ShadowContentElement::ShadowContentElement):
+        (WebCore::ShadowContentElement::~ShadowContentElement):
+        (WebCore::ShadowContentElement::shouldInclude): Gave a default implementation which always returns true.
+        * dom/ShadowContentElement.h:
+        * html/HTMLSummaryElement.cpp:
+        (WebCore::SummaryContentElement::SummaryContentElement):
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::externalRepresentation): Factored out for supportin per-element render tree dump.
+        * rendering/RenderTreeAsText.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::createShadowContentElement): Added.
+        (WebCore::Internals::elementRenderTreeAsText): dded.
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2011-06-19  Keishi Hattori  <keishi@webkit.org>
 
         Reviewed by Kent Tamura.
index 962693c420f9753dfc43f69f62fae4d5412a342b..3affa2e5a462ce6f272061af55a01dea68407bf5 100644 (file)
@@ -140,6 +140,7 @@ __ZN3WTF6StringC1EPK10__CFString
 __ZN7WebCore10CredentialC1ERKN3WTF6StringES4_NS_21CredentialPersistenceE
 __ZN7WebCore10CredentialC1Ev
 __ZN7WebCore10FloatPointC1ERKNS_8IntPointE
+__ZN7WebCore10JSDocument3putEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE
 __ZN7WebCore10JSDocument6s_infoE
 __ZN7WebCore10MouseEvent6createERKN3WTF12AtomicStringENS1_10PassRefPtrINS_9DOMWindowEEERKNS_18PlatformMouseEventEiNS5_INS_4NodeEEE
 __ZN7WebCore10MouseEventC1ERKN3WTF12AtomicStringEbbNS1_10PassRefPtrINS_9DOMWindowEEEiiiiibbbbtNS5_INS_11EventTargetEEENS5_INS_9ClipboardEEEb
@@ -150,6 +151,7 @@ __ZN7WebCore10ScrollView24windowResizerRectChangedEv
 __ZN7WebCore10deleteFileERKN3WTF6StringE
 __ZN7WebCore10handCursorEv
 __ZN7WebCore10setCookiesEPNS_8DocumentERKNS_4KURLERKN3WTF6StringE
+__ZN7WebCore10toDocumentEN3JSC7JSValueE
 __ZN7WebCore11BitmapImageC1EP7CGImagePNS_13ImageObserverE
 __ZN7WebCore11CachedFrame23cachedFramePlatformDataEv
 __ZN7WebCore11CachedFrame26setCachedFramePlatformDataEN3WTF10PassOwnPtrINS_23CachedFramePlatformDataEEE
@@ -351,8 +353,8 @@ __ZN7WebCore14FrameSelection12setSelectionERKNS_16VisibleSelectionEjNS0_19Cursor
 __ZN7WebCore14FrameSelection15revealSelectionERKNS_15ScrollAlignmentEb
 __ZN7WebCore14FrameSelection16setSelectedRangeEPNS_5RangeENS_9EAffinityEb
 __ZN7WebCore14FrameSelection20setSelectionFromNoneEv
-__ZN7WebCore14FrameSelection6modifyENS0_11EAlterationENS_18SelectionDirectionENS_15TextGranularityEb
 __ZN7WebCore14FrameSelection5clearEv
+__ZN7WebCore14FrameSelection6modifyENS0_11EAlterationENS_18SelectionDirectionENS_15TextGranularityEb
 __ZN7WebCore14FrameSelection9selectAllEv
 __ZN7WebCore14FrameSelectionC1EPNS_5FrameE
 __ZN7WebCore14ResourceHandle12releaseProxyEv
@@ -435,6 +437,7 @@ __ZN7WebCore15defaultLanguageEv
 __ZN7WebCore15localizedStringEPKc
 __ZN7WebCore15pathGetFileNameERKN3WTF6StringE
 __ZN7WebCore15reportExceptionEPN3JSC9ExecStateENS0_7JSValueE
+__ZN7WebCore15setDOMExceptionEPN3JSC9ExecStateEi
 __ZN7WebCore15visitedLinkHashEPKtj
 __ZN7WebCore16AbstractDatabase14setIsAvailableEb
 __ZN7WebCore16DeviceMotionData12Acceleration6createEbdbdbd
@@ -488,14 +491,15 @@ __ZN7WebCore16enclosingIntRectERK7_NSRect
 __ZN7WebCore16enclosingIntRectERKNS_9FloatRectE
 __ZN7WebCore16isEndOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
 __ZN7WebCore16startOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
-__ZN7WebCore17CredentialStorage3getERKNS_15ProtectionSpaceE
 __ZN7WebCore17CredentialStorage24getFromPersistentStorageERKNS_15ProtectionSpaceE
+__ZN7WebCore17CredentialStorage3getERKNS_15ProtectionSpaceE
 __ZN7WebCore17DOMImplementation13isXMLMIMETypeERKN3WTF6StringE
 __ZN7WebCore17DOMImplementation14isTextMIMETypeERKN3WTF6StringE
 __ZN7WebCore17DeviceOrientation6createEbdbdbd
 __ZN7WebCore17GlyphPageTreeNode18treeGlyphPageCountEv
 __ZN7WebCore17HistoryController26saveDocumentAndScrollStateEv
 __ZN7WebCore17HistoryController33restoreScrollPositionAndViewStateEv
+__ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9ClassInfoE
 __ZN7WebCore17nameForCursorTypeENS_6Cursor4TypeE
 __ZN7WebCore17openTemporaryFileERKN3WTF6StringERi
 __ZN7WebCore18PlatformMouseEventC1EP7NSEventP6NSView
@@ -540,6 +544,7 @@ __ZN7WebCore19applicationIsSafariEv
 __ZN7WebCore20RenderEmbeddedObject30setShowsCrashedPluginIndicatorEv
 __ZN7WebCore20ResourceResponseBase24setExpectedContentLengthEx
 __ZN7WebCore20ResourceResponseBaseC2Ev
+__ZN7WebCore20ShadowContentElement6createEPNS_8DocumentE
 __ZN7WebCore20SpaceSplitStringData12createVectorEv
 __ZN7WebCore20UserGestureIndicator7s_stateE
 __ZN7WebCore20UserGestureIndicatorC1ENS_26ProcessingUserGestureStateE
@@ -547,7 +552,6 @@ __ZN7WebCore20UserGestureIndicatorD1Ev
 __ZN7WebCore20makeRGBA32FromFloatsEffff
 __ZN7WebCore20protocolIsJavaScriptERKN3WTF6StringE
 __ZN7WebCore21BackForwardController11itemAtIndexEi
-__ZN7WebCore21memoryPressureHandlerEv
 __ZN7WebCore21MemoryPressureHandler7installEv
 __ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS0_4TypeEb
 __ZN7WebCore21PlatformKeyboardEventC1EP7NSEvent
@@ -562,9 +566,11 @@ __ZN7WebCore21UserContentURLPattern5parseERKN3WTF6StringE
 __ZN7WebCore21WindowsLatin1EncodingEv
 __ZN7WebCore21applicationIsApertureEv
 __ZN7WebCore21findEventWithKeyStateEPNS_5EventE
+__ZN7WebCore21getCachedDOMStructureEPNS_17JSDOMGlobalObjectEPKN3JSC9ClassInfoE
 __ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE
 __ZN7WebCore21mainThreadNormalWorldEv
 __ZN7WebCore21markerTextForListItemEPNS_7ElementE
+__ZN7WebCore21memoryPressureHandlerEv
 __ZN7WebCore21reportThreadViolationEPKcNS_20ThreadViolationRoundE
 __ZN7WebCore21resourceLoadSchedulerEv
 __ZN7WebCore21setGlobalIconDatabaseEPNS_16IconDatabaseBaseE
@@ -576,6 +582,7 @@ __ZN7WebCore22contextMenuItemTagBoldEv
 __ZN7WebCore22counterValueForElementEPNS_7ElementE
 __ZN7WebCore22createFragmentFromTextEPNS_5RangeERKN3WTF6StringE
 __ZN7WebCore22externalRepresentationEPNS_5FrameEj
+__ZN7WebCore22externalRepresentationEPNS_7ElementEj
 __ZN7WebCore23AuthenticationChallengeC1ERKNS_15ProtectionSpaceERKNS_10CredentialEjRKNS_16ResourceResponseERKNS_13ResourceErrorE
 __ZN7WebCore23ReplaceSelectionCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_16DocumentFragmentEEEjNS_10EditActionE
 __ZN7WebCore23createFragmentFromNodesEPNS_8DocumentERKN3WTF6VectorIPNS_4NodeELm0EEE
@@ -793,6 +800,9 @@ __ZN7WebCore6Editor6indentEv
 __ZN7WebCore6Editor7CommandC1Ev
 __ZN7WebCore6Editor7commandERKN3WTF6StringE
 __ZN7WebCore6Editor7outdentEv
+__ZN7WebCore6JSNode13visitChildrenERN3JSC11SlotVisitorE
+__ZN7WebCore6JSNode3putEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE
+__ZN7WebCore6JSNode6s_infoE
 __ZN7WebCore6Widget12setFrameRectERKNS_7IntRectE
 __ZN7WebCore6Widget13setBoundsSizeERKNS_7IntSizeE
 __ZN7WebCore6Widget16removeFromParentEv
@@ -933,7 +943,6 @@ __ZN7WebCore9FrameView14adjustViewSizeEv
 __ZN7WebCore9FrameView14setMarginWidthEi
 __ZN7WebCore9FrameView14setNeedsLayoutEv
 __ZN7WebCore9FrameView14setTransparentEb
-__ZNK7WebCore9FrameView13isTransparentEv
 __ZN7WebCore9FrameView15setMarginHeightEi
 __ZN7WebCore9FrameView16setPaintBehaviorEj
 __ZN7WebCore9FrameView17setScrollPositionERKNS_8IntPointE
@@ -941,7 +950,6 @@ __ZN7WebCore9FrameView18updateControlTintsEv
 __ZN7WebCore9FrameView20enterCompositingModeEv
 __ZN7WebCore9FrameView21flushDeferredRepaintsEv
 __ZN7WebCore9FrameView22setBaseBackgroundColorERKNS_5ColorE
-__ZNK7WebCore9FrameView19baseBackgroundColorEv
 __ZN7WebCore9FrameView23updateCanHaveScrollbarsEv
 __ZN7WebCore9FrameView24forceLayoutForPaginationERKNS_9FloatSizeEfNS_19AdjustViewSizeOrNotE
 __ZN7WebCore9FrameView26adjustPageHeightDeprecatedEPffff
@@ -988,6 +996,7 @@ __ZN7WebCore9HTMLNames8videoTagE
 __ZN7WebCore9HTMLNames9iframeTagE
 __ZN7WebCore9HTMLNames9objectTagE
 __ZN7WebCore9HTMLNames9scriptTagE
+__ZN7WebCore9JSElement3putEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE
 __ZN7WebCore9JSElement6s_infoE
 __ZN7WebCore9PageCache11setCapacityEi
 __ZN7WebCore9PageCache27releaseAutoreleasedPagesNowEv
@@ -1019,11 +1028,8 @@ __ZN7WebCore9makeRangeERKNS_15VisiblePositionES2_
 __ZN7WebCore9pageCacheEv
 __ZN7WebCore9plainTextEPKNS_5RangeENS_20TextIteratorBehaviorE
 __ZN7WebCore9toElementEN3JSC7JSValueE
-__ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9ClassInfoE
-__ZN7WebCore21getCachedDOMStructureEPNS_17JSDOMGlobalObjectEPKN3JSC9ClassInfoE
 __ZNK3JSC8Bindings10RootObject12globalObjectEv
 __ZNK3WTF6String14createCFStringEv
-__ZNK7WebCore5Frame26getDocumentBackgroundColorEv
 __ZNK7WebCore10Credential11hasPasswordEv
 __ZNK7WebCore10Credential11persistenceEv
 __ZNK7WebCore10Credential4userEv
@@ -1223,6 +1229,7 @@ __ZNK7WebCore5Frame14selectionImageEb
 __ZNK7WebCore5Frame15contentRendererEv
 __ZNK7WebCore5Frame15layerTreeAsTextEb
 __ZNK7WebCore5Frame18documentTypeStringEv
+__ZNK7WebCore5Frame26getDocumentBackgroundColorEv
 __ZNK7WebCore5Frame31displayStringModifiedByEncodingERKN3WTF6StringE
 __ZNK7WebCore5Frame8settingsEv
 __ZNK7WebCore5Frame9domWindowEv
@@ -1261,6 +1268,7 @@ __ZNK7WebCore6Editor7canCopyEv
 __ZNK7WebCore6Editor7canEditEv
 __ZNK7WebCore6Editor8canPasteEv
 __ZNK7WebCore6Editor9canDeleteEv
+__ZNK7WebCore6JSNode21pushEventHandlerScopeEPN3JSC9ExecStateEPNS1_14ScopeChainNodeE
 __ZNK7WebCore6Widget14platformWidgetEv
 __ZNK7WebCore6Widget23convertToContainingViewERKNS_7IntRectE
 __ZNK7WebCore6Widget23convertToContainingViewERKNS_8IntPointE
@@ -1308,7 +1316,9 @@ __ZNK7WebCore9FrameTree24traversePreviousWithWrapEb
 __ZNK7WebCore9FrameTree4findERKN3WTF12AtomicStringE
 __ZNK7WebCore9FrameTree6parentEb
 __ZNK7WebCore9FrameView11needsLayoutEv
+__ZNK7WebCore9FrameView13isTransparentEv
 __ZNK7WebCore9FrameView13paintBehaviorEv
+__ZNK7WebCore9FrameView19baseBackgroundColorEv
 __ZNK7WebCore9FrameView20isSoftwareRenderableEv
 __ZNK7WebCore9FrameView22windowClipRectForLayerEPKNS_11RenderLayerEb
 __ZNK7WebCore9FrameView28isEnclosedInCompositingLayerEv
index c86654718b3de948de069343962221715f7f2ded..1dcd3dec0729da01e6bef944d38bd2eeb1cb2dd4 100644 (file)
 #include "config.h"
 #include "ShadowContentElement.h"
 
+#include "HTMLNames.h"
 #include "ShadowContentSelector.h"
 
 namespace WebCore {
 
+PassRefPtr<ShadowContentElement> ShadowContentElement::create(Document* document)
+{
+    DEFINE_STATIC_LOCAL(QualifiedName, tagName, (nullAtom, "webkitShadowContent", HTMLNames::divTag.namespaceURI()));
+    return adoptRef(new ShadowContentElement(tagName, document));
+}
+
+ShadowContentElement::ShadowContentElement(const QualifiedName& name, Document* document)
+    : StyledElement(name, document, CreateHTMLElement)
+{
+}
+
+ShadowContentElement::~ShadowContentElement()
+{
+}
+
 void ShadowContentElement::attach()
 {
     ASSERT(!firstChild()); // Currently doesn't support any light child.
@@ -52,4 +68,9 @@ void ShadowContentElement::detach()
     StyledElement::detach();
 }
 
+bool ShadowContentElement::shouldInclude(Node*)
+{
+    return true;
+}
+
 }
index ab6e5a00eabf81469932686d87f3e712087a8669..6349fa56269d11e120d417bfdbe3b3113e040c20 100644 (file)
@@ -40,18 +40,19 @@ namespace WebCore {
 // You should create ShadowContentElement during the host construction.
 class ShadowContentElement : public StyledElement {
 public:
-    ShadowContentElement(const QualifiedName& name, Document* document)
-        : StyledElement(name, document, CreateHTMLElement)
-    {
-    }
+    static PassRefPtr<ShadowContentElement> create(Document*);
 
-    virtual bool shouldInclude(Node*) = 0;
+    virtual ~ShadowContentElement();
+    virtual bool shouldInclude(Node*);
     virtual void attach();
     virtual void detach();
 
     Node* inclusionAt(size_t) const;
     size_t inclusionCount() const;
 
+protected:
+    ShadowContentElement(const QualifiedName&, Document*);
+
 private:
     virtual bool isContentElement() const { return true; }
     virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
index d5247572537f5ac910489d943f3b48e9f93e9547..516b33b1b0a5ccdfa47ea7e3ef35775278ca6db4 100644 (file)
@@ -46,8 +46,6 @@ private:
         : ShadowContentElement(HTMLNames::divTag, document)
     {
     }
-
-    virtual bool shouldInclude(Node*) { return true; }
 };
 
 PassRefPtr<SummaryContentElement> SummaryContentElement::create(Document* document)
index d096f878aea355e4c30c8cbf44c27131e3a65e59..fc4b57df44a7b3bef0dc3e73bd75c1de6c81f891 100644 (file)
@@ -756,29 +756,44 @@ static void writeSelection(TextStream& ts, const RenderObject* o)
            << "selection end:   position " << selection.end().deprecatedEditingOffset() << " of " << nodePosition(selection.end().deprecatedNode()) << "\n";
 }
 
+static String externalRepresentation(RenderBox* renderer, RenderAsTextBehavior behavior)
+{
+    TextStream ts;
+    if (!renderer->hasLayer())
+        ts.release();
+        
+    RenderLayer* layer = renderer->layer();
+    writeLayers(ts, layer, layer, layer->rect(), 0, behavior);
+    writeSelection(ts, renderer);
+    return ts.release();
+}
+
 String externalRepresentation(Frame* frame, RenderAsTextBehavior behavior)
 {
-    PrintContext printContext(frame);
-    if (behavior & RenderAsTextPrintingMode) {
-        if (!frame->contentRenderer())
-            return String();
-        printContext.begin(frame->contentRenderer()->width());
-    }
+    RenderObject* renderer = frame->contentRenderer();
+    if (!renderer || !renderer->isBox())
+        return String();
 
+    PrintContext printContext(frame);
+    if (behavior & RenderAsTextPrintingMode)
+        printContext.begin(toRenderBox(renderer)->width());
     if (!(behavior & RenderAsTextDontUpdateLayout))
         frame->document()->updateLayout();
 
-    RenderObject* o = frame->contentRenderer();
-    if (!o)
-        return String();
+    return externalRepresentation(toRenderBox(renderer), behavior);
+}
 
-    TextStream ts;
-    if (o->hasLayer()) {
-        RenderLayer* l = toRenderBox(o)->layer();
-        writeLayers(ts, l, l, l->rect(), 0, behavior);
-        writeSelection(ts, o);
-    }
-    return ts.release();
+String externalRepresentation(Element* element, RenderAsTextBehavior behavior)
+{
+    RenderObject* renderer = element->renderer();
+    if (!renderer || !renderer->isBox())
+        return String();
+    // Doesn't support printing mode.
+    ASSERT(!(behavior & RenderAsTextPrintingMode));
+    if (!(behavior & RenderAsTextDontUpdateLayout) && element->document())
+        element->document()->updateLayout();
+    
+    return externalRepresentation(toRenderBox(renderer), behavior | RenderAsTextShowAllLayers);
 }
 
 static void writeCounterValuesFromChildren(TextStream& stream, RenderObject* parent, bool& isFirstCounter)
index 4c8b145d5a055a1261f6eb9efdbce5c48c40fd97..0aa72cb720d68ff00ce6a4fb4e16e8b2d1b93879 100644 (file)
@@ -56,6 +56,7 @@ typedef unsigned RenderAsTextBehavior;
 
 // You don't need pageWidthInPixels if you don't specify RenderAsTextInPrintingMode.
 String externalRepresentation(Frame*, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
+String externalRepresentation(Element*, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
 void write(TextStream&, const RenderObject&, int indent = 0, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
 void writeIndent(TextStream&, int indent);
 
index c58913e99dd0e4d8f1c257ac024d68687eeac284..d385f15025fceaababf72687a7d3ac8c172671c1 100644 (file)
@@ -26,6 +26,9 @@
 #include "config.h"
 #include "Internals.h"
 
+#include "RenderTreeAsText.h"
+#include "ShadowContentElement.h"
+
 namespace WebCore {
 
 PassRefPtr<Internals> Internals::create()
@@ -41,4 +44,30 @@ Internals::Internals()
 {
 }
 
+PassRefPtr<Element> Internals::createShadowContentElement(Document* document, ExceptionCode& ec)
+{
+    if (!document) {
+        ec = INVALID_ACCESS_ERR;
+        return 0;
+    }
+
+    return ShadowContentElement::create(document);
+}
+
+String Internals::elementRenderTreeAsText(Element* element, ExceptionCode& ec)
+{
+    if (!element) {
+        ec = INVALID_ACCESS_ERR;
+        return String();
+    }
+
+    String representation = externalRepresentation(element);
+    if (representation.isEmpty()) {
+        ec = INVALID_ACCESS_ERR;
+        return String();
+    }
+
+    return representation;
+}
+
 }
index cbbd9b9c03b492bf1aa44c1113b4b0a60d3e94e5..e6d61cb68978ec042fa949decc1a484653661147 100644 (file)
 #ifndef Internals_h
 #define Internals_h
 
+#include "ExceptionCode.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
+class Document;
+class Element;
+
 class Internals : public RefCounted<Internals> {
 public:
     static PassRefPtr<Internals> create();
     virtual ~Internals();
 
+    PassRefPtr<Element> createShadowContentElement(Document*, ExceptionCode&);
+    String elementRenderTreeAsText(Element*, ExceptionCode&);
 private:
     Internals();
 };
index 9816fd9b19a9243b7d8fa4923fbbc5d2fe0142ce..7cb9cb7948ee15a17b9bdf0d861fd380de9882b2 100644 (file)
@@ -28,6 +28,8 @@ module window {
         LegacyDefaultOptionalArguments,
         OmitConstructor
     ] Internals {
+        Element createShadowContentElement(in Document document) raises(DOMException);
+        DOMString elementRenderTreeAsText(in Element element) raises(DOMException);
     };
 }
 
index 3d76528196ccd739e80e58fd8eaf7aa5cca678fd..035e8b866675b4b2fcf0a36597a4f52180e77c4d 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-19  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Dimitri Glazkov.
+
+        The internals object should have createShadowContentElement()
+        https://bugs.webkit.org/show_bug.cgi?id=62432
+
+        * win/WebKit2.def: Added some more symbols necessary for
+        window.internals to function to the global symbol list.
+
 2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
 
         Reviewed by Darin Adler.
index 1c71a2573eb453654c9d65bfec6652d40ce3af3b..fbec95fe8b6593b9a18f070443300cb65ee903c4 100644 (file)
@@ -138,3 +138,10 @@ EXPORTS
         ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
         ?cacheDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PAV23@PBUClassInfo@3@@Z
         ?virtualFunctionToPreventWeakVtable@JSDOMWrapper@WebCore@@MAEXXZ
+        ?create@ShadowContentElement@WebCore@@SA?AV?$PassRefPtr@VShadowContentElement@WebCore@@@WTF@@PAVDocument@2@@Z
+        ?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z
+        ?setDOMException@WebCore@@YAXPAVExecState@JSC@@H@Z
+        ?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
+        ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
+        ?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@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
\ No newline at end of file
index 733a69f6f4ec574284cf3d2550a79353f2bd74fe..2a3b845dda902ebabc84638d3dee914ec67e6632 100644 (file)
@@ -26,9 +26,24 @@ _ZN3WTF7CStringC2EPKcm;
 _ZN3WTF7CStringD1Ev;
 _ZN3WTF7CStringaSERKS0_;
 _ZN24DumpRenderTreeSupportGtk*;
-_ZN7WebCore21getCachedDOMStructureEPNS_17JSDOMGlobalObjectEPKN3JSC9ClassInfoE;
-_ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9ClassInfoE;
+_ZN7WebCore10JSDocument3putEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE;
+_ZN7WebCore10JSDocument6s_infoE;
+_ZN7WebCore10toDocumentEN3JSC7JSValueE;
 _ZN7WebCore12JSDOMWrapper34virtualFunctionToPreventWeakVtableEv;
+_ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE;
+_ZN7WebCore15setDOMExceptionEPN3JSC9ExecStateEi;
+_ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERN3WTF7HashMapIPNS3_10StringImplENS0_4WeakINS0_8JSStringEEENS3_10StringHashENS3_10HashTraitsIS6_EENSB_IS9_EEEES6_;
+_ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9ClassInfoE;
+_ZN7WebCore20ShadowContentElement6createEPNS_8DocumentE;
+_ZN7WebCore21getCachedDOMStructureEPNS_17JSDOMGlobalObjectEPKN3JSC9ClassInfoE;
+_ZN7WebCore22externalRepresentationEPNS_7ElementEj;
+_ZN7WebCore6JSNode13visitChildrenERN3JSC11SlotVisitorE;
+_ZN7WebCore6JSNode3putEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE;
+_ZN7WebCore6JSNode6s_infoE;
+_ZN7WebCore9JSElement3putEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE;
+_ZN7WebCore9JSElement6s_infoE;
+_ZN7WebCore9toElementEN3JSC7JSValueE;
+_ZNK7WebCore6JSNode21pushEventHandlerScopeEPN3JSC9ExecStateEPNS1_14ScopeChainNodeE;
 local:
 _Z*;
 cti*;