• manuk's avatar
    [chrome:omnibox] Refactor table cell rendering. · a4207c78
    manuk authored
    Previously, we used 6 satic methods to render each type of table cell:
    3) renderBooleanProperty_
    5) renderKeyValueTuples_
    2) renderJsonProperty_
    4) renderLinkProperty_
    1) renderTextProperty_
    
    This CL replaces those static methods with classes:
    1) OutputBooleanProperty
    2) OutputKeyValueTuplesProperty
    3) OutputJsonProperty
    4) OutputLinkProperty
    5) OutputTextProperty
    
    This refactor serves two purposes:
    
    1) By having an object own the rendered HTML instead of directly injecting it into the DOM, we can later reference and manipulate these cells. E.g.:
      - When filtering, currently, we highlight entire rows if any of the cells contain a match. This change allows highlight the specific cells which matched.
      - Currently, when the user toggles `show details`, we must re-render the entire table, because we have no way of retrieving cells and toggling their visibility after we render them. This change allows toggling cell visibility after they've been added to the DOM, and, therefore, avoiding the re-rendering.
    
    2) Supporting more intensive cells without relying on a network of static helper functions.
      - Currently, JSON content is stringified and displayed as text. This change allows more elegant, colored, tabular display of JSON property.
      - Currently, boolean cells have values true & false, making it hard to search for a specific column value. This would change allows filtering; e.g. 'is bookmarked'.
      - Currently, our cells contain mostly single text values. This change makes it easier to display multiple properties, images, and other formatted content in cells.
    
    Bug: 891303
    Change-Id: I89d75798943e135cda53a898a4b8c1f26dd869a1
    Reviewed-on: https://chromium-review.googlesource.com/c/1354308
    Commit-Queue: manuk hovanesian <manukh@chromium.org>
    Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#612378}
    a4207c78
omnibox_output.js 23.9 KB