Skip to content

Commit

Permalink
make_element_factory.py generates snake_case files.
Browse files Browse the repository at this point in the history
Bug: 770603
Change-Id: Idd9f6ea0c9d2d6ace0af99bd894d7aec7f99e42b
Reviewed-on: https://chromium-review.googlesource.com/701816
Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506712}
  • Loading branch information
tkent-google authored and Commit Bot committed Oct 5, 2017
1 parent 3eb58fb commit 22de732
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 25 deletions.
12 changes: 5 additions & 7 deletions third_party/WebKit/Source/build/scripts/make_element_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ class MakeElementFactoryWriter(MakeQualifiedNamesWriter):
def __init__(self, json5_file_paths):
super(MakeElementFactoryWriter, self).__init__(json5_file_paths)

# FIXME: When we start using these element factories, we'll want to
# remove the "new" prefix and also have our base class generate
# *Names.h and *Names.cpp.
basename = self.namespace.lower() + '_element_factory'
self._outputs.update({
(self.namespace + 'ElementFactory.h'): self.generate_factory_header,
(self.namespace + 'ElementFactory.cpp'): self.generate_factory_implementation,
(basename + '.h'): self.generate_factory_header,
(basename + '.cc'): self.generate_factory_implementation,
})

fallback_interface = self.tags_json5_file.metadata['fallbackInterfaceName'].strip('"')
Expand Down Expand Up @@ -90,11 +88,11 @@ def __init__(self, json5_file_paths):
'input_files': self._input_files,
})

@template_expander.use_jinja('templates/ElementFactory.h.tmpl', filters=filters)
@template_expander.use_jinja('templates/element_factory.h.tmpl', filters=filters)
def generate_factory_header(self):
return self._template_context

@template_expander.use_jinja('templates/ElementFactory.cpp.tmpl', filters=filters)
@template_expander.use_jinja('templates/element_factory.cc.tmpl', filters=filters)
def generate_factory_implementation(self):
return self._template_context

Expand Down
4 changes: 2 additions & 2 deletions third_party/WebKit/Source/build/scripts/scripts.gni
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ make_qualified_names_files =
make_element_factory_files =
make_qualified_names_files + [
"$_scripts_dir/make_element_factory.py",
"$_scripts_dir/templates/ElementFactory.cpp.tmpl",
"$_scripts_dir/templates/ElementFactory.h.tmpl",
"$_scripts_dir/templates/element_factory.cc.tmpl",
"$_scripts_dir/templates/element_factory.h.tmpl",
]

make_element_type_helpers_files =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{{source_files_for_generated_file(template_file, input_files)}}

#include "{{namespace}}ElementFactory.h"
#include "core/{{namespace|lower}}_element_factory.h"

#include "core/{{namespace|lower}}_names.h"
{% for header in tags|groupby('interface_header') %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@

{{source_files_for_generated_file(template_file, input_files)}}

#ifndef {{namespace}}ElementFactory_h
#define {{namespace}}ElementFactory_h
#ifndef BLINK_CORE_{{namespace|upper}}_ELEMENT_FACTORY_H_
#define BLINK_CORE_{{namespace|upper}}_ELEMENT_FACTORY_H_

#include "core/dom/Document.h"
#include "platform/heap/Handle.h"
#include "platform/wtf/Forward.h"
#include "platform/wtf/RefPtr.h"

namespace blink {

class Document;
class {{namespace}}Element;
{% if namespace == 'HTML' %}
class HTMLFormElement;
Expand Down
8 changes: 4 additions & 4 deletions third_party/WebKit/Source/core/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,8 @@ process_json5_files("make_core_generated_html_element_factory") {
]
other_inputs = make_element_factory_files
outputs = [
"$blink_core_output_dir/HTMLElementFactory.cpp",
"$blink_core_output_dir/HTMLElementFactory.h",
"$blink_core_output_dir/html_element_factory.cc",
"$blink_core_output_dir/html_element_factory.h",
"$blink_core_output_dir/html_names.cc",
"$blink_core_output_dir/html_names.h",
]
Expand All @@ -876,8 +876,8 @@ process_json5_files("make_core_generated_svg_names") {
]
other_inputs = make_element_factory_files
outputs = [
"$blink_core_output_dir/SVGElementFactory.cpp",
"$blink_core_output_dir/SVGElementFactory.h",
"$blink_core_output_dir/svg_element_factory.cc",
"$blink_core_output_dir/svg_element_factory.h",
"$blink_core_output_dir/svg_names.cc",
"$blink_core_output_dir/svg_names.h",
]
Expand Down
4 changes: 2 additions & 2 deletions third_party/WebKit/Source/core/dom/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
#include "bindings/core/v8/WindowProxy.h"
#include "bindings/core/v8/html_script_element_or_svg_script_element.h"
#include "bindings/core/v8/string_or_dictionary.h"
#include "core/HTMLElementFactory.h"
#include "core/HTMLElementTypeHelpers.h"
#include "core/SVGElementFactory.h"
#include "core/animation/DocumentAnimations.h"
#include "core/animation/DocumentTimeline.h"
#include "core/animation/PendingAnimations.h"
Expand Down Expand Up @@ -169,6 +167,7 @@
#include "core/html/parser/HTMLParserIdioms.h"
#include "core/html/parser/NestingLevelIncrementer.h"
#include "core/html/parser/TextResourceDecoder.h"
#include "core/html_element_factory.h"
#include "core/html_names.h"
#include "core/input/EventHandler.h"
#include "core/input/TouchList.h"
Expand Down Expand Up @@ -211,6 +210,7 @@
#include "core/svg/SVGScriptElement.h"
#include "core/svg/SVGTitleElement.h"
#include "core/svg/SVGUseElement.h"
#include "core/svg_element_factory.h"
#include "core/svg_names.h"
#include "core/timing/DOMWindowPerformance.h"
#include "core/timing/Performance.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#include "core/editing/EditingUtilities.h"

#include "core/HTMLElementFactory.h"
#include "core/InputTypeNames.h"
#include "core/clipboard/DataObject.h"
#include "core/dom/Document.h"
Expand Down Expand Up @@ -61,6 +60,7 @@
#include "core/html/HTMLSpanElement.h"
#include "core/html/HTMLTableCellElement.h"
#include "core/html/HTMLUListElement.h"
#include "core/html_element_factory.h"
#include "core/html_names.h"
#include "core/layout/LayoutObject.h"
#include "core/layout/LayoutTableCell.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "core/html/custom/CustomElement.h"

#include "core/HTMLElementFactory.h"
#include "core/HTMLElementTypeHelpers.h"
#include "core/dom/Document.h"
#include "core/dom/QualifiedName.h"
Expand All @@ -17,6 +16,7 @@
#include "core/html/custom/CustomElementRegistry.h"
#include "core/html/custom/V0CustomElement.h"
#include "core/html/custom/V0CustomElementRegistrationContext.h"
#include "core/html_element_factory.h"
#include "platform/wtf/text/AtomicStringHash.h"

namespace blink {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "core/html/parser/HTMLConstructionSite.h"

#include <limits>
#include "core/HTMLElementFactory.h"
#include "core/dom/Comment.h"
#include "core/dom/DocumentFragment.h"
#include "core/dom/DocumentType.h"
Expand Down Expand Up @@ -55,6 +54,7 @@
#include "core/html/parser/HTMLParserReentryPermit.h"
#include "core/html/parser/HTMLStackItem.h"
#include "core/html/parser/HTMLToken.h"
#include "core/html_element_factory.h"
#include "core/html_names.h"
#include "core/loader/FrameLoader.h"
#include "core/svg/SVGScriptElement.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

#include "core/html/track/vtt/VTTElement.h"

#include "core/HTMLElementFactory.h"
#include "core/css/StyleChangeReason.h"
#include "core/html_element_factory.h"

namespace blink {

Expand Down

0 comments on commit 22de732

Please sign in to comment.