Update clang-format rules
Summary: Spent a couple hours customizing the clang-format rules to better match the desired code style. Reviewed By: IanChilds Differential Revision: D3714510 fbshipit-source-id: f6d0436346416aab023aacbedd70ea189e583e8d
This commit is contained in:
committed by
Facebook Github Bot 6
parent
6a44dbc43b
commit
7a1e353404
File diff suppressed because it is too large
Load Diff
@@ -11,9 +11,9 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <stdbool.h>
|
||||
@@ -113,8 +113,11 @@ typedef struct CSSSize {
|
||||
} CSSSize;
|
||||
|
||||
typedef struct CSSNode *CSSNodeRef;
|
||||
typedef CSSSize (*CSSMeasureFunc)(
|
||||
void *context, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode);
|
||||
typedef CSSSize (*CSSMeasureFunc)(void *context,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode);
|
||||
typedef void (*CSSPrintFunc)(void *context);
|
||||
|
||||
// CSSNode
|
||||
@@ -127,8 +130,10 @@ void CSSNodeRemoveChild(CSSNodeRef node, CSSNodeRef child);
|
||||
CSSNodeRef CSSNodeGetChild(CSSNodeRef node, uint32_t index);
|
||||
uint32_t CSSNodeChildCount(CSSNodeRef node);
|
||||
|
||||
void CSSNodeCalculateLayout(
|
||||
CSSNodeRef node, float availableWidth, float availableHeight, CSSDirection parentDirection);
|
||||
void CSSNodeCalculateLayout(CSSNodeRef node,
|
||||
float availableWidth,
|
||||
float availableHeight,
|
||||
CSSDirection parentDirection);
|
||||
|
||||
// Mark a node as dirty. Only valid for nodes with a custom measure function
|
||||
// set.
|
||||
|
@@ -32,7 +32,9 @@ void CSSNodeListFree(CSSNodeListRef list) {
|
||||
free(list);
|
||||
}
|
||||
|
||||
uint32_t CSSNodeListCount(CSSNodeListRef list) { return list->count; }
|
||||
uint32_t CSSNodeListCount(CSSNodeListRef list) {
|
||||
return list->count;
|
||||
}
|
||||
|
||||
void CSSNodeListAdd(CSSNodeListRef list, CSSNodeRef node) {
|
||||
CSSNodeListInsert(list, node, list->count);
|
||||
@@ -76,4 +78,6 @@ CSSNodeRef CSSNodeListDelete(CSSNodeListRef list, CSSNodeRef node) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CSSNodeRef CSSNodeListGet(CSSNodeListRef list, uint32_t index) { return list->items[index]; }
|
||||
CSSNodeRef CSSNodeListGet(CSSNodeListRef list, uint32_t index) {
|
||||
return list->items[index];
|
||||
}
|
||||
|
@@ -10,9 +10,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <CSSLayout/CSSLayout.h>
|
||||
#include <CSSLayout/CSSMacros.h>
|
||||
|
@@ -9,12 +9,16 @@
|
||||
|
||||
#include "CSSBenchmark.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <CSSLayout/CSSLayout.h>
|
||||
#include <time.h>
|
||||
|
||||
// Measure functions can be quite slow, for example when measuring text.
|
||||
// Simulate this by sleeping for 1 millisecond.
|
||||
static CSSSize _measure(void *context, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode) {
|
||||
static CSSSize _measure(void *context,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode) {
|
||||
struct timespec sleeptime = {0, 1000000};
|
||||
nanosleep(&sleeptime, NULL);
|
||||
return (CSSSize){
|
||||
|
@@ -10,9 +10,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#define NUM_REPETITIONS 100
|
||||
@@ -33,7 +33,6 @@
|
||||
} \
|
||||
__printBenchmarkResult(NAME, __start, __endTimes);
|
||||
|
||||
|
||||
int __compareDoubles(const void *a, const void *b) {
|
||||
double arg1 = *(const double *) a;
|
||||
double arg2 = *(const double *) b;
|
||||
|
26
format.sh
26
format.sh
@@ -2,11 +2,29 @@
|
||||
|
||||
clang-format \
|
||||
-style="{ \
|
||||
BasedOnStyle: WebKit, \
|
||||
IndentWidth: 2, \
|
||||
ColumnLimit: 100, \
|
||||
BreakBeforeBraces: Attach, \
|
||||
AlignEscapedNewlinesLeft: true, \
|
||||
AlignOperands: true, \
|
||||
AllowAllParametersOfDeclarationOnNextLine: false, \
|
||||
AllowShortBlocksOnASingleLine: false, \
|
||||
AllowShortCaseLabelsOnASingleLine: true, \
|
||||
AllowShortFunctionsOnASingleLine: false, \
|
||||
AllowShortIfStatementsOnASingleLine: false, \
|
||||
AllowShortLoopsOnASingleLine: false, \
|
||||
BinPackArguments: false, \
|
||||
BinPackParameters: false, \
|
||||
BreakBeforeBraces: Attach, \
|
||||
ColumnLimit: 100, \
|
||||
ContinuationIndentWidth: 4, \
|
||||
IndentCaseLabels: true, \
|
||||
IndentWidth: 2, \
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false, \
|
||||
Language: Cpp, \
|
||||
PenaltyBreakBeforeFirstCallParameter: 100, \
|
||||
PenaltyBreakString: 100, \
|
||||
PenaltyExcessCharacter: 100, \
|
||||
PointerAlignment: Right, \
|
||||
SortIncludes: true, \
|
||||
SpaceAfterCStyleCast: true, \
|
||||
UseTab: Never, \
|
||||
}" "$@" \
|
||||
-i ./**/*.{h,c,cpp}
|
||||
|
@@ -5315,8 +5315,8 @@ TEST(CSSLayoutTest, test_should_layout_absolute_node_top_with_right_width_and_no
|
||||
ASSERT_TRUE(test(root_node, root_layout));
|
||||
}
|
||||
|
||||
TEST(
|
||||
CSSLayoutTest, test_should_layout_absolute_node_left_with_right_width_and_no_parent_dimension) {
|
||||
TEST(CSSLayoutTest,
|
||||
test_should_layout_absolute_node_left_with_right_width_and_no_parent_dimension) {
|
||||
CSSNode *root_node = new_test_css_node();
|
||||
{
|
||||
CSSNode *node_0 = root_node;
|
||||
@@ -5421,8 +5421,8 @@ TEST(CSSLayoutTest,
|
||||
ASSERT_TRUE(test(root_node, root_layout));
|
||||
}
|
||||
|
||||
TEST(
|
||||
CSSLayoutTest, test_should_layout_node_with_margin_top_inside_justifyContent_center_container) {
|
||||
TEST(CSSLayoutTest,
|
||||
test_should_layout_node_with_margin_top_inside_justifyContent_center_container) {
|
||||
CSSNode *root_node = new_test_css_node();
|
||||
{
|
||||
CSSNode *node_0 = root_node;
|
||||
@@ -8170,8 +8170,8 @@ TEST(CSSLayoutTest, test_should_shrink_column_node_when_there_is_no_space_left_o
|
||||
ASSERT_TRUE(test(root_node, root_layout));
|
||||
}
|
||||
|
||||
TEST(
|
||||
CSSLayoutTest, test_should_not_shrink_column_node_with_siblings_when_there_is_space_left_over) {
|
||||
TEST(CSSLayoutTest,
|
||||
test_should_not_shrink_column_node_with_siblings_when_there_is_space_left_over) {
|
||||
CSSNode *root_node = new_test_css_node();
|
||||
{
|
||||
CSSNode *node_0 = root_node;
|
||||
@@ -8307,7 +8307,8 @@ TEST(CSSLayoutTest, test_should_shrink_column_node_with_siblings_when_there_is_n
|
||||
ASSERT_TRUE(test(root_node, root_layout));
|
||||
}
|
||||
|
||||
TEST(CSSLayoutTest,
|
||||
TEST(
|
||||
CSSLayoutTest,
|
||||
test_should_shrink_column_nodes_proporional_to_their_main_size_when_there_is_no_space_left_over) {
|
||||
CSSNode *root_node = new_test_css_node();
|
||||
{
|
||||
|
Reference in New Issue
Block a user