summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PRESUBMIT.py166
-rw-r--r--core/fpdfapi/fpdf_page/pageint.h2
-rw-r--r--core/fpdfapi/fpdf_render/cpdf_type3cache.cpp4
-rw-r--r--core/fpdfdoc/cpdf_apsettings.h2
-rw-r--r--core/fpdfdoc/cpdf_variabletext.cpp2
-rw-r--r--core/fpdfdoc/ctypeset.cpp2
-rw-r--r--core/fxge/android/fx_android_font.h2
-rw-r--r--core/fxge/ge/cfx_folderfontinfo.h2
-rw-r--r--core/fxge/ge/cfx_fontmapper.cpp2
-rw-r--r--core/fxge/win32/fx_win32_device.cpp2
-rw-r--r--core/fxge/win32/fx_win32_print.cpp2
-rw-r--r--fpdfsdk/cpdfsdk_annothandlermgr.cpp2
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.cpp2
-rw-r--r--fpdfsdk/fpdf_sysfontinfo.cpp2
-rw-r--r--fpdfsdk/include/fsdk_actionhandler.h2
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp8
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp4
-rw-r--r--xfa/fde/cfde_txtedtparag.cpp2
-rw-r--r--xfa/fde/xml/fde_xml_imp_unittest.cpp2
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.h2
-rw-r--r--xfa/fwl/basewidget/ifwl_barcode.h2
-rw-r--r--xfa/fwl/basewidget/ifwl_caret.h2
-rw-r--r--xfa/fwl/basewidget/ifwl_checkbox.h4
-rw-r--r--xfa/fwl/basewidget/ifwl_datetimepicker.h4
-rw-r--r--xfa/fwl/basewidget/ifwl_listbox.h4
-rw-r--r--xfa/fwl/basewidget/ifwl_monthcalendar.h4
-rw-r--r--xfa/fwl/basewidget/ifwl_picturebox.h4
-rw-r--r--xfa/fwl/basewidget/ifwl_pushbutton.h2
-rw-r--r--xfa/fwl/basewidget/ifwl_scrollbar.h8
-rw-r--r--xfa/fwl/core/ifwl_form.h4
-rw-r--r--xfa/fwl/lightwidget/cfwl_widget.h2
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.h2
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp2
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp2
-rw-r--r--xfa/fxfa/app/xfa_textlayout.h2
35 files changed, 214 insertions, 48 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 111abb03b0..0f93697987 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -34,6 +34,12 @@ LINT_FILTERS = [
]
+_INCLUDE_ORDER_WARNING = (
+ 'Your #include order seems to be broken. Remember to use the right '
+ 'collation (LC_COLLATE=C) and check\nhttps://google.github.io/styleguide/'
+ 'cppguide.html#Names_and_Order_of_Includes')
+
+
def _CheckUnwantedDependencies(input_api, output_api):
"""Runs checkdeps on #include statements added in this
change. Breaking - rules is an error, breaking ! rules is a
@@ -91,11 +97,171 @@ def _CheckUnwantedDependencies(input_api, output_api):
return results
+def _CheckIncludeOrderForScope(scope, input_api, file_path, changed_linenums):
+ """Checks that the lines in scope occur in the right order.
+
+ 1. C system files in alphabetical order
+ 2. C++ system files in alphabetical order
+ 3. Project's .h files
+ """
+
+ c_system_include_pattern = input_api.re.compile(r'\s*#include <.*\.h>')
+ cpp_system_include_pattern = input_api.re.compile(r'\s*#include <.*>')
+ custom_include_pattern = input_api.re.compile(r'\s*#include ".*')
+
+ C_SYSTEM_INCLUDES, CPP_SYSTEM_INCLUDES, CUSTOM_INCLUDES = range(3)
+
+ state = C_SYSTEM_INCLUDES
+
+ previous_line = ''
+ previous_line_num = 0
+ problem_linenums = []
+ out_of_order = " - line belongs before previous line"
+ for line_num, line in scope:
+ if c_system_include_pattern.match(line):
+ if state != C_SYSTEM_INCLUDES:
+ problem_linenums.append((line_num, previous_line_num,
+ " - C system include file in wrong block"))
+ elif previous_line and previous_line > line:
+ problem_linenums.append((line_num, previous_line_num,
+ out_of_order))
+ elif cpp_system_include_pattern.match(line):
+ if state == C_SYSTEM_INCLUDES:
+ state = CPP_SYSTEM_INCLUDES
+ elif state == CUSTOM_INCLUDES:
+ problem_linenums.append((line_num, previous_line_num,
+ " - c++ system include file in wrong block"))
+ elif previous_line and previous_line > line:
+ problem_linenums.append((line_num, previous_line_num, out_of_order))
+ elif custom_include_pattern.match(line):
+ if state != CUSTOM_INCLUDES:
+ state = CUSTOM_INCLUDES
+ elif previous_line and previous_line > line:
+ problem_linenums.append((line_num, previous_line_num, out_of_order))
+ else:
+ problem_linenums.append((line_num, previous_line_num,
+ "Unknown include type"))
+ previous_line = line
+ previous_line_num = line_num
+
+ warnings = []
+ for (line_num, previous_line_num, failure_type) in problem_linenums:
+ if line_num in changed_linenums or previous_line_num in changed_linenums:
+ warnings.append(' %s:%d:%s' % (file_path, line_num, failure_type))
+ return warnings
+
+
+def _CheckIncludeOrderInFile(input_api, f, changed_linenums):
+ """Checks the #include order for the given file f."""
+
+ system_include_pattern = input_api.re.compile(r'\s*#include \<.*')
+ # Exclude the following includes from the check:
+ # 1) #include <.../...>, e.g., <sys/...> includes often need to appear in a
+ # specific order.
+ # 2) <atlbase.h>, "build/build_config.h"
+ excluded_include_pattern = input_api.re.compile(
+ r'\s*#include (\<.*/.*|\<atlbase\.h\>|"build/build_config.h")')
+ custom_include_pattern = input_api.re.compile(r'\s*#include "(?P<FILE>.*)"')
+ # Match the final or penultimate token if it is xxxtest so we can ignore it
+ # when considering the special first include.
+ test_file_tag_pattern = input_api.re.compile(
+ r'_[a-z]+test(?=(_[a-zA-Z0-9]+)?\.)')
+ if_pattern = input_api.re.compile(
+ r'\s*#\s*(if|elif|else|endif|define|undef).*')
+ # Some files need specialized order of includes; exclude such files from this
+ # check.
+ uncheckable_includes_pattern = input_api.re.compile(
+ r'\s*#include '
+ '("ipc/.*macros\.h"|<windows\.h>|".*gl.*autogen.h")\s*')
+
+ contents = f.NewContents()
+ warnings = []
+ line_num = 0
+
+ # Handle the special first include. If the first include file is
+ # some/path/file.h, the corresponding including file can be some/path/file.cc,
+ # some/other/path/file.cc, some/path/file_platform.cc, some/path/file-suffix.h
+ # etc. It's also possible that no special first include exists.
+ # If the included file is some/path/file_platform.h the including file could
+ # also be some/path/file_xxxtest_platform.h.
+ including_file_base_name = test_file_tag_pattern.sub(
+ '', input_api.os_path.basename(f.LocalPath()))
+
+ for line in contents:
+ line_num += 1
+ if system_include_pattern.match(line):
+ # No special first include -> process the line again along with normal
+ # includes.
+ line_num -= 1
+ break
+ match = custom_include_pattern.match(line)
+ if match:
+ match_dict = match.groupdict()
+ header_basename = test_file_tag_pattern.sub(
+ '', input_api.os_path.basename(match_dict['FILE'])).replace('.h', '')
+
+ if header_basename not in including_file_base_name:
+ # No special first include -> process the line again along with normal
+ # includes.
+ line_num -= 1
+ break
+
+ # Split into scopes: Each region between #if and #endif is its own scope.
+ scopes = []
+ current_scope = []
+ for line in contents[line_num:]:
+ line_num += 1
+ if uncheckable_includes_pattern.match(line):
+ continue
+ if if_pattern.match(line):
+ scopes.append(current_scope)
+ current_scope = []
+ elif ((system_include_pattern.match(line) or
+ custom_include_pattern.match(line)) and
+ not excluded_include_pattern.match(line)):
+ current_scope.append((line_num, line))
+ scopes.append(current_scope)
+
+ for scope in scopes:
+ warnings.extend(_CheckIncludeOrderForScope(scope, input_api, f.LocalPath(),
+ changed_linenums))
+ return warnings
+
+
+def _CheckIncludeOrder(input_api, output_api):
+ """Checks that the #include order is correct.
+
+ 1. The corresponding header for source files.
+ 2. C system files in alphabetical order
+ 3. C++ system files in alphabetical order
+ 4. Project's .h files in alphabetical order
+
+ Each region separated by #if, #elif, #else, #endif, #define and #undef follows
+ these rules separately.
+ """
+ def FileFilterIncludeOrder(affected_file):
+ black_list = (input_api.DEFAULT_BLACK_LIST)
+ return input_api.FilterSourceFile(affected_file, black_list=black_list)
+
+ warnings = []
+ for f in input_api.AffectedFiles(file_filter=FileFilterIncludeOrder):
+ if f.LocalPath().endswith(('.cc', '.h', '.mm')):
+ changed_linenums = set(line_num for line_num, _ in f.ChangedContents())
+ warnings.extend(_CheckIncludeOrderInFile(input_api, f, changed_linenums))
+
+ results = []
+ if warnings:
+ results.append(output_api.PresubmitPromptOrNotify(_INCLUDE_ORDER_WARNING,
+ warnings))
+ return results
+
+
def CheckChangeOnUpload(input_api, output_api):
results = []
results += _CheckUnwantedDependencies(input_api, output_api)
results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api)
results += input_api.canned_checks.CheckChangeLintsClean(
input_api, output_api, None, LINT_FILTERS)
+ results += _CheckIncludeOrder(input_api, output_api)
return results
diff --git a/core/fpdfapi/fpdf_page/pageint.h b/core/fpdfapi/fpdf_page/pageint.h
index 72f3184529..427a363e8e 100644
--- a/core/fpdfapi/fpdf_page/pageint.h
+++ b/core/fpdfapi/fpdf_page/pageint.h
@@ -9,8 +9,8 @@
#include <map>
#include <memory>
-#include <unordered_map>
#include <set>
+#include <unordered_map>
#include <vector>
#include "core/fpdfapi/fpdf_page/cpdf_contentmark.h"
diff --git a/core/fpdfapi/fpdf_render/cpdf_type3cache.cpp b/core/fpdfapi/fpdf_render/cpdf_type3cache.cpp
index a414d3c589..a1856ba5e1 100644
--- a/core/fpdfapi/fpdf_render/cpdf_type3cache.cpp
+++ b/core/fpdfapi/fpdf_render/cpdf_type3cache.cpp
@@ -9,11 +9,11 @@
#include <map>
#include <memory>
-#include "core/fxge/include/fx_dib.h"
-#include "core/fxge/include/fx_font.h"
#include "core/fpdfapi/fpdf_font/cpdf_type3char.h"
#include "core/fpdfapi/fpdf_font/cpdf_type3font.h"
#include "core/fpdfapi/fpdf_render/cpdf_type3glyphs.h"
+#include "core/fxge/include/fx_dib.h"
+#include "core/fxge/include/fx_font.h"
namespace {
diff --git a/core/fpdfdoc/cpdf_apsettings.h b/core/fpdfdoc/cpdf_apsettings.h
index d2bca5c5ee..860807efd2 100644
--- a/core/fpdfdoc/cpdf_apsettings.h
+++ b/core/fpdfdoc/cpdf_apsettings.h
@@ -7,10 +7,10 @@
#ifndef CORE_FPDFDOC_CPDF_APSETTINGS_H_
#define CORE_FPDFDOC_CPDF_APSETTINGS_H_
+#include "core/fpdfdoc/include/cpdf_iconfit.h"
#include "core/fxcrt/include/fx_string.h"
#include "core/fxcrt/include/fx_system.h"
#include "core/fxge/include/fx_dib.h"
-#include "core/fpdfdoc/include/cpdf_iconfit.h"
class CPDF_Dictionary;
class CPDF_FormControl;
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index 12cf274321..4527fd0367 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -7,8 +7,8 @@
#include "core/fpdfdoc/include/cpdf_variabletext.h"
#include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
-#include "core/fpdfdoc/cpvt_wordinfo.h"
#include "core/fpdfdoc/cline.h"
+#include "core/fpdfdoc/cpvt_wordinfo.h"
#include "core/fpdfdoc/csection.h"
#include "core/fpdfdoc/include/cpvt_section.h"
#include "core/fpdfdoc/include/cpvt_word.h"
diff --git a/core/fpdfdoc/ctypeset.cpp b/core/fpdfdoc/ctypeset.cpp
index 082cef8187..0e5ef2d41b 100644
--- a/core/fpdfdoc/ctypeset.cpp
+++ b/core/fpdfdoc/ctypeset.cpp
@@ -9,8 +9,8 @@
#include <algorithm>
#include "core/fpdfdoc/cline.h"
-#include "core/fpdfdoc/csection.h"
#include "core/fpdfdoc/cpvt_wordinfo.h"
+#include "core/fpdfdoc/csection.h"
namespace {
diff --git a/core/fxge/android/fx_android_font.h b/core/fxge/android/fx_android_font.h
index ad777f3e58..f980836328 100644
--- a/core/fxge/android/fx_android_font.h
+++ b/core/fxge/android/fx_android_font.h
@@ -12,8 +12,8 @@
#if _FX_OS_ == _FX_ANDROID_
#include "core/fxge/include/cfx_fontmapper.h"
-#include "core/fxge/include/ifx_systemfontinfo.h"
#include "core/fxge/include/fx_font.h"
+#include "core/fxge/include/ifx_systemfontinfo.h"
class CFPF_SkiaFontMgr;
diff --git a/core/fxge/ge/cfx_folderfontinfo.h b/core/fxge/ge/cfx_folderfontinfo.h
index c0ce01cd36..2a8d05b3fd 100644
--- a/core/fxge/ge/cfx_folderfontinfo.h
+++ b/core/fxge/ge/cfx_folderfontinfo.h
@@ -11,8 +11,8 @@
#include <vector>
#include "core/fxge/include/cfx_fontmapper.h"
-#include "core/fxge/include/ifx_systemfontinfo.h"
#include "core/fxge/include/fx_font.h"
+#include "core/fxge/include/ifx_systemfontinfo.h"
class CFX_FolderFontInfo : public IFX_SystemFontInfo {
public:
diff --git a/core/fxge/ge/cfx_fontmapper.cpp b/core/fxge/ge/cfx_fontmapper.cpp
index 37c1d03785..08677ee650 100644
--- a/core/fxge/ge/cfx_fontmapper.cpp
+++ b/core/fxge/ge/cfx_fontmapper.cpp
@@ -11,8 +11,8 @@
#include <vector>
#include "core/fxge/include/cfx_substfont.h"
-#include "core/fxge/include/ifx_systemfontinfo.h"
#include "core/fxge/include/fx_font.h"
+#include "core/fxge/include/ifx_systemfontinfo.h"
#include "third_party/base/stl_util.h"
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index 4885cd00cc..9a54dd7f73 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -28,9 +28,9 @@
#include "core/fxge/include/cfx_graphstatedata.h"
#include "core/fxge/include/cfx_pathdata.h"
#include "core/fxge/include/cfx_windowsdevice.h"
-#include "core/fxge/include/ifx_systemfontinfo.h"
#include "core/fxge/include/fx_font.h"
#include "core/fxge/include/fx_freetype.h"
+#include "core/fxge/include/ifx_systemfontinfo.h"
#include "core/fxge/win32/cfx_windowsdib.h"
#include "core/fxge/win32/dwrite_int.h"
#include "core/fxge/win32/win32_int.h"
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index 6b9c2cce35..bc5bb92d5e 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -14,10 +14,10 @@
#include "core/fxge/dib/dib_int.h"
#include "core/fxge/ge/fx_text_int.h"
-#include "core/fxge/include/fx_freetype.h"
#include "core/fxge/include/cfx_fontcache.h"
#include "core/fxge/include/cfx_renderdevice.h"
#include "core/fxge/include/cfx_windowsdevice.h"
+#include "core/fxge/include/fx_freetype.h"
#include "core/fxge/win32/win32_int.h"
#if defined(PDFIUM_PRINT_TEXT_WITH_GDI)
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index 8fa1093818..1f88e16211 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -18,8 +18,8 @@
#include "fpdfsdk/include/cpdfsdk_widgethandler.h"
#ifdef PDF_ENABLE_XFA
-#include "fpdfsdk/include/cpdfsdk_xfawidgethandler.h"
#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h"
+#include "fpdfsdk/include/cpdfsdk_xfawidgethandler.h"
#include "xfa/fxfa/include/xfa_ffpageview.h"
#include "xfa/fxfa/include/xfa_ffwidget.h"
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index 0765011c4d..af160765c8 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -14,13 +14,13 @@
#include "fpdfsdk/include/cpdfsdk_interform.h"
#include "fpdfsdk/include/cpdfsdk_pageview.h"
#include "fpdfsdk/include/cpdfsdk_xfawidget.h"
+#include "xfa/fwl/core/include/fwl_widgethit.h"
#include "xfa/fxfa/include/fxfa_basic.h"
#include "xfa/fxfa/include/xfa_ffdocview.h"
#include "xfa/fxfa/include/xfa_ffpageview.h"
#include "xfa/fxfa/include/xfa_ffwidget.h"
#include "xfa/fxfa/include/xfa_ffwidgethandler.h"
#include "xfa/fxgraphics/include/cfx_graphics.h"
-#include "xfa/fwl/core/include/fwl_widgethit.h"
CPDFSDK_XFAWidgetHandler::CPDFSDK_XFAWidgetHandler(CPDFDoc_Environment* pApp)
: m_pApp(pApp) {}
diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp
index 12253a932d..c5eab95d56 100644
--- a/fpdfsdk/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/fpdf_sysfontinfo.cpp
@@ -7,9 +7,9 @@
#include "public/fpdf_sysfontinfo.h"
#include "core/fxge/include/cfx_fontmapper.h"
-#include "core/fxge/include/ifx_systemfontinfo.h"
#include "core/fxge/include/cfx_gemodule.h"
#include "core/fxge/include/fx_font.h"
+#include "core/fxge/include/ifx_systemfontinfo.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/pdfwindow/PWL_FontMap.h"
diff --git a/fpdfsdk/include/fsdk_actionhandler.h b/fpdfsdk/include/fsdk_actionhandler.h
index f488251579..5262439d81 100644
--- a/fpdfsdk/include/fsdk_actionhandler.h
+++ b/fpdfsdk/include/fsdk_actionhandler.h
@@ -10,8 +10,8 @@
#include <memory>
#include <set>
-#include "core/fpdfdoc/include/cpdf_action.h"
#include "core/fpdfdoc/include/cpdf_aaction.h"
+#include "core/fpdfdoc/include/cpdf_action.h"
#include "core/fxcrt/include/fx_string.h"
#include "fpdfsdk/include/pdfsdk_fieldaction.h"
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp
index e7da157178..3852fe7f0f 100644
--- a/xfa/fde/cfde_txtedtengine.cpp
+++ b/xfa/fde/cfde_txtedtengine.cpp
@@ -8,14 +8,14 @@
#include "xfa/fde/cfde_txtedtbuf.h"
#include "xfa/fde/cfde_txtedtbufiter.h"
-#include "xfa/fde/ifx_chariter.h"
-#include "xfa/fgas/layout/fgas_textbreak.h"
-#include "xfa/fwl/basewidget/fwl_editimp.h"
#include "xfa/fde/cfde_txtedtdorecord_deleterange.h"
#include "xfa/fde/cfde_txtedtdorecord_insert.h"
-#include "xfa/fde/cfde_txtedtparag.h"
#include "xfa/fde/cfde_txtedtpage.h"
+#include "xfa/fde/cfde_txtedtparag.h"
+#include "xfa/fde/ifx_chariter.h"
#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fgas/layout/fgas_textbreak.h"
+#include "xfa/fwl/basewidget/fwl_editimp.h"
namespace {
diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp
index 21420998d4..24eab86e0b 100644
--- a/xfa/fde/cfde_txtedtpage.cpp
+++ b/xfa/fde/cfde_txtedtpage.cpp
@@ -12,10 +12,10 @@
#include "xfa/fde/cfde_txtedtbufiter.h"
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/cfde_txtedtparag.h"
-#include "xfa/fde/ifde_txtedtengine.h"
-#include "xfa/fde/ifde_txtedtpage.h"
#include "xfa/fde/cfde_txtedttextset.h"
#include "xfa/fde/cfx_wordbreak.h"
+#include "xfa/fde/ifde_txtedtengine.h"
+#include "xfa/fde/ifde_txtedtpage.h"
namespace {
diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp
index 9ba0fa5431..38f569d334 100644
--- a/xfa/fde/cfde_txtedtparag.cpp
+++ b/xfa/fde/cfde_txtedtparag.cpp
@@ -10,8 +10,8 @@
#include "xfa/fde/cfde_txtedtbufiter.h"
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/ifde_txtedtengine.h"
-#include "xfa/fgas/layout/fgas_textbreak.h"
#include "xfa/fde/ifx_chariter.h"
+#include "xfa/fgas/layout/fgas_textbreak.h"
CFDE_TxtEdtParag::CFDE_TxtEdtParag(CFDE_TxtEdtEngine* pEngine)
: m_nCharStart(0),
diff --git a/xfa/fde/xml/fde_xml_imp_unittest.cpp b/xfa/fde/xml/fde_xml_imp_unittest.cpp
index 03cc426d32..f0d0bca2ca 100644
--- a/xfa/fde/xml/fde_xml_imp_unittest.cpp
+++ b/xfa/fde/xml/fde_xml_imp_unittest.cpp
@@ -4,8 +4,8 @@
#include "xfa/fde/xml/fde_xml_imp.h"
-#include "xfa/fgas/crt/fgas_stream.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "xfa/fgas/crt/fgas_stream.h"
TEST(CFDE_XMLSyntaxParser, CData) {
const FX_WCHAR* input =
diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h
index 0506876b64..6fed90da50 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.h
+++ b/xfa/fgas/font/fgas_stdfontmgr.h
@@ -11,8 +11,8 @@
#include "core/fxcrt/include/fx_ext.h"
#include "core/fxge/include/cfx_fontmapper.h"
-#include "core/fxge/include/ifx_systemfontinfo.h"
#include "core/fxge/include/fx_freetype.h"
+#include "core/fxge/include/ifx_systemfontinfo.h"
#include "third_party/freetype/include/freetype/fttypes.h"
#include "xfa/fgas/font/fgas_font.h"
diff --git a/xfa/fwl/basewidget/ifwl_barcode.h b/xfa/fwl/basewidget/ifwl_barcode.h
index 13652009eb..c2f464f71b 100644
--- a/xfa/fwl/basewidget/ifwl_barcode.h
+++ b/xfa/fwl/basewidget/ifwl_barcode.h
@@ -7,8 +7,8 @@
#ifndef XFA_FWL_BASEWIDGET_IFWL_BARCODE_H_
#define XFA_FWL_BASEWIDGET_IFWL_BARCODE_H_
-#include "xfa/fxbarcode/include/BC_Library.h"
#include "xfa/fwl/basewidget/ifwl_edit.h"
+#include "xfa/fxbarcode/include/BC_Library.h"
class CFWL_WidgetImpProperties;
diff --git a/xfa/fwl/basewidget/ifwl_caret.h b/xfa/fwl/basewidget/ifwl_caret.h
index 8648ca0a4b..53166c2aa6 100644
--- a/xfa/fwl/basewidget/ifwl_caret.h
+++ b/xfa/fwl/basewidget/ifwl_caret.h
@@ -7,8 +7,8 @@
#ifndef XFA_FWL_BASEWIDGET_IFWL_CARET_H_
#define XFA_FWL_BASEWIDGET_IFWL_CARET_H_
-#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/ifwl_widget.h"
#define FWL_CLASS_Caret L"FWL_CARET"
#define FWL_STATE_CAT_HightLight 1
diff --git a/xfa/fwl/basewidget/ifwl_checkbox.h b/xfa/fwl/basewidget/ifwl_checkbox.h
index 2316ada9cd..ff5e3b86f7 100644
--- a/xfa/fwl/basewidget/ifwl_checkbox.h
+++ b/xfa/fwl/basewidget/ifwl_checkbox.h
@@ -7,10 +7,10 @@
#ifndef XFA_FWL_BASEWIDGET_IFWL_CHECKBOX_H_
#define XFA_FWL_BASEWIDGET_IFWL_CHECKBOX_H_
-#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fwl/core/cfwl_event.h"
-#include "xfa/fwl/core/ifwl_dataprovider.h"
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/ifwl_dataprovider.h"
+#include "xfa/fwl/core/ifwl_widget.h"
#define FWL_CLASS_CheckBox L"FWL_CHECKBOX"
#define FWL_STYLEEXT_CKB_Left (0L << 0)
diff --git a/xfa/fwl/basewidget/ifwl_datetimepicker.h b/xfa/fwl/basewidget/ifwl_datetimepicker.h
index f592fc1abe..404ba48f14 100644
--- a/xfa/fwl/basewidget/ifwl_datetimepicker.h
+++ b/xfa/fwl/basewidget/ifwl_datetimepicker.h
@@ -7,10 +7,10 @@
#ifndef XFA_FWL_BASEWIDGET_IFWL_DATETIMEPICKER_H_
#define XFA_FWL_BASEWIDGET_IFWL_DATETIMEPICKER_H_
-#include "xfa/fwl/core/ifwl_widget.h"
-#include "xfa/fwl/core/ifwl_dataprovider.h"
#include "xfa/fwl/core/cfwl_event.h"
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/ifwl_dataprovider.h"
+#include "xfa/fwl/core/ifwl_widget.h"
#define FWL_CLASS_DateTimePicker L"FWL_DATETIMEPICKER"
#define FWL_STYLEEXT_DTP_AllowEdit (1L << 0)
diff --git a/xfa/fwl/basewidget/ifwl_listbox.h b/xfa/fwl/basewidget/ifwl_listbox.h
index 010a82f705..fde6a88978 100644
--- a/xfa/fwl/basewidget/ifwl_listbox.h
+++ b/xfa/fwl/basewidget/ifwl_listbox.h
@@ -7,10 +7,10 @@
#ifndef XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_
#define XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_
-#include "xfa/fwl/core/ifwl_widget.h"
-#include "xfa/fwl/core/ifwl_dataprovider.h"
#include "xfa/fwl/core/cfwl_event.h"
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/ifwl_dataprovider.h"
+#include "xfa/fwl/core/ifwl_widget.h"
#define FWL_CLASS_ListBox L"FWL_LISTBOX"
#define FWL_STYLEEXT_LTB_MultiSelection (1L << 0)
diff --git a/xfa/fwl/basewidget/ifwl_monthcalendar.h b/xfa/fwl/basewidget/ifwl_monthcalendar.h
index 40ea8cb09f..1ddebe977d 100644
--- a/xfa/fwl/basewidget/ifwl_monthcalendar.h
+++ b/xfa/fwl/basewidget/ifwl_monthcalendar.h
@@ -7,10 +7,10 @@
#ifndef XFA_FWL_BASEWIDGET_IFWL_MONTHCALENDAR_H_
#define XFA_FWL_BASEWIDGET_IFWL_MONTHCALENDAR_H_
-#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fwl/core/cfwl_event.h"
-#include "xfa/fwl/core/ifwl_dataprovider.h"
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/ifwl_dataprovider.h"
+#include "xfa/fwl/core/ifwl_widget.h"
#define FWL_CLASS_MonthCalendar L"FWL_MONTHCALENDAR"
#define FWL_STYLEEXT_MCD_MultiSelect (1L << 0)
diff --git a/xfa/fwl/basewidget/ifwl_picturebox.h b/xfa/fwl/basewidget/ifwl_picturebox.h
index 8ff4981e11..f40454a42d 100644
--- a/xfa/fwl/basewidget/ifwl_picturebox.h
+++ b/xfa/fwl/basewidget/ifwl_picturebox.h
@@ -7,11 +7,11 @@
#ifndef XFA_FWL_BASEWIDGET_IFWL_PICTUREBOX_H_
#define XFA_FWL_BASEWIDGET_IFWL_PICTUREBOX_H_
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/fwl_error.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_dataprovider.h"
#include "xfa/fwl/core/ifwl_widget.h"
-#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
-#include "xfa/fwl/core/fwl_error.h"
#define FWL_CLASS_PictureBox L"FWL_PICTUREBOX"
#define FWL_STYLEEXT_PTB_Left 0L << 0
diff --git a/xfa/fwl/basewidget/ifwl_pushbutton.h b/xfa/fwl/basewidget/ifwl_pushbutton.h
index aa8392d9db..bbac4811ac 100644
--- a/xfa/fwl/basewidget/ifwl_pushbutton.h
+++ b/xfa/fwl/basewidget/ifwl_pushbutton.h
@@ -7,9 +7,9 @@
#ifndef XFA_FWL_BASEWIDGET_IFWL_PUSHBUTTON_H_
#define XFA_FWL_BASEWIDGET_IFWL_PUSHBUTTON_H_
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_dataprovider.h"
-#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
#include "xfa/fwl/core/ifwl_widget.h"
#define FWL_CLASS_PushButton L"FWL_PUSHBUTTON"
diff --git a/xfa/fwl/basewidget/ifwl_scrollbar.h b/xfa/fwl/basewidget/ifwl_scrollbar.h
index bc5c722ca9..033cfe092b 100644
--- a/xfa/fwl/basewidget/ifwl_scrollbar.h
+++ b/xfa/fwl/basewidget/ifwl_scrollbar.h
@@ -7,12 +7,12 @@
#ifndef XFA_FWL_BASEWIDGET_IFWL_SCROLLBAR_H_
#define XFA_FWL_BASEWIDGET_IFWL_SCROLLBAR_H_
-#include "xfa/fwl/core/fwl_widgetimp.h"
-#include "xfa/fwl/core/ifwl_widget.h"
-#include "xfa/fwl/core/ifwl_dataprovider.h"
-#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
#include "core/fxcrt/include/fx_system.h"
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/ifwl_dataprovider.h"
+#include "xfa/fwl/core/ifwl_widget.h"
#define FWL_CLASS_ScrollBar L"FWL_SCROLLBAR"
#define FWL_STYLEEXT_SCB_Horz (0L << 0)
diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h
index 75bec50d8e..13eb9d31f4 100644
--- a/xfa/fwl/core/ifwl_form.h
+++ b/xfa/fwl/core/ifwl_form.h
@@ -7,10 +7,10 @@
#ifndef XFA_FWL_CORE_IFWL_FORM_H_
#define XFA_FWL_CORE_IFWL_FORM_H_
-#include "xfa/fwl/core/ifwl_dataprovider.h"
-#include "xfa/fwl/core/ifwl_widget.h"
#include "core/fxcrt/include/fx_system.h"
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/ifwl_dataprovider.h"
+#include "xfa/fwl/core/ifwl_widget.h"
#define FWL_CLASS_Form L"FWL_FORM"
#define FWL_CLASS_FormProxy L"FWL_FORMPROXY"
diff --git a/xfa/fwl/lightwidget/cfwl_widget.h b/xfa/fwl/lightwidget/cfwl_widget.h
index 80e278e161..c230ce200c 100644
--- a/xfa/fwl/lightwidget/cfwl_widget.h
+++ b/xfa/fwl/lightwidget/cfwl_widget.h
@@ -10,8 +10,8 @@
#include <memory>
#include "xfa/fwl/core/cfwl_event.h"
-#include "xfa/fwl/lightwidget/cfwl_widgetproperties.h"
#include "xfa/fwl/core/ifwl_widget.h"
+#include "xfa/fwl/lightwidget/cfwl_widgetproperties.h"
class CFWL_Event;
class CFWL_Message;
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h
index e6d09326c2..091ad7ddae 100644
--- a/xfa/fwl/theme/cfwl_widgettp.h
+++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -13,8 +13,8 @@
#include "core/fxcrt/include/fx_coordinates.h"
#include "core/fxcrt/include/fx_system.h"
#include "xfa/fwl/core/fwl_error.h"
-#include "xfa/fxgraphics/include/cfx_graphics.h"
#include "xfa/fwl/theme/cfwl_utils.h"
+#include "xfa/fxgraphics/include/cfx_graphics.h"
enum class CFWL_WidgetCapacity {
None = 0,
diff --git a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
index b2b87bc9a6..01873f0f04 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
@@ -23,12 +23,12 @@
#include "xfa/fxbarcode/BC_TwoDimWriter.h"
#include "xfa/fxbarcode/common/BC_CommonByteMatrix.h"
#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
+#include "xfa/fxbarcode/qrcode/BC_QRCodeWriter.h"
#include "xfa/fxbarcode/qrcode/BC_QRCoder.h"
#include "xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h"
#include "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
#include "xfa/fxbarcode/qrcode/BC_QRCoderMode.h"
#include "xfa/fxbarcode/qrcode/BC_QRCoderVersion.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCodeWriter.h"
CBC_QRCodeWriter::CBC_QRCodeWriter() {
m_bFixedSize = TRUE;
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index d5ffdee55e..e8de02d7bd 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -16,8 +16,8 @@
#include "core/fxge/include/cfx_pathdata.h"
#include "core/fxge/include/cfx_renderdevice.h"
#include "xfa/fxfa/app/xfa_textlayout.h"
-#include "xfa/fxfa/include/fxfa_widget.h"
#include "xfa/fxfa/include/cxfa_eventparam.h"
+#include "xfa/fxfa/include/fxfa_widget.h"
#include "xfa/fxfa/include/xfa_ffapp.h"
#include "xfa/fxfa/include/xfa_ffdoc.h"
#include "xfa/fxfa/include/xfa_ffdocview.h"
diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h
index 33dc345e30..30265de7e9 100644
--- a/xfa/fxfa/app/xfa_textlayout.h
+++ b/xfa/fxfa/app/xfa_textlayout.h
@@ -12,8 +12,8 @@
#include "xfa/fde/css/fde_css.h"
#include "xfa/fde/fde_gedevice.h"
-#include "xfa/fxfa/include/xfa_ffdoc.h"
#include "xfa/fgas/layout/fgas_rtfbreak.h"
+#include "xfa/fxfa/include/xfa_ffdoc.h"
#include "xfa/fxfa/parser/xfa_object.h"
#define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001