Changeset 177864 in webkit
- Timestamp:
- Jan 2, 2015, 10:18:40 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r177863 r177864 1 2015-01-02 Darin Adler <darin@apple.com> 2 3 Pass Document instead of ScriptExecutionContext to non-worker constructors 4 https://bugs.webkit.org/show_bug.cgi?id=140040 5 6 Reviewed by Sam Weinig. 7 8 * bindings/scripts/CodeGeneratorJS.pm: 9 (GenerateConstructorDefinition): 10 Generate code passing the document when ConstructorCallWith=Document is used. 11 Later, we could base this on whether the constructor is exposed to workers 12 or not, instead, but for now this seems a clean way to do it. 13 14 * bindings/scripts/IDLAttributes.txt: Allow ConstructorCallWith=Document. 15 16 * Modules/notifications/Notification.cpp: 17 (WebCore::Notification::create): 18 * Modules/notifications/Notification.h: 19 * Modules/notifications/Notification.idl: 20 * dom/Comment.cpp: 21 * dom/Comment.h: 22 * dom/Comment.idl: 23 * dom/DocumentFragment.cpp: 24 (WebCore::DocumentFragment::nodeName): Use ASCIILiteral (just something 25 I noticed in passing). 26 * dom/DocumentFragment.h: 27 * dom/DocumentFragment.idl: 28 * dom/Range.cpp: 29 * dom/Range.h: 30 * dom/Range.idl: 31 * dom/Text.cpp: 32 * dom/Text.h: 33 * dom/Text.idl: 34 Change from ScriptExecutionContext to Document, and remove unneeded 35 overloads that were just casting. It's better to have the bindings 36 layer, which knows these are not ScriptExecutionContext, do the cast 37 than to have create functions that cast that are not in any position 38 to know the cast is safe. 39 1 40 2015-01-02 Darin Adler <darin@apple.com> 2 41 -
trunk/Source/WebCore/Modules/notifications/Notification.cpp
r177259 r177864 108 108 109 109 #if ENABLE(NOTIFICATIONS) 110 Ref<Notification> Notification::create( ScriptExecutionContext& context, const String& title, const Dictionary& options)110 Ref<Notification> Notification::create(Document& context, const String& title, const Dictionary& options) 111 111 { 112 112 auto notification = adoptRef(*new Notification(context, title)); -
trunk/Source/WebCore/Modules/notifications/Notification.h
r177259 r177864 70 70 #endif 71 71 #if ENABLE(NOTIFICATIONS) 72 static Ref<Notification> create( ScriptExecutionContext&, const String& title, const Dictionary& options);72 static Ref<Notification> create(Document&, const String& title, const Dictionary& options); 73 73 #endif 74 74 -
trunk/Source/WebCore/Modules/notifications/Notification.idl
r159061 r177864 36 36 #if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS 37 37 Constructor(DOMString title, [Default=Undefined] optional Dictionary options), 38 ConstructorCallWith= ScriptExecutionContext,38 ConstructorCallWith=Document, 39 39 #endif 40 40 ] interface Notification { -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r177744 r177864 4600 4600 my ($dummy, $paramIndex) = GenerateParametersCheck($outputArray, $function, $interface, $numParameters, $interfaceName, "constructorCallback", undef, undef, undef); 4601 4601 4602 if ($codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{"ConstructorCallWith"}, "ScriptExecutionContext") 4602 if ($codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{"ConstructorCallWith"}, "ScriptExecutionContext")) { 4603 4603 push(@constructorArgList, "*context"); 4604 4604 push(@$outputArray, " ScriptExecutionContext* context = castedThis->scriptExecutionContext();\n"); 4605 4605 push(@$outputArray, " if (!context)\n"); 4606 4606 push(@$outputArray, " return throwConstructorDocumentUnavailableError(*exec, \"${interfaceName}\");\n"); 4607 } 4608 if ($codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{"ConstructorCallWith"}, "Document")) { 4609 $implIncludes{"Document.h"} = 1; 4610 push(@constructorArgList, "document"); 4611 push(@$outputArray, " ScriptExecutionContext* context = castedThis->scriptExecutionContext();\n"); 4612 push(@$outputArray, " if (!context)\n"); 4613 push(@$outputArray, " return throwConstructorDocumentUnavailableError(*exec, \"${interfaceName}\");\n"); 4614 push(@$outputArray, " Document& document = downcast<Document>(*context);\n"); 4607 4615 } 4608 4616 if ($generatingNamedConstructor) { -
trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt
r172540 r177864 30 30 Conditional=* 31 31 Constructor 32 ConstructorCallWith= ScriptExecutionContext32 ConstructorCallWith=Document|ScriptExecutionContext 33 33 ConstructorConditional=* 34 34 ConstructorRaisesException -
trunk/Source/WebCore/dom/Comment.cpp
r177559 r177864 37 37 } 38 38 39 Ref<Comment> Comment::create(ScriptExecutionContext& context, const String& text)40 {41 return adoptRef(*new Comment(downcast<Document>(context), text));42 }43 44 39 String Comment::nodeName() const 45 40 { -
trunk/Source/WebCore/dom/Comment.h
r177559 r177864 31 31 public: 32 32 static Ref<Comment> create(Document&, const String&); 33 static Ref<Comment> create(ScriptExecutionContext&, const String&);34 33 35 34 private: -
trunk/Source/WebCore/dom/Comment.idl
r161867 r177864 20 20 [ 21 21 Constructor([Default=NullString] optional DOMString data), 22 ConstructorCallWith= ScriptExecutionContext22 ConstructorCallWith=Document 23 23 ] interface Comment : CharacterData { 24 24 }; -
trunk/Source/WebCore/dom/DocumentFragment.cpp
r177559 r177864 42 42 } 43 43 44 Ref<DocumentFragment> DocumentFragment::create(ScriptExecutionContext& context)45 {46 return adoptRef(*new DocumentFragment(downcast<Document>(context), Node::CreateDocumentFragment));47 }48 49 44 String DocumentFragment::nodeName() const 50 45 { 51 return "#document-fragment";46 return ASCIILiteral("#document-fragment"); 52 47 } 53 48 -
trunk/Source/WebCore/dom/DocumentFragment.h
r177559 r177864 30 30 namespace WebCore { 31 31 32 class ScriptExecutionContext;33 34 32 class DocumentFragment : public ContainerNode { 35 33 public: 36 34 static Ref<DocumentFragment> create(Document&); 37 static Ref<DocumentFragment> create(ScriptExecutionContext&);38 35 39 36 void parseHTML(const String&, Element* contextElement, ParserContentPolicy = AllowScriptingContent); -
trunk/Source/WebCore/dom/DocumentFragment.idl
r162062 r177864 20 20 [ 21 21 Constructor, 22 ConstructorCallWith= ScriptExecutionContext22 ConstructorCallWith=Document 23 23 ] interface DocumentFragment : Node { 24 24 // NodeSelector - Selector API -
trunk/Source/WebCore/dom/Range.cpp
r177513 r177864 103 103 { 104 104 return adoptRef(*new Range(ownerDocument, start.containerNode(), start.computeOffsetInContainerNode(), end.containerNode(), end.computeOffsetInContainerNode())); 105 }106 107 Ref<Range> Range::create(ScriptExecutionContext& context)108 {109 return adoptRef(*new Range(downcast<Document>(context)));110 105 } 111 106 -
trunk/Source/WebCore/dom/Range.h
r177739 r177864 45 45 class Node; 46 46 class NodeWithIndex; 47 class SelectionRect; 47 48 class Text; 48 49 class VisiblePosition; 49 #if PLATFORM(IOS)50 class SelectionRect;51 #endif52 50 53 51 class Range : public RefCounted<Range> { … … 56 54 WEBCORE_EXPORT static Ref<Range> create(Document&, PassRefPtr<Node> startContainer, int startOffset, PassRefPtr<Node> endContainer, int endOffset); 57 55 WEBCORE_EXPORT static Ref<Range> create(Document&, const Position&, const Position&); 58 WEBCORE_EXPORT static Ref<Range> create(ScriptExecutionContext&);59 56 WEBCORE_EXPORT static Ref<Range> create(Document&, const VisiblePosition&, const VisiblePosition&); 60 57 WEBCORE_EXPORT ~Range(); -
trunk/Source/WebCore/dom/Range.idl
r165676 r177864 22 22 [ 23 23 Constructor, 24 ConstructorCallWith= ScriptExecutionContext,24 ConstructorCallWith=Document, 25 25 ImplementationLacksVTable 26 26 ] interface Range { -
trunk/Source/WebCore/dom/Text.cpp
r177559 r177864 44 44 } 45 45 46 Ref<Text> Text::create(ScriptExecutionContext& context, const String& data)47 {48 return adoptRef(*new Text(downcast<Document>(context), data, CreateText));49 }50 51 46 Ref<Text> Text::createEditingText(Document& document, const String& data) 52 47 { -
trunk/Source/WebCore/dom/Text.h
r177559 r177864 30 30 31 31 class RenderText; 32 class ScriptExecutionContext;33 32 34 33 class Text : public CharacterData { … … 37 36 38 37 static Ref<Text> create(Document&, const String&); 39 static Ref<Text> create(ScriptExecutionContext&, const String&);40 38 static Ref<Text> createWithLengthLimit(Document&, const String&, unsigned positionInString, unsigned lengthLimit = defaultLengthLimit); 41 39 static Ref<Text> createEditingText(Document&, const String&); -
trunk/Source/WebCore/dom/Text.idl
r175688 r177864 19 19 [ 20 20 Constructor([Default=NullString] optional DOMString data), 21 ConstructorCallWith= ScriptExecutionContext21 ConstructorCallWith=Document 22 22 ] interface Text : CharacterData { 23 23
Note:
See TracChangeset
for help on using the changeset viewer.