Changeset 120168 in webkit


Ignore:
Timestamp:
Jun 13, 2012 1:05:43 AM (12 years ago)
Author:
morrita@google.com
Message:

REGRESSION(r118098): <content> element does not render distributed children when cloned from another document
https://bugs.webkit.org/show_bug.cgi?id=88148

Source/WebCore:

Reviewed by Dimitri Glazkov.

The shadow DOM availability was decided through FrameLoaderClient.
But there are documents which don't have any associated frames, in
which any shadow DOM related elements cannot be constructed. That
resulsted the regression.

This change introduces a Page-based client called
ContextFeaturesClient which takes the role from FrameLoaderClient
to decide the feature availability, and ContextFeatures which is a
proxy of ContextFeaturesClient. ContextEnabledFeatures is is
replaced with ContextFeatures.

Each ContextFeatures object is owned by a Page, and is attached to
each Document in the page even if the page itself has no referenct
to Frames or Pages. With ContextFeatures, each Document can decide
the feature availability even if it cannot reach Page or Frame.

On RefCountedSupplement: Document instance can live longer than a
Page where it is shwon. This means that ContextFeatures instance
needs to survive after owner Page destruction because it's
referenced from possibly surviving Documents. RefCountedSupplement
is introduced to cover this scenario: It allows supplement classes
to live after Page's destruction.

RefCountedSupplement::hostDestroyed() is notified when the hosting
page is gone. ContextFeatures clears its reference to the client
using this notification.

Test: fast/dom/shadow/elements-in-frameless-document.html

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/scripts/CodeGeneratorV8.pm:

(GenerateImplementation):

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::determineScope):

  • dom/ContextFeatures.cpp: Added.

(WebCore):
(WebCore::ContextFeaturesClient::empty):
(WebCore::ContextFeatures::supplementName):
(WebCore::ContextFeatures::defaultSwitch):
(WebCore::ContextFeatures::shadowDOMEnabled):
(WebCore::ContextFeatures::styleScopedEnabled):
(WebCore::ContextFeatures::pagePopupEnabled):
(WebCore::provideContextFeaturesTo):
(WebCore::provideContextFeaturesToDocumentFrom):

  • dom/ContextFeatures.h: Added.

(WebCore):
(ContextFeatures):
(WebCore::ContextFeatures::ContextFeatures):
(WebCore::ContextFeatures::hostDestroyed):
(ContextFeaturesClient):
(WebCore::ContextFeaturesClient::~ContextFeaturesClient):
(WebCore::ContextFeaturesClient::isEnabled):
(WebCore::ContextFeatures::create):
(WebCore::ContextFeatures::isEnabled):

  • dom/DOMAllInOne.cpp:
  • dom/DOMImplementation.cpp:

(WebCore::DOMImplementation::createDocument):
(WebCore::DOMImplementation::createHTMLDocument):

  • dom/Document.h:

(WebCore::Document::contextFeatures):

  • dom/Document.cpp:

(WebCore::Document::Document):
(WebCore::Document::setContextFeatures):

  • dom/Position.cpp:

(WebCore::Position::Position):
(WebCore::Position::findParent):

  • dom/TreeScope.cpp:

(WebCore::TreeScope::getSelection):

  • dom/make_names.pl:

(printConstructorInterior):
(printFactoryCppFile):
(printWrapperFunctions):
(printWrapperFactoryCppFile):

  • editing/markup.cpp:

(WebCore::createFragmentFromMarkupWithContext):

  • html/HTMLStyleElement.cpp:

(WebCore::HTMLStyleElement::registerWithScopingNode):
(WebCore::HTMLStyleElement::unregisterWithScopingNode):

  • html/shadow/HTMLContentElement.cpp:

(WebCore::contentTagName):

  • inspector/DOMPatchSupport.cpp:

(WebCore::DOMPatchSupport::patchDocument):

  • loader/FrameLoaderClient.h:
  • platform/RefCountedSupplement.h: Copied from Source/WebCore/platform/Supplementable.h.

(WebCore):
(RefCountedSupplement):
(WebCore::RefCountedSupplement::hostDestroyed):
(Wrapper):
(WebCore::RefCountedSupplement::Wrapper::Wrapper):
(WebCore::RefCountedSupplement::Wrapper::~Wrapper):
(WebCore::RefCountedSupplement::Wrapper::wrapped):
(WebCore::RefCountedSupplement::provideTo):
(WebCore::RefCountedSupplement::from):

  • platform/Supplementable.h:

(WebCore::Supplement::isRefCountedWrapper):

  • xml/XMLHttpRequest.cpp:

(WebCore::XMLHttpRequest::responseXML):

Source/WebKit/chromium:

Reviewed by Dimitri Glazkov.

  • Added ContextFeaturesClientImpl which implements WebCore::ContextFeaturesClient.
  • Replaced PagePopupFrameLoaderClient with PagePopupFeaturesClient.
  • WebKit.gyp:
  • public/WebPermissionClient.h:

(WebKit):
(WebKit::WebPermissionClient::allowWebComponents):

  • src/ContextFeaturesClientImpl.cpp: Renamed from Source/WebCore/bindings/generic/ContextEnabledFeatures.cpp.

(WebKit):
(WebKit::ContextFeaturesClientImpl::isEnabled):

  • src/ContextFeaturesClientImpl.h: Renamed from Source/WebCore/bindings/generic/ContextEnabledFeatures.h.

(WebKit):
(ContextFeaturesClientImpl):
(WebKit::ContextFeaturesClientImpl::ContextFeaturesClientImpl):
(WebKit::ContextFeaturesClientImpl::setPermissionClient):

  • src/FrameLoaderClientImpl.cpp:
  • src/FrameLoaderClientImpl.h:

(FrameLoaderClientImpl):

  • src/WebPagePopupImpl.cpp:

(PagePopupFeaturesClient):
(WebKit::PagePopupFeaturesClient::isEnabled):
(WebKit):
(WebKit::WebPagePopupImpl::initPage):

  • src/WebViewImpl.cpp:

(WebKit::WebViewImpl::setPermissionClient):
(WebKit::WebViewImpl::WebViewImpl):

  • src/WebViewImpl.h:

(WebKit):

LayoutTests:

Reviewed by Dimitri Glazkov.

  • fast/dom/shadow/elements-in-frameless-document-expected.txt: Added.
  • fast/dom/shadow/elements-in-frameless-document.html: Added.
Location:
trunk
Files:
4 added
32 edited
1 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r120167 r120168  
     12012-06-13  Hajime Morrita  <morrita@chromium.org>
     2
     3        REGRESSION(r118098): <content> element does not render distributed children when cloned from another document
     4        https://bugs.webkit.org/show_bug.cgi?id=88148
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        * fast/dom/shadow/elements-in-frameless-document-expected.txt: Added.
     9        * fast/dom/shadow/elements-in-frameless-document.html: Added.
     10
    1112012-06-12  Ryosuke Niwa  <rniwa@webkit.org>
    212
  • trunk/Source/WebCore/CMakeLists.txt

    r120057 r120168  
    460460
    461461    bindings/generic/ActiveDOMCallback.cpp
    462     bindings/generic/ContextEnabledFeatures.cpp
    463462    bindings/generic/RuntimeEnabledFeatures.cpp
    464463
     
    560559    dom/ContainerNodeAlgorithms.cpp
    561560    dom/ContextDestructionObserver.cpp
     561    dom/ContextFeatures.cpp
    562562    dom/CustomEvent.cpp
    563563    dom/DatasetDOMStringMap.cpp
  • trunk/Source/WebCore/ChangeLog

    r120165 r120168  
     12012-06-13  MORITA Hajime  <morrita@google.com>
     2
     3        REGRESSION(r118098): <content> element does not render distributed children when cloned from another document
     4        https://bugs.webkit.org/show_bug.cgi?id=88148
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        The shadow DOM availability was decided through FrameLoaderClient.
     9        But there are documents which don't have any associated frames, in
     10        which any shadow DOM related elements cannot be constructed.  That
     11        resulsted the regression.
     12
     13        This change introduces a Page-based client called
     14        ContextFeaturesClient which takes the role from FrameLoaderClient
     15        to decide the feature availability, and ContextFeatures which is a
     16        proxy of ContextFeaturesClient.  ContextEnabledFeatures is is
     17        replaced with ContextFeatures.
     18
     19        Each ContextFeatures object is owned by a Page, and is attached to
     20        each Document in the page even if the page itself has no referenct
     21        to Frames or Pages. With ContextFeatures, each Document can decide
     22        the feature availability even if it cannot reach Page or Frame.
     23
     24        On RefCountedSupplement: Document instance can live longer than a
     25        Page where it is shwon. This means that ContextFeatures instance
     26        needs to survive after owner Page destruction because it's
     27        referenced from possibly surviving Documents. RefCountedSupplement
     28        is introduced to cover this scenario: It allows supplement classes
     29        to live after Page's destruction.
     30
     31        RefCountedSupplement::hostDestroyed() is notified when the hosting
     32        page is gone. ContextFeatures clears its reference to the client
     33        using this notification.
     34
     35        Test: fast/dom/shadow/elements-in-frameless-document.html
     36
     37        * CMakeLists.txt:
     38        * GNUmakefile.list.am:
     39        * Target.pri:
     40        * WebCore.gypi:
     41        * WebCore.vcproj/WebCore.vcproj:
     42        * WebCore.xcodeproj/project.pbxproj:
     43        * bindings/scripts/CodeGeneratorV8.pm:
     44        (GenerateImplementation):
     45        * css/StyleResolver.cpp:
     46        (WebCore::StyleResolver::determineScope):
     47        * dom/ContextFeatures.cpp: Added.
     48        (WebCore):
     49        (WebCore::ContextFeaturesClient::empty):
     50        (WebCore::ContextFeatures::supplementName):
     51        (WebCore::ContextFeatures::defaultSwitch):
     52        (WebCore::ContextFeatures::shadowDOMEnabled):
     53        (WebCore::ContextFeatures::styleScopedEnabled):
     54        (WebCore::ContextFeatures::pagePopupEnabled):
     55        (WebCore::provideContextFeaturesTo):
     56        (WebCore::provideContextFeaturesToDocumentFrom):
     57        * dom/ContextFeatures.h: Added.
     58        (WebCore):
     59        (ContextFeatures):
     60        (WebCore::ContextFeatures::ContextFeatures):
     61        (WebCore::ContextFeatures::hostDestroyed):
     62        (ContextFeaturesClient):
     63        (WebCore::ContextFeaturesClient::~ContextFeaturesClient):
     64        (WebCore::ContextFeaturesClient::isEnabled):
     65        (WebCore::ContextFeatures::create):
     66        (WebCore::ContextFeatures::isEnabled):
     67        * dom/DOMAllInOne.cpp:
     68        * dom/DOMImplementation.cpp:
     69        (WebCore::DOMImplementation::createDocument):
     70        (WebCore::DOMImplementation::createHTMLDocument):
     71        * dom/Document.h:
     72        (WebCore::Document::contextFeatures):
     73        * dom/Document.cpp:
     74        (WebCore::Document::Document):
     75        (WebCore::Document::setContextFeatures):
     76        * dom/Position.cpp:
     77        (WebCore::Position::Position):
     78        (WebCore::Position::findParent):
     79        * dom/TreeScope.cpp:
     80        (WebCore::TreeScope::getSelection):
     81        * dom/make_names.pl:
     82        (printConstructorInterior):
     83        (printFactoryCppFile):
     84        (printWrapperFunctions):
     85        (printWrapperFactoryCppFile):
     86        * editing/markup.cpp:
     87        (WebCore::createFragmentFromMarkupWithContext):
     88        * html/HTMLStyleElement.cpp:
     89        (WebCore::HTMLStyleElement::registerWithScopingNode):
     90        (WebCore::HTMLStyleElement::unregisterWithScopingNode):
     91        * html/shadow/HTMLContentElement.cpp:
     92        (WebCore::contentTagName):
     93        * inspector/DOMPatchSupport.cpp:
     94        (WebCore::DOMPatchSupport::patchDocument):
     95        * loader/FrameLoaderClient.h:
     96        * platform/RefCountedSupplement.h: Copied from Source/WebCore/platform/Supplementable.h.
     97        (WebCore):
     98        (RefCountedSupplement):
     99        (WebCore::RefCountedSupplement::hostDestroyed):
     100        (Wrapper):
     101        (WebCore::RefCountedSupplement::Wrapper::Wrapper):
     102        (WebCore::RefCountedSupplement::Wrapper::~Wrapper):
     103        (WebCore::RefCountedSupplement::Wrapper::wrapped):
     104        (WebCore::RefCountedSupplement::provideTo):
     105        (WebCore::RefCountedSupplement::from):
     106        * platform/Supplementable.h:
     107        (WebCore::Supplement::isRefCountedWrapper):
     108        * xml/XMLHttpRequest.cpp:
     109        (WebCore::XMLHttpRequest::responseXML):
     110
    11112012-06-11  Kinuko Yasuda  <kinuko@chromium.org>
    2112
  • trunk/Source/WebCore/GNUmakefile.list.am

    r120154 r120168  
    13071307        Source/WebCore/bindings/generic/ActiveDOMCallback.cpp \
    13081308        Source/WebCore/bindings/generic/ActiveDOMCallback.h \
    1309         Source/WebCore/bindings/generic/ContextEnabledFeatures.cpp \
    1310         Source/WebCore/bindings/generic/ContextEnabledFeatures.h \
    13111309        Source/WebCore/bindings/generic/BindingSecurityBase.cpp \
    13121310        Source/WebCore/bindings/generic/BindingSecurityBase.h \
     
    18011799        Source/WebCore/dom/ContextDestructionObserver.cpp \
    18021800        Source/WebCore/dom/ContextDestructionObserver.h \
     1801        Source/WebCore/dom/ContextFeatures.cpp \
     1802        Source/WebCore/dom/ContextFeatures.h \
    18031803        Source/WebCore/dom/CrossThreadTask.h \
    18041804        Source/WebCore/dom/CustomEvent.cpp \
     
    35873587        Source/WebCore/platform/PurgeableBuffer.h \
    35883588        Source/WebCore/platform/PurgePriority.h \
     3589        Source/WebCore/platform/RefCountedSupplement.h \
    35893590        Source/WebCore/platform/ReferrerPolicy.h \
    35903591        Source/WebCore/platform/RunLoop.cpp \
  • trunk/Source/WebCore/Target.pri

    r120154 r120168  
    7373    accessibility/AXObjectCache.cpp \
    7474    bindings/generic/ActiveDOMCallback.cpp \
    75     bindings/generic/ContextEnabledFeatures.cpp \
    7675    bindings/generic/RuntimeEnabledFeatures.cpp
    7776
     
    530529    dom/ContainerNodeAlgorithms.cpp \
    531530    dom/ContextDestructionObserver.cpp \
     531    dom/ContextFeatures.cpp \
    532532    dom/CustomEvent.cpp \
    533533    dom/DecodedDataDocumentParser.cpp \
  • trunk/Source/WebCore/WebCore.gypi

    r120156 r120168  
    310310            'platform/PurgePriority.h',
    311311            'platform/RuntimeApplicationChecks.h',
     312            'platform/RefCountedSupplement.h',
    312313            'platform/SchemeRegistry.h',
    313314            'platform/ScrollTypes.h',
     
    618619            'dom/ContainerNode.h',
    619620            'dom/ContextDestructionObserver.h',
     621            'dom/ContextFeatures.h',
     622            'dom/ContextFeatures.cpp',
    620623            'dom/DOMImplementation.h',
    621624            'dom/DOMTimeStamp.h',
     
    18551858            'bindings/generic/BindingSecurityBase.cpp',
    18561859            'bindings/generic/BindingSecurityBase.h',
    1857             'bindings/generic/ContextEnabledFeatures.cpp',
    1858             'bindings/generic/ContextEnabledFeatures.h',
    18591860            'bindings/generic/GenericBinding.h',
    18601861            'bindings/generic/RuntimeEnabledFeatures.cpp',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r120154 r120168  
    6321963219                                </File>
    6322063220                                <File
    63221                                         RelativePath="..\bindings\generic\ContextEnabledFeatures.cpp"
    63222                                         >
    63223                                 </File>
    63224                                 <File
    63225                                         RelativePath="..\bindings\generic\ContextEnabledFeatures.h"
    63226                                         >
    63227                                 </File>
    63228                                 <File
    6322963221                                        RelativePath="..\bindings\generic\GenericBinding.h"
    6323063222                                        >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r120154 r120168  
    37543754                A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */; };
    37553755                A723F77B1484CA4C008C6DBE /* PlatformExportMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = A723F77A1484CA4C008C6DBE /* PlatformExportMacros.h */; settings = {ATTRIBUTES = (Private, ); }; };
     3756                A72EA3BB1585CF55004FAA26 /* RefCountedSupplement.h in Headers */ = {isa = PBXBuildFile; fileRef = A72EA3BA1585CF55004FAA26 /* RefCountedSupplement.h */; settings = {ATTRIBUTES = (Private, ); }; };
    37563757                A73F95FE12C97BFE0031AAF9 /* RoundedRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */; };
    37573758                A73F95FF12C97BFE0031AAF9 /* RoundedRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A73F95FD12C97BFE0031AAF9 /* RoundedRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
    37583759                A740B5A514C935AB00A77FA4 /* JSInternalSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B4EA7914C9348400C8F5BF /* JSInternalSettings.h */; };
    37593760                A740B5A714C935AF00A77FA4 /* JSInternalSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B4EA7814C9348400C8F5BF /* JSInternalSettings.cpp */; };
    3760                 A747A07F156B286900243EED /* ContextEnabledFeatures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A747A07D156B286900243EED /* ContextEnabledFeatures.cpp */; };
    3761                 A747A080156B286900243EED /* ContextEnabledFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = A747A07E156B286900243EED /* ContextEnabledFeatures.h */; };
    37623761                A74BB76B13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h in Headers */ = {isa = PBXBuildFile; fileRef = A74BB76A13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h */; settings = {ATTRIBUTES = (Private, ); }; };
    37633762                A75E497610752ACB00C9B896 /* SerializedScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A75E497410752ACB00C9B896 /* SerializedScriptValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    38113810                A7D20F63107F406900A80392 /* JSWebGLActiveInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D20F61107F406900A80392 /* JSWebGLActiveInfo.h */; };
    38123811                A7D20F6D107F438B00A80392 /* WebGLActiveInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D20F6B107F438B00A80392 /* WebGLActiveInfo.h */; };
     3812                A7D3CA10157DF8E900860A97 /* ContextFeatures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D3CA0E157DF8E900860A97 /* ContextFeatures.cpp */; };
     3813                A7D3CA11157DF8E900860A97 /* ContextFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D3CA0F157DF8E900860A97 /* ContextFeatures.h */; };
    38133814                A7D6B3490F61104500B79FD1 /* WorkerScriptLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D6B3470F61104500B79FD1 /* WorkerScriptLoader.h */; };
    38143815                A7D6B34A0F61104500B79FD1 /* WorkerScriptLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D6B3480F61104500B79FD1 /* WorkerScriptLoader.cpp */; };
     
    1085610857                A71A70C911AFB02000989D6D /* HTMLMeterElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMeterElement.idl; sourceTree = "<group>"; };
    1085710858                A723F77A1484CA4C008C6DBE /* PlatformExportMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformExportMacros.h; sourceTree = "<group>"; };
     10859                A72EA3BA1585CF55004FAA26 /* RefCountedSupplement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCountedSupplement.h; sourceTree = "<group>"; };
    1085810860                A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RoundedRect.cpp; sourceTree = "<group>"; };
    1085910861                A73F95FD12C97BFE0031AAF9 /* RoundedRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoundedRect.h; sourceTree = "<group>"; };
    10860                 A747A07D156B286900243EED /* ContextEnabledFeatures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ContextEnabledFeatures.cpp; path = generic/ContextEnabledFeatures.cpp; sourceTree = "<group>"; };
    10861                 A747A07E156B286900243EED /* ContextEnabledFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ContextEnabledFeatures.h; path = generic/ContextEnabledFeatures.h; sourceTree = "<group>"; };
    1086210862                A74BB76A13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionCodePlaceholder.h; sourceTree = "<group>"; };
    1086310863                A75E497410752ACB00C9B896 /* SerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedScriptValue.h; sourceTree = "<group>"; };
     
    1091710917                A7D20F61107F406900A80392 /* JSWebGLActiveInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLActiveInfo.h; sourceTree = "<group>"; };
    1091810918                A7D20F6B107F438B00A80392 /* WebGLActiveInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLActiveInfo.h; path = canvas/WebGLActiveInfo.h; sourceTree = "<group>"; };
     10919                A7D3CA0E157DF8E900860A97 /* ContextFeatures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContextFeatures.cpp; sourceTree = "<group>"; };
     10920                A7D3CA0F157DF8E900860A97 /* ContextFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextFeatures.h; sourceTree = "<group>"; };
    1091910921                A7D6B3470F61104500B79FD1 /* WorkerScriptLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WorkerScriptLoader.h; path = workers/WorkerScriptLoader.h; sourceTree = "<group>"; };
    1092010922                A7D6B3480F61104500B79FD1 /* WorkerScriptLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WorkerScriptLoader.cpp; path = workers/WorkerScriptLoader.cpp; sourceTree = "<group>"; };
     
    1976819770                                A622A8F6122C44A600A785B3 /* BindingSecurityBase.cpp */,
    1976919771                                A622A8F7122C44A600A785B3 /* BindingSecurityBase.h */,
    19770                                 A747A07D156B286900243EED /* ContextEnabledFeatures.cpp */,
    19771                                 A747A07E156B286900243EED /* ContextEnabledFeatures.h */,
    1977219772                                A622A8F9122C44A600A785B3 /* GenericBinding.h */,
    1977319773                        );
     
    2048620486                                E4D687780ED7AE4F006EA978 /* PurgeableBuffer.h */,
    2048720487                                7E33CD00127F340D00BE8F17 /* PurgePriority.h */,
     20488                                A72EA3BA1585CF55004FAA26 /* RefCountedSupplement.h */,
    2048820489                                9831AE49154225A200FE2644 /* ReferrerPolicy.h */,
    2048920490                                BC0B358514C4F9830055E22A /* RunLoop.cpp */,
     
    2120821209                                97627B8B14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp */,
    2120921210                                97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */,
     21211                                A7D3CA0E157DF8E900860A97 /* ContextFeatures.cpp */,
     21212                                A7D3CA0F157DF8E900860A97 /* ContextFeatures.h */,
    2121021213                                2E3FAA0811A36BF100576624 /* CrossThreadTask.h */,
    2121121214                                62CD32561157E57C0063B0A7 /* CustomEvent.cpp */,
     
    2206122064                                370D6EDB138454550044103E /* ContentTypeParser.h in Headers */,
    2206222065                                97627B8E14FB3CEE002CDCA1 /* ContextDestructionObserver.h in Headers */,
    22063                                 A747A080156B286900243EED /* ContextEnabledFeatures.h in Headers */,
     22066                                A7D3CA11157DF8E900860A97 /* ContextFeatures.h in Headers */,
    2206422067                                93B6A0E60B0BCA5C00F5027A /* ContextMenu.h in Headers */,
    2206522068                                065AD4F50B0C2EDA005A2B1D /* ContextMenuClient.h in Headers */,
     
    2417124174                                FD31603E12B0267600C1A359 /* RealtimeAnalyserNode.h in Headers */,
    2417224175                                BC4368E80C226E32005EFB5F /* Rect.h in Headers */,
     24176                                A72EA3BB1585CF55004FAA26 /* RefCountedSupplement.h in Headers */,
    2417324177                                9831AE4A154225C900FE2644 /* ReferrerPolicy.h in Headers */,
    2417424178                                BCAB418213E356E800D8AAF3 /* Region.h in Headers */,
     
    2558425588                                370D6EDA138454550044103E /* ContentTypeParser.cpp in Sources */,
    2558525589                                97627B8D14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp in Sources */,
    25586                                 A747A07F156B286900243EED /* ContextEnabledFeatures.cpp in Sources */,
     25590                                A7D3CA10157DF8E900860A97 /* ContextFeatures.cpp in Sources */,
    2558725591                                065AD4F60B0C2EDA005A2B1D /* ContextMenuController.cpp in Sources */,
    2558825592                                06027CB30B1CC03D00884B2D /* ContextMenuItemMac.mm in Sources */,
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r120057 r120168  
    24182418
    24192419    AddToImplIncludes("RuntimeEnabledFeatures.h");
    2420     AddToImplIncludes("ContextEnabledFeatures.h");
     2420    AddToImplIncludes("ContextFeatures.h");
    24212421    AddToImplIncludes("V8Proxy.h");
    24222422    AddToImplIncludes("V8Binding.h");
     
    28672867            my $conditionalString = $codeGenerator->GenerateConditionalString($runtimeAttr->signature);
    28682868            push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
    2869             push(@implContent, "    if (ContextEnabledFeatures::${enableFunction}(impl)) {\n");
     2869            push(@implContent, "    if (ContextFeatures::${enableFunction}(impl->document())) {\n");
    28702870            push(@implContent, "        static const BatchedAttribute attrData =\\\n");
    28712871            GenerateSingleBatchedAttribute($interfaceName, $runtimeAttr, ";", "    ");
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r120154 r120168  
    5656#include "CalculationValue.h"
    5757#include "ContentData.h"
    58 #include "ContextEnabledFeatures.h"
     58#include "ContextFeatures.h"
    5959#include "Counter.h"
    6060#include "CounterContent.h"
     
    496496    ASSERT(sheet);
    497497
    498     if (!ContextEnabledFeatures::styleScopedEnabled(document()))
     498    if (!ContextFeatures::styleScopedEnabled(document()))
    499499        return 0;
    500500
  • trunk/Source/WebCore/dom/DOMAllInOne.cpp

    r120057 r120168  
    4545#include "ContainerNodeAlgorithms.cpp"
    4646#include "ContextDestructionObserver.cpp"
     47#include "ContextFeatures.cpp"
    4748#include "CustomEvent.cpp"
    4849#include "DOMCoreException.cpp"
  • trunk/Source/WebCore/dom/DOMImplementation.cpp

    r120057 r120168  
    2828#include "ContentType.h"
    2929#include "CSSStyleSheet.h"
     30#include "ContextFeatures.h"
    3031#include "DocumentType.h"
    3132#include "Element.h"
     
    296297
    297298    doc->setSecurityOrigin(m_document->securityOrigin());
     299    doc->setContextFeatures(m_document->contextFeatures());
    298300
    299301    RefPtr<Node> documentElement;
     
    373375    d->setTitle(title);
    374376    d->setSecurityOrigin(m_document->securityOrigin());
     377    d->setContextFeatures(m_document->contextFeatures());
    375378    return d.release();
    376379}
  • trunk/Source/WebCore/dom/Document.cpp

    r120093 r120168  
    4545#include "Console.h"
    4646#include "ContentSecurityPolicy.h"
     47#include "ContextFeatures.h"
    4748#include "CookieJar.h"
    4849#include "DOMImplementation.h"
     
    429430    , TreeScope(this)
    430431    , m_guardRefCount(0)
     432    , m_contextFeatures(ContextFeatures::defaultSwitch())
    431433    , m_compatibilityMode(NoQuirksMode)
    432434    , m_compatibilityModeLocked(false)
     
    507509
    508510    m_frame = frame;
     511    if (m_frame)
     512        provideContextFeaturesToDocumentFrom(this, m_frame->page());
    509513
    510514    // We depend on the url getting immediately set in subframes, but we
     
    667671        m_titleElement = 0;
    668672        m_documentElement = 0;
     673        m_contextFeatures = ContextFeatures::defaultSwitch();
    669674#if ENABLE(FULLSCREEN_API)
    670675        m_fullScreenElement = 0;
     
    59835988}
    59845989
     5990void Document::setContextFeatures(PassRefPtr<ContextFeatures> features)
     5991{
     5992    m_contextFeatures = features;
     5993}
     5994
    59855995#if ENABLE(UNDO_MANAGER)
    59865996PassRefPtr<UndoManager> Document::undoManager()
  • trunk/Source/WebCore/dom/Document.h

    r120093 r120168  
    6868class CharacterData;
    6969class Comment;
     70class ContextFeatures;
    7071class DOMImplementation;
    7172class DOMSelection;
     
    11241125    void adjustFloatRectForScrollAndAbsoluteZoomAndFrameScale(FloatRect&, RenderObject*);
    11251126
     1127    void setContextFeatures(PassRefPtr<ContextFeatures>);
     1128    ContextFeatures* contextFeatures() { return m_contextFeatures.get(); }
     1129
    11261130protected:
    11271131    Document(Frame*, const KURL&, bool isXHTML, bool isHTML);
     
    12181222    OwnPtr<CachedResourceLoader> m_cachedResourceLoader;
    12191223    RefPtr<DocumentParser> m_parser;
     1224    RefPtr<ContextFeatures> m_contextFeatures;
     1225
    12201226    bool m_wellFormed;
    12211227
  • trunk/Source/WebCore/dom/Position.cpp

    r120057 r120168  
    2828
    2929#include "CSSComputedStyleDeclaration.h"
    30 #include "ContextEnabledFeatures.h"
     30#include "ContextFeatures.h"
    3131#include "HTMLNames.h"
    3232#include "InlineTextBox.h"
     
    8383{
    8484#if ENABLE(SHADOW_DOM)
    85     ASSERT((m_anchorNode && ContextEnabledFeatures::shadowDOMEnabled(m_anchorNode->document()->domWindow()))
     85    ASSERT((m_anchorNode && ContextFeatures::shadowDOMEnabled(m_anchorNode->document()))
    8686           || !m_anchorNode || !m_anchorNode->isShadowRoot());
    8787#else
     
    9797{
    9898#if ENABLE(SHADOW_DOM)
    99     ASSERT((m_anchorNode && ContextEnabledFeatures::shadowDOMEnabled(m_anchorNode->document()->domWindow()))
     99    ASSERT((m_anchorNode && ContextFeatures::shadowDOMEnabled(m_anchorNode->document()))
    100100           || !m_anchorNode || !m_anchorNode->isShadowRoot());
    101101#else
     
    115115{
    116116#if ENABLE(SHADOW_DOM)
    117     ASSERT((m_anchorNode && ContextEnabledFeatures::shadowDOMEnabled(m_anchorNode->document()->domWindow()))
     117    ASSERT((m_anchorNode && ContextFeatures::shadowDOMEnabled(m_anchorNode->document()))
    118118           || !m_anchorNode || !editingIgnoresContent(m_anchorNode.get()) || !m_anchorNode->isShadowRoot());
    119119#else
     
    858858
    859859#if ENABLE(SHADOW_DOM)
    860     if (ContextEnabledFeatures::shadowDOMEnabled(node->document()->domWindow()))
     860    if (ContextFeatures::shadowDOMEnabled(node->document()))
    861861        return node->parentNode();
    862862#endif
  • trunk/Source/WebCore/dom/TreeScope.cpp

    r120057 r120168  
    2828
    2929#include "ContainerNode.h"
    30 #include "ContextEnabledFeatures.h"
     30#include "ContextFeatures.h"
    3131#include "DOMSelection.h"
    3232#include "DOMWindow.h"
     
    151151    // See https://bugs.webkit.org/show_bug.cgi?id=82697
    152152#if ENABLE(SHADOW_DOM)
    153     if (ContextEnabledFeatures::shadowDOMEnabled(rootNode()->document()->domWindow())) {
     153    if (ContextFeatures::shadowDOMEnabled(rootNode()->document())) {
    154154        m_selection = DOMSelection::create(this);
    155155        return m_selection.get();
  • trunk/Source/WebCore/dom/make_names.pl

    r120057 r120168  
    379379    if ($contextConditional) {
    380380        print F <<END
    381     if (!ContextEnabledFeatures::${contextConditional}Enabled(document->domWindow()))
     381    if (!ContextFeatures::${contextConditional}Enabled(document))
    382382        return 0;
    383383END
     
    805805print F <<END
    806806
    807 #include "ContextEnabledFeatures.h"
     807#include "ContextFeatures.h"
    808808
    809809#if ENABLE(DASHBOARD_SUPPORT) || ENABLE(VIDEO)
     
    10141014static JSDOMWrapper* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{namespace}Element> element)
    10151015{
    1016     if (!ContextEnabledFeatures::${contextConditional}Enabled(element->document()->domWindow())) {
     1016    if (!ContextFeatures::${contextConditional}Enabled(element->document())) {
    10171017        ASSERT(!element || element->is$parameters{fallbackInterfaceName}());
    10181018        return CREATE_DOM_WRAPPER(exec, globalObject, $parameters{fallbackInterfaceName}, element.get());
     
    10511051static v8::Handle<v8::Value> create${JSInterfaceName}Wrapper($parameters{namespace}Element* element, v8::Isolate* isolate)
    10521052{
    1053     if (!ContextEnabledFeatures::${contextConditional}Enabled(element->document()->domWindow()))
     1053    if (!ContextFeatures::${contextConditional}Enabled(element->document()))
    10541054        return V8$parameters{fallbackInterfaceName}::wrap(to$parameters{fallbackInterfaceName}(element), isolate);
    10551055    return toV8(static_cast<${JSInterfaceName}*>(element), isolate);
     
    11121112    print F <<END
    11131113
    1114 #include "ContextEnabledFeatures.h"
     1114#include "ContextFeatures.h"
    11151115
    11161116#if ENABLE(VIDEO)
  • trunk/Source/WebCore/editing/markup.cpp

    r120057 r120168  
    4040#include "CSSValueKeywords.h"
    4141#include "ChildListMutationScope.h"
     42#include "ContextFeatures.h"
    4243#include "DeleteButtonController.h"
    4344#include "DocumentFragment.h"
     
    731732    RefPtr<DocumentFragment> taggedFragment = createFragmentFromMarkup(document, taggedMarkup.toString(), baseURL, scriptingPermission);
    732733    RefPtr<Document> taggedDocument = Document::create(0, KURL());
     734    taggedDocument->setContextFeatures(document->contextFeatures());
    733735    taggedDocument->takeAllChildrenFrom(taggedFragment.get());
    734736
  • trunk/Source/WebCore/html/HTMLStyleElement.cpp

    r120062 r120168  
    2626
    2727#include "Attribute.h"
    28 #include "ContextEnabledFeatures.h"
     28#include "ContextFeatures.h"
    2929#include "Document.h"
    3030#include "Event.h"
     
    132132    if (m_scopedStyleRegistrationState != NotRegistered)
    133133        return;
    134     if (!ContextEnabledFeatures::styleScopedEnabled(document()))
     134    if (!ContextFeatures::styleScopedEnabled(document()))
    135135        return;
    136136
     
    157157    // Note: We cannot rely on the 'scoped' element still being present when this method is invoked.
    158158    // Therefore we cannot rely on scoped()!
    159     ASSERT(m_scopedStyleRegistrationState != NotRegistered || !ContextEnabledFeatures::styleScopedEnabled(document()));
     159    ASSERT(m_scopedStyleRegistrationState != NotRegistered || !ContextFeatures::styleScopedEnabled(document()));
    160160    if (m_scopedStyleRegistrationState == NotRegistered)
    161161        return;
    162     if (!ContextEnabledFeatures::styleScopedEnabled(document()))
     162    if (!ContextFeatures::styleScopedEnabled(document()))
    163163        return;
    164164
  • trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp

    r120057 r120168  
    3030#include "ContentDistributor.h"
    3131#include "ContentSelectorQuery.h"
    32 #include "ContextEnabledFeatures.h"
     32#include "ContextFeatures.h"
    3333#include "ElementShadow.h"
    3434#include "HTMLNames.h"
     
    4444{
    4545#if ENABLE(SHADOW_DOM)
    46     if (!ContextEnabledFeatures::shadowDOMEnabled(document->domWindow()))
     46    if (!ContextFeatures::shadowDOMEnabled(document))
    4747        return HTMLNames::webkitShadowContentTag;
    4848    return HTMLNames::contentTag;
  • trunk/Source/WebCore/inspector/DOMPatchSupport.cpp

    r120057 r120168  
    3737#include "Attribute.h"
    3838#include "Base64.h"
     39#include "ContextFeatures.h"
    3940#include "DOMEditor.h"
    4041#include "Document.h"
     
    9091{
    9192    RefPtr<HTMLDocument> newDocument = HTMLDocument::create(0, KURL());
     93    newDocument->setContextFeatures(m_document->contextFeatures());
    9294    RefPtr<DocumentParser> parser = HTMLDocumentParser::create(newDocument.get(), false);
    9395    parser->insert(markup); // Use insert() so that the parser will not yield.
  • trunk/Source/WebCore/loader/FrameLoaderClient.h

    r120057 r120168  
    312312        virtual bool allowRunningInsecureContent(bool enabledPerSettings, SecurityOrigin*, const KURL&) { return enabledPerSettings; }
    313313
    314         virtual bool allowShadowDOM(bool enabledAsRuntimeFeatures) { return enabledAsRuntimeFeatures; }
    315         virtual bool allowStyleScoped(bool enabledAsRuntimeFeatures) { return enabledAsRuntimeFeatures; }
    316 #if ENABLE(PAGE_POPUP)
    317         virtual bool allowPagePopup() { return false; }
    318 #endif
    319 
    320314        // This callback notifies the client that the frame was about to run
    321315        // JavaScript but did not because allowScript returned false. We
  • trunk/Source/WebCore/platform/RefCountedSupplement.h

    r120167 r120168  
    2424 */
    2525
    26 #ifndef Supplementable_h
    27 #define Supplementable_h
     26#ifndef RefCountedSupplement_h
     27#define RefCountedSupplement_H
    2828
    29 #include <wtf/HashMap.h>
    30 #include <wtf/PassOwnPtr.h>
    31 #include <wtf/text/AtomicString.h>
    32 #include <wtf/text/AtomicStringHash.h>
     29#include "Supplementable.h"
     30#include <wtf/RefCounted.h>
     31#include <wtf/RefPtr.h>
    3332
    3433namespace WebCore {
    3534
    36 template<typename T>
    37 class Supplementable;
     35template<class T, class S>
     36class RefCountedSupplement : public RefCounted<S> {
     37public:
     38    typedef RefCountedSupplement<T, S> ThisType;
    3839
    39 template<typename T>
    40 class Supplement {
    41 public:
    42     virtual ~Supplement() { }
     40    virtual ~RefCountedSupplement() { }
     41    virtual void hostDestroyed() { }
    4342
    44     static void provideTo(Supplementable<T>* host, const AtomicString& key, PassOwnPtr<Supplement<T> > supplement)
     43    class Wrapper : public Supplement<T> {
     44    public:
     45        explicit Wrapper(PassRefPtr<ThisType> wrapped) : m_wrapped(wrapped) { }
     46        virtual ~Wrapper() { m_wrapped->hostDestroyed();  }
     47#if !ASSERT_DISABLED
     48        virtual bool isRefCountedWrapper() const OVERRIDE { return true; }
     49#endif
     50        ThisType* wrapped() const { return m_wrapped.get(); }
     51    private:
     52
     53        RefPtr<ThisType> m_wrapped;
     54    };
     55
     56    static void provideTo(Supplementable<T>* host, const AtomicString& key, PassRefPtr<ThisType> supplement)
    4557    {
    46         host->provideSupplement(key, supplement);
     58        host->provideSupplement(key, adoptPtr(new Wrapper(supplement)));
    4759    }
    4860
    49     static Supplement<T>* from(Supplementable<T>* host, const AtomicString& key)
     61    static ThisType* from(Supplementable<T>* host, const AtomicString& key)
    5062    {
    51         return host ? host->requireSupplement(key) : 0;
     63        Supplement<T>* found = host->requireSupplement(key);
     64        if (!found)
     65            return 0;
     66        ASSERT(found->isRefCountedWrapper());
     67        return static_cast<Wrapper*>(found)->wrapped();
    5268    }
    53 };
    54 
    55 template<typename T>
    56 class Supplementable {
    57 public:
    58     void provideSupplement(const AtomicString& key, PassOwnPtr<Supplement<T> > supplement)
    59     {
    60         ASSERT(!m_supplements.get(key.impl()));
    61         m_supplements.set(key, supplement);
    62     }
    63 
    64     Supplement<T>* requireSupplement(const AtomicString& key)
    65     {
    66         return m_supplements.get(key);
    67     }
    68 
    69 private:
    70     typedef HashMap<AtomicString, OwnPtr<Supplement<T> > > SupplementMap;
    71     SupplementMap m_supplements;
    7269};
    7370
    7471} // namespace WebCore
    7572
    76 #endif // Supplementable_h
     73#endif // RefCountedSupplement_h
  • trunk/Source/WebCore/platform/Supplementable.h

    r120057 r120168  
    4141public:
    4242    virtual ~Supplement() { }
     43#if !ASSERT_DISABLED
     44    virtual bool isRefCountedWrapper() const { return false; }
     45#endif
    4346
    4447    static void provideTo(Supplementable<T>* host, const AtomicString& key, PassOwnPtr<Supplement<T> > supplement)
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r120057 r120168  
    2626#include "BlobData.h"
    2727#include "ContentSecurityPolicy.h"
     28#include "ContextFeatures.h"
    2829#include "CrossOriginAccessControl.h"
    2930#include "DOMFormData.h"
     
    254255            m_responseDocument->setContent(m_responseBuilder.toStringPreserveCapacity());
    255256            m_responseDocument->setSecurityOrigin(securityOrigin());
     257            m_responseDocument->setContextFeatures(document()->contextFeatures());
    256258            if (!m_responseDocument->wellFormed())
    257259                m_responseDocument = 0;
  • trunk/Source/WebKit/chromium/ChangeLog

    r120161 r120168  
     12012-06-13  MORITA Hajime  <morrita@google.com>
     2
     3        REGRESSION(r118098): <content> element does not render distributed children when cloned from another document
     4        https://bugs.webkit.org/show_bug.cgi?id=88148
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        - Added ContextFeaturesClientImpl which implements WebCore::ContextFeaturesClient.
     9        - Replaced PagePopupFrameLoaderClient with PagePopupFeaturesClient.
     10
     11        * WebKit.gyp:
     12        * public/WebPermissionClient.h:
     13        (WebKit):
     14        (WebKit::WebPermissionClient::allowWebComponents):
     15        * src/ContextFeaturesClientImpl.cpp: Renamed from Source/WebCore/bindings/generic/ContextEnabledFeatures.cpp.
     16        (WebKit):
     17        (WebKit::ContextFeaturesClientImpl::isEnabled):
     18        * src/ContextFeaturesClientImpl.h: Renamed from Source/WebCore/bindings/generic/ContextEnabledFeatures.h.
     19        (WebKit):
     20        (ContextFeaturesClientImpl):
     21        (WebKit::ContextFeaturesClientImpl::ContextFeaturesClientImpl):
     22        (WebKit::ContextFeaturesClientImpl::setPermissionClient):
     23        * src/FrameLoaderClientImpl.cpp:
     24        * src/FrameLoaderClientImpl.h:
     25        (FrameLoaderClientImpl):
     26        * src/WebPagePopupImpl.cpp:
     27        (PagePopupFeaturesClient):
     28        (WebKit::PagePopupFeaturesClient::isEnabled):
     29        (WebKit):
     30        (WebKit::WebPagePopupImpl::initPage):
     31        * src/WebViewImpl.cpp:
     32        (WebKit::WebViewImpl::setPermissionClient):
     33        (WebKit::WebViewImpl::WebViewImpl):
     34        * src/WebViewImpl.h:
     35        (WebKit):
     36
    1372012-06-12  Ian Vollick  <vollick@chromium.org>
    238
  • trunk/Source/WebKit/chromium/WebKit.gyp

    r120057 r120168  
    372372                'src/CompositionUnderlineVectorBuilder.cpp',
    373373                'src/CompositionUnderlineVectorBuilder.h',
     374                'src/ContextFeaturesClientImpl.cpp',
     375                'src/ContextFeaturesClientImpl.h',
    374376                'src/ContextMenuClientImpl.cpp',
    375377                'src/ContextMenuClientImpl.h',
  • trunk/Source/WebKit/chromium/public/WebPermissionClient.h

    r120057 r120168  
    3434namespace WebKit {
    3535
     36class WebDocument;
    3637class WebFrame;
    3738class WebSecurityOrigin;
     
    9192
    9293    // Controls whether enabling Web Components API for this frame.
    93     virtual bool allowWebComponents(WebFrame*, bool defaultValue) { return defaultValue; }
     94    virtual bool allowWebComponents(const WebDocument&, bool defaultValue) { return defaultValue; }
    9495
    9596    // Notifies the client that the frame would have instantiated a plug-in if plug-ins were enabled.
  • trunk/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp

    r120167 r120168  
    3030
    3131#include "config.h"
    32 #include "ContextEnabledFeatures.h"
     32#include "ContextFeaturesClientImpl.h"
    3333
    34 #include "DOMWindow.h"
    3534#include "Document.h"
    36 #include "Frame.h"
    37 #include "FrameLoader.h"
    38 #include "FrameLoaderClient.h"
    39 #include "RuntimeEnabledFeatures.h"
     35#include "WebDocument.h"
     36#include "WebPermissionClient.h"
    4037
    41 namespace WebCore {
     38namespace WebKit {
    4239
    43 #if ENABLE(SHADOW_DOM)
    44 bool ContextEnabledFeatures::shadowDOMEnabled(DOMWindow* window)
     40bool ContextFeaturesClientImpl::isEnabled(WebCore::Document* document, WebCore::ContextFeatures::FeatureType type, bool defaultValue)
    4541{
    46     if (!window)
    47         return false;
    48     if (Frame* frame = window->frame())
    49         return frame->loader()->client()->allowShadowDOM(RuntimeEnabledFeatures::shadowDOMEnabled());
    50     return false;
     42    if (!m_client)
     43        return defaultValue;
     44
     45    switch (type) {
     46    case WebCore::ContextFeatures::ShadowDOM:
     47    case WebCore::ContextFeatures::StyleScoped:
     48        return m_client->allowWebComponents(WebDocument(document), defaultValue);
     49    default:
     50        return defaultValue;
     51    }
    5152}
    52 #endif
    5353
    54 #if ENABLE(STYLE_SCOPED)
    55 bool ContextEnabledFeatures::styleScopedEnabled(Document* document)
    56 {
    57     if (!document)
    58         return false;
    59     if (Frame* frame = document->frame())
    60         return frame->loader()->client()->allowStyleScoped(RuntimeEnabledFeatures::styleScopedEnabled());
    61     return false;
    62 }
    63 #endif   
    64 
    65 #if ENABLE(PAGE_POPUP)
    66 bool ContextEnabledFeatures::pagePopupEnabled(DOMWindow* window)
    67 {
    68     if (!window)
    69         return false;
    70     if (Frame* frame = window->frame())
    71         return frame->loader()->client()->allowPagePopup();
    72     return false;
    73 }
    74 #endif
    75 
    76 } // namespace WebCore
     54} // namespace WebKit
  • trunk/Source/WebKit/chromium/src/ContextFeaturesClientImpl.h

    r120167 r120168  
    2929 */
    3030
    31 #ifndef ContextEnabledFeatures_h
    32 #define ContextEnabledFeatures_h
     31#ifndef ContextFeaturesClientImpl_h
     32#define ContextFeaturesClientImpl_h
    3333
    34 namespace WebCore {
     34#include "ContextFeatures.h"
    3535
    36 class DOMWindow;
    37 class Document;
     36namespace WebKit {
    3837
    39 // A class that stores static enablers for all experimental features. Note that
    40 // the method names must line up with the JavaScript method they enable for code
    41 // generation to work properly.
     38class WebPermissionClient;
    4239
    43 class ContextEnabledFeatures {
     40class ContextFeaturesClientImpl : public WebCore::ContextFeaturesClient {
    4441public:
    45 #if ENABLE(SHADOW_DOM)
    46     static bool shadowDOMEnabled(DOMWindow*);
    47 #endif
    48 #if ENABLE(STYLE_SCOPED)
    49     static bool styleScopedEnabled(Document*);
    50 #endif
    51 #if ENABLE(PAGE_POPUP)
    52     static bool pagePopupEnabled(DOMWindow*);
    53 #endif
     42    ContextFeaturesClientImpl()
     43        : m_client(0)
     44    { }
     45
     46    virtual bool isEnabled(WebCore::Document*, WebCore::ContextFeatures::FeatureType, bool defaultValue) OVERRIDE;
     47    void setPermissionClient(WebPermissionClient* client) { m_client = client; }
     48
     49private:
     50    WebPermissionClient* m_client;
    5451};
    5552
    56 } // namespace WebCore
     53} // namespace WebKit
    5754
    58 #endif // ContextEnabledFeatures_h
     55#endif // ContextFeaturesClientImpl_h
  • trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp

    r120057 r120168  
    240240}
    241241
    242 bool FrameLoaderClientImpl::allowShadowDOM(bool enabledAsRuntimeFeature)
    243 {
    244     WebViewImpl* webview = m_webFrame->viewImpl();
    245     if (webview && webview->permissionClient())
    246         return webview->permissionClient()->allowWebComponents(m_webFrame, enabledAsRuntimeFeature);
    247 
    248     return enabledAsRuntimeFeature;
    249 }
    250 
    251 bool FrameLoaderClientImpl::allowStyleScoped(bool enabledAsRuntimeFeature)
    252 {
    253     WebViewImpl* webview = m_webFrame->viewImpl();
    254     if (webview && webview->permissionClient())
    255         return webview->permissionClient()->allowWebComponents(m_webFrame, enabledAsRuntimeFeature);
    256 
    257     return enabledAsRuntimeFeature;
    258 }
    259 
    260242void FrameLoaderClientImpl::didNotAllowScript()
    261243{
  • trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h

    r120057 r120168  
    200200    virtual bool allowDisplayingInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&);
    201201    virtual bool allowRunningInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&);
    202     virtual bool allowShadowDOM(bool enabledAsRuntimeFeature) OVERRIDE;
    203     virtual bool allowStyleScoped(bool enabledAsRuntimeFeature) OVERRIDE;
    204202    virtual void didNotAllowScript();
    205203    virtual void didNotAllowPlugins();
  • trunk/Source/WebKit/chromium/src/WebPagePopupImpl.cpp

    r120057 r120168  
    3333
    3434#include "Chrome.h"
     35#include "ContextFeatures.h"
    3536#include "DOMWindowPagePopup.h"
    3637#include "DocumentLoader.h"
     
    126127};
    127128
    128 class PagePopupFrameLoaderClient : public EmptyFrameLoaderClient {
    129     virtual bool allowPagePopup() OVERRIDE { return true; }
     129class PagePopupFeaturesClient : public ContextFeaturesClient {
     130    virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool) OVERRIDE;
    130131};
     132
     133bool PagePopupFeaturesClient::isEnabled(Document*, ContextFeatures::FeatureType type, bool defaultValue)
     134{
     135    if (type == ContextFeatures::PagePopup)
     136        return true;
     137    return defaultValue;
     138}
    131139
    132140// WebPagePopupImpl ----------------------------------------------------------------
     
    184192    m_page->settings()->setAllowScriptsToCloseWindows(true);
    185193
    186     static FrameLoaderClient* pagePopupFrameLoaderClient =  new PagePopupFrameLoaderClient;
    187     RefPtr<Frame> frame = Frame::create(m_page.get(), 0, pagePopupFrameLoaderClient);
     194    static ContextFeaturesClient* pagePopupFeaturesClient =  new PagePopupFeaturesClient();
     195    provideContextFeaturesTo(m_page.get(), pagePopupFeaturesClient);
     196    static FrameLoaderClient* emptyFrameLoaderClient =  new EmptyFrameLoaderClient();
     197    RefPtr<Frame> frame = Frame::create(m_page.get(), 0, emptyFrameLoaderClient);
    188198    frame->setView(FrameView::create(frame.get()));
    189199    frame->init();
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r120105 r120168  
    4242#include "ColorSpace.h"
    4343#include "CompositionUnderlineVectorBuilder.h"
     44#include "ContextFeaturesClientImpl.h"
    4445#include "ContextMenu.h"
    4546#include "ContextMenuController.h"
     
    338339{
    339340    m_permissionClient = permissionClient;
     341    m_featureSwitchClient->setPermissionClient(permissionClient);
    340342}
    341343
     
    393395    , m_operationsAllowed(WebDragOperationNone)
    394396    , m_dragOperation(WebDragOperationNone)
     397    , m_featureSwitchClient(adoptPtr(new ContextFeaturesClientImpl()))
    395398    , m_autofillPopupShowing(false)
    396399    , m_autofillPopup(0)
     
    452455#endif
    453456
     457    provideContextFeaturesTo(m_page.get(), m_featureSwitchClient.get());
    454458    provideDeviceOrientationTo(m_page.get(), m_deviceOrientationClientProxy.get());
    455459    provideGeolocationTo(m_page.get(), m_geolocationClientProxy.get());
  • trunk/Source/WebKit/chromium/src/WebViewImpl.h

    r120057 r120168  
    8787class AutofillPopupMenuClient;
    8888class BatteryClientImpl;
     89class ContextFeaturesClientImpl;
    8990class ContextMenuClientImpl;
    9091class DeviceOrientationClientProxy;
     
    734735    WebDragOperation m_dragOperation;
    735736
     737    // Context-based feature switches.
     738    OwnPtr<ContextFeaturesClientImpl> m_featureSwitchClient;
     739
    736740    // Whether an Autofill popup is currently showing.
    737741    bool m_autofillPopupShowing;
Note: See TracChangeset for help on using the changeset viewer.