Bug 115959 - Rename DOMPath.idl to Path.idl to match specification
Summary: Rename DOMPath.idl to Path.idl to match specification
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: http://www.w3.org/TR/2dcontext2/#path
Keywords:
Depends on: 115961
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-11 09:40 PDT by Chris Dumez
Modified: 2013-08-16 12:33 PDT (History)
11 users (show)

See Also:


Attachments
Patch (212.75 KB, patch)
2013-05-11 09:46 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (214.06 KB, patch)
2013-05-11 12:23 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2013-05-11 09:40:06 PDT
The Path IDL interface is currently called DOMPath and the file DOMPath.idl. We currently use the [InterfaceName] WebKit-IDL extended attribute to make sure the interface is exposed as "Path" on JavaScript side.

We usually use the same name as in JavaScript for the Web IDL and the [ImplementedAs] IDL extended attribute is used to map it to another name on C++ side. This is at least the case of IDL operations and attributes.

For interfaces, we currently do the opposite, which is confusing / inconsistent. We should consistently use [ImplementedAs] for interfaces for consistency with operations / attributes and deprecate [InterfaceName].

This patch will add support [ImplementedAs] extended attribute support to the JSC bindings generator and rename DOMPath to Path.
This is an initial step towards removing [InterfaceName] extended attribute. Other interfaces using [InterfaceName] will be corrected in a follow up patch.

Corresponding Blink patch:
https://src.chromium.org/viewvc/blink?view=rev&revision=150154
Comment 1 Chris Dumez 2013-05-11 09:46:32 PDT
Created attachment 201460 [details]
Patch
Comment 2 WebKit Commit Bot 2013-05-11 09:50:25 PDT
Attachment 201460 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/CMakeLists.txt', u'Source/WebCore/ChangeLog', u'Source/WebCore/DerivedSources.cpp', u'Source/WebCore/DerivedSources.make', u'Source/WebCore/DerivedSources.pri', u'Source/WebCore/GNUmakefile.list.am', u'Source/WebCore/WebCore.vcproj/WebCore.vcproj', u'Source/WebCore/WebCore.xcodeproj/project.pbxproj', u'Source/WebCore/bindings/scripts/CodeGeneratorJS.pm', u'Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterfaceImplementedAs.cpp', u'Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterfaceImplementedAs.h', u'Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp', u'Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.h', u'Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAsPrivate.h', u'Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h', u'Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.cpp', u'Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.h', u'Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h', u'Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm', u'Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterfaceImplementedAs.h', u'Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterfaceImplementedAs.mm', u'Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterfaceImplementedAsInternal.h', u'Source/WebCore/bindings/scripts/test/TestCallback.idl', u'Source/WebCore/bindings/scripts/test/TestInterfaceImplementedAs.idl', u'Source/WebCore/html/canvas/CanvasRenderingContext2D.idl', u'Source/WebCore/html/canvas/DOMPath.idl', u'Source/WebCore/html/canvas/Path.idl']" exit_code: 1
Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.cpp:26:  "JSTestInterfaceImplementedAs.h" already included at Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.cpp:22  [build/include] [4]
Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.cpp:277:  Do not add platform specific code in WebCore outside of platform.  [build/webcore_platform_layering_violation] [5]
Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.cpp:279:  Extra space before ( in function call  [whitespace/parens] [4]
Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.cpp:288:  More than one command on the same line in if  [whitespace/parens] [4]
Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.cpp:292:  Do not add platform specific code in WebCore outside of platform.  [build/webcore_platform_layering_violation] [5]
Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterfaceImplementedAsInternal.h:32:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:146:  When wrapping a line, only indent 4 spaces.  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:148:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:149:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:150:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:151:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:153:  When wrapping a line, only indent 4 spaces.  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:155:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:156:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:157:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:158:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.h:59:  More than one command on the same line in if  [whitespace/parens] [4]
Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterfaceImplementedAs.cpp:26:  "WebDOMTestInterfaceImplementedAs.h" already included at Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterfaceImplementedAs.cpp:22  [build/include] [4]
Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterfaceImplementedAs.cpp:28:  wtf includes should be <wtf/file.h> instead of "wtf/file.h".  [build/include] [4]
Total errors found: 19 in 26 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Chris Dumez 2013-05-11 12:23:53 PDT
Created attachment 201468 [details]
Patch
Comment 4 WebKit Commit Bot 2013-05-11 12:26:49 PDT
Attachment 201468 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/CMakeLists.txt', u'Source/WebCore/ChangeLog', u'Source/WebCore/DerivedSources.cpp', u'Source/WebCore/DerivedSources.make', u'Source/WebCore/DerivedSources.pri', u'Source/WebCore/GNUmakefile.list.am', u'Source/WebCore/WebCore.vcproj/WebCore.vcproj', u'Source/WebCore/WebCore.xcodeproj/project.pbxproj', u'Source/WebCore/bindings/scripts/CodeGeneratorJS.pm', u'Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterfaceImplementedAs.cpp', u'Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterfaceImplementedAs.h', u'Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp', u'Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.h', u'Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAsPrivate.h', u'Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h', u'Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.cpp', u'Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.h', u'Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp', u'Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h', u'Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm', u'Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterfaceImplementedAs.h', u'Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterfaceImplementedAs.mm', u'Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterfaceImplementedAsInternal.h', u'Source/WebCore/bindings/scripts/test/TestCallback.idl', u'Source/WebCore/bindings/scripts/test/TestInterfaceImplementedAs.idl', u'Source/WebCore/html/canvas/CanvasRenderingContext2D.idl', u'Source/WebCore/html/canvas/DOMPath.idl', u'Source/WebCore/html/canvas/Path.idl']" exit_code: 1
Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.cpp:276:  Do not add platform specific code in WebCore outside of platform.  [build/webcore_platform_layering_violation] [5]
Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.cpp:278:  Extra space before ( in function call  [whitespace/parens] [4]
Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceImplementedAs.cpp:292:  Do not add platform specific code in WebCore outside of platform.  [build/webcore_platform_layering_violation] [5]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:146:  When wrapping a line, only indent 4 spaces.  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:148:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:149:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:150:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:151:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:153:  When wrapping a line, only indent 4 spaces.  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:155:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:156:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:157:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterfaceImplementedAs.cpp:158:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 13 in 26 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Darin Adler 2013-05-11 16:34:02 PDT
While it’s nice to have the IDL file match the specification IDL file, I am not sure that outweighs the desire to have the IDL file name match the names of the underlying .h and .cpp files, since the set of them work together to create and export a DOM class.

Is this really an important desirable change? What programmers does this help?
Comment 6 Darin Adler 2013-05-11 16:34:47 PDT
I think we chose wrong for interfaces and should go the other direction.
Comment 7 Chris Dumez 2013-05-13 04:53:20 PDT
(In reply to comment #6)
> I think we chose wrong for interfaces and should go the other direction.

So do I understand correctly that you agree with this change now?

Basically, we currently have 2 WebKit-specific IDL attributes that solve the same problem (Naming limitations on C++ side): [InterfaceName], [ImplementedAs], but in opposite ways. This is a bit confusing.

Also, I believe it is a good idea to limit the number of WebKit-specific IDL attributes. This makes our IDL easier to understand / learn and makes the generator a bit simpler.

The reasons I would like to keep [ImplementedAs] and remove [InterfaceName] are:
- ImplementedAs is currently used more than InterfaceName (for operations and attributes)
- The naming restriction is on C++ side, not on IDL side. Therefore, using the right name on IDL side (and an alternative name on C++ side) makes more sense to me. Therefore, I think [ImplementedAs] solves the problem best.
- This is what is being done in Blink and I'm trying to stay compatible as much as possible.
Comment 8 Darin Adler 2013-05-13 09:40:38 PDT
(In reply to comment #7)
> (In reply to comment #6)
> > I think we chose wrong for interfaces and should go the other direction.
> 
> So do I understand correctly that you agree with this change now?

No. The “we” here is the patch, which I think choses wrong.

> - The naming restriction is on C++ side, not on IDL side. Therefore, using the right name on IDL side (and an alternative name on C++ side) makes more sense to me. Therefore, I think [ImplementedAs] solves the problem best.

I see the IDL as a helper to export the C++ class, not as a platform independent header file that needs to match a specification.

I think it is better for the source file to match the .cpp and .h source file, rather than matching the exported class name from the DOM specification. The three source files work together as a team, and should have the same names.

Maybe you could ask others in the WebKit project. There’s no urgent need to rush to change this before we have consensus.
Comment 9 Build Bot 2013-05-17 12:59:27 PDT
Comment on attachment 201468 [details]
Patch

Attachment 201468 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/491435
Comment 10 Build Bot 2013-05-17 13:13:10 PDT
Comment on attachment 201468 [details]
Patch

Attachment 201468 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/483869