• Manish Jethani's avatar
    Inject and remove style sheets by key · 9a107b93
    Manish Jethani authored
    This is the first in a series of patches to implement tabs.removeCSS
    
    A style sheet injected with tabs.insertCSS will have an internal
    autogenerated "key" that will be passed to StyleEngine. In the case of
    files, this will likely be just the fully qualified name of the file,
    whereas in the case of code it could be the code string itself or a hash
    digest of the code string. In either case, a call to tabs.removeCSS with
    the same options will deterministically generate the same internal key,
    thus enabling the removal of a previously injected style sheet without
    the explicit use of IDs and such.
    
    This patch lays the groundwork in StyleEngine that will enable us to
    implement behavior similar to that observed in Firefox 57.0.
    
    Changes:
    
     1.  WebStyleSheetId is now WebStyleSheetKey (WebString)
     2.  WebDocument::InsertStyleSheet now accepts an optional key as a
         parameter
     3.  StyleEngine::InjectSheet and StyleEngine::RemoveInjectedSheet now
         take StyleSheetKey (AtomicString) instead of WebStyleSheetId
     4.  Both WebDocument::RemoveInsertedStyleSheet and
         StyleEngine::RemoveInjectedSheet now take the CSS origin as a
         parameter
     5.  StyleEngine::RemoveInjectedSheet now removes only the last style
         sheet injected with the given key and only from the specified
         CSS origin
    
    BUG=608854
    
    Change-Id: Ie62bfcb0d8309b18cbf0d2cd119c74908e396767
    Reviewed-on: https://chromium-review.googlesource.com/877663Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
    Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
    Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
    Commit-Queue: Manish Jethani <m.jethani@eyeo.com>
    Cr-Commit-Position: refs/heads/master@{#537281}
    9a107b93
WebDocument.h 5.49 KB