• Hikaru Nishida's avatar
    Introduce ConvertFromWebSelectionBoundType() to refactor · 0108cbbc
    Hikaru Nishida authored
    ConvertFromWebSelectionBound()
    
    Before this patch, cc_bound.type is computed using is_start and
    web_bound.is_text_direction_rtl. This is redundant because
    WebSelectionBound has .type which is computed in the same way in
    GetWebSelectionBound() at WebSelection.cpp. is_start and
    is_text_direction_rtl is exactly the same value used in both functions
    so we can convert kSelectionLeft to LEFT, kSelectionRight to RIGHT
    and kCaret to CENTER (default value).
    Therefore, we can introduce ConvertFromWebSelectionBoundType()
    which directly converts from blink::WebSelectionBound::Type to
    gfx::SelectionBound::Type and refactor ConvertFromWebSelectionBound()
    with it.
    This patch also renames ConvertWebSelectionBound() to
    ConvertFromWebSelectionBound() to clarify what type is input.
    
    See also: crrev.com/c/934106
    
    TEST: No change in behavior.
    
    Change-Id: I3cbc4af607438841be6e2b47e10d12deaa273aa3
    Reviewed-on: https://chromium-review.googlesource.com/942585Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
    Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
    Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
    Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
    Commit-Queue: Hikaru Nishida <hikarun@google.com>
    Cr-Commit-Position: refs/heads/master@{#543967}
    0108cbbc
render_widget_compositor.cc 50.7 KB