third_party/blink/renderer/build/scripts/core/css/make_css_value_id_mappings.py
def _find_enum_longest_continuous_segment(property_,
                                          name_to_position_dictionary):
    """Find the longest continuous segment in the list of keywords
    Finding the continuous segment will allows us to do the subtraction
    between keywords so that the distance between 2 keywords in this
    enum is equal to the distance of corresponding keywords in another
    enum.

    Step 1:
        Convert keyword enums into number.
        Sort and find all continuous segment in the list of enums.

    Step 2:
        Get the longest segment.

    Step 3:
        Compose a list of keyword enums and their respective numbers
        in the sorted order.

    Step 4:
        Build the switch case statements of other enums not in the
        segment. Enums in the segment will be computed in default clause.
    """
    property_enum_order = range(len(property_['keywords']))
    css_enum_order = [
        name_to_position_dictionary[x] for x in property_['keywords']
    ]
    enum_pair_list = zip(css_enum_order, property_enum_order)
    enum_segment, enum_pair_list = _find_continuous_segment(enum_pair_list)
    longest_segment = _find_largest_segment(enum_segment)

    enum_tuple_list = []
    for x in enum_pair_list:
        keyword = NameStyleConverter(property_['keywords'][x[1]])
        enum_tuple_list.append((enum_key_for_css_keyword(keyword), x[1], x[0]))
    return enum_tuple_list, enum_segment, longest_segment
Find the longest continuous segment in the list of keywords
    Finding the continuous segment will allows us to do the subtraction
    between keywords so that the distance between 2 keywords in this
    enum is equal to the distance of corresponding keywords in another
    enum.

    Step 1:
        Convert keyword enums into number.
        Sort and find all continuous segment in the list of enums.

    Step 2:
        Get the longest segment.

    Step 3:
        Compose a list of keyword enums and their respective numbers
        in the sorted order.

    Step 4:
        Build the switch case statements of other enums not in the
        segment. Enums in the segment will be computed in default clause.
    
Find the longest continuous segment in the list of keywords
Finding the continuous segment will allows us to do the subtraction
between keywords so that the distance between 2 keywords in this
enum is equal to the distance of corresponding keywords in another
enum.

Step 1:
Convert keyword enums into number.
Sort and find all continuous segment in the list of enums.

Step 2:
Get the longest segment.

Step 3:
Compose a list of keyword enums and their respective numbers
in the sorted order.

Step 4:
Build the switch case statements of other enums not in the
segment. Enums in the segment will be computed in default clause.
Find the longest continuous segment in the list of keywords Finding the continuous segment will allows us to do the subtraction between keywords so that the distance between 2 keywords in this enum is equal to the distance of corresponding keywords in another enum . Step 1 : Convert keyword enums into number . Sort and find all continuous segment in the list of enums . Step 2 : Get the longest segment . Step 3 : Compose a list of keyword enums and their respective numbers in the sorted order . Step 4 : Build the switch case statements of other enums not in the segment . Enums in the segment will be computed in default clause .
def _find_enum_longest_continuous_segment(property_,
                                          name_to_position_dictionary):
    property_enum_order = range(len(property_['keywords']))
    css_enum_order = [
        name_to_position_dictionary[x] for x in property_['keywords']
    ]
    enum_pair_list = zip(css_enum_order, property_enum_order)
    enum_segment, enum_pair_list = _find_continuous_segment(enum_pair_list)
    longest_segment = _find_largest_segment(enum_segment)
    enum_tuple_list = []
    for x in enum_pair_list:
        keyword = NameStyleConverter(property_['keywords'][x[1]])
        enum_tuple_list.append((enum_key_for_css_keyword(keyword), x[1], x[0]))
    return enum_tuple_list, enum_segment, longest_segment
def _find_enum_longest_continuous_segment ( property_ , name_to_position_dictionary ) : property_enum_order = range ( len ( property_ [ 'keywords' ] ) ) css_enum_order = [ name_to_position_dictionary [ x ] for x in property_ [ 'keywords' ] ] enum_pair_list = zip ( css_enum_order , property_enum_order ) enum_segment , enum_pair_list = _find_continuous_segment ( enum_pair_list ) longest_segment = _find_largest_segment ( enum_segment ) enum_tuple_list = [ ] for x in enum_pair_list : keyword = NameStyleConverter ( property_ [ 'keywords' ] [ x [ 1 ] ] ) enum_tuple_list . append ( ( enum_key_for_css_keyword ( keyword ) , x [ 1 ] , x [ 0 ] ) ) return enum_tuple_list , enum_segment , longest_segment
Find the longest continuous segment in the list of keywords
Finding the continuous segment will allows us to do the subtraction
between keywords so that the distance between 2 keywords in this
enum is equal to the distance of corresponding keywords in another
enum.
Find the longest continuous segment in the list of keywords Finding the continuous segment will allows us to do the subtraction between keywords so that the distance between 2 keywords in this enum is equal to the distance of corresponding keywords in another enum .
"""Find the longest continuous segment in the list of keywords
    Finding the continuous segment will allows us to do the subtraction
    between keywords so that the distance between 2 keywords in this
    enum is equal to the distance of corresponding keywords in another
    enum.

    Step 1:
        Convert keyword enums into number.
        Sort and find all continuous segment in the list of enums.

    Step 2:
        Get the longest segment.

    Step 3:
        Compose a list of keyword enums and their respective numbers
        in the sorted order.

    Step 4:
        Build the switch case statements of other enums not in the
        segment. Enums in the segment will be computed in default clause.
    """
property_
name_to_position_dictionary