Exemple #1
0
        internal static StyleSheetRequestProcessor Create(HtmlLinkElement element)
        {
            var document = element.Owner;
            var loader   = document.Loader;

            return(loader != null ? new StyleSheetRequestProcessor(element, document, loader) : null);
        }
Exemple #2
0
 private StyleSheetRequestProcessor(HtmlLinkElement link, Document document, IResourceLoader loader)
     : base(loader)
 {
     _link     = link;
     _document = document;
     _loader   = loader;
 }
        JsString resetLinkAndReturnURL(HtmlLinkElement link)
        {
            //reset it and let the browser handle it now, we have the url we need
            //we will grab it next. So long as we are caching files, it will be retrieved synchronoulsy from the cache
            link.rel = "stylesheet";

            return(link.href);
        }
Exemple #4
0
 private void investigateLinkElement(HtmlLinkElement element)
 {
     if (styleExtensionManager.parsingNeeded(element))
     {
         styleExtensionManager.parseAndReleaseLinkElement(element);
         //we must rebuild our stylemanager cache if we find a style sheet in this walk. Do so from our entryElement
         extensionsToBeApplied = styleExtensionManager.getExtensionsForFragment(entryElement);
     }
 }
        /// <summary>
        /// Creates an LinkRel provider for the provided element.
        /// </summary>
        /// <param name="link">The link element.</param>
        /// <param name="rel">The current value of the rel attribute.</param>
        /// <returns>The LinkRel provider instance or null.</returns>
        public BaseLinkRelation Create(HtmlLinkElement link, String rel)
        {
            var creator = default(Creator);

            if (rel != null && creators.TryGetValue(rel, out creator))
            {
                return(creator(link));
            }

            return(default(BaseLinkRelation));
        }
        public static void RelList()
        {
            var doc    = DomImplementation.Instance.CreateHtmlDocument();
            var anchor = new HtmlLinkElement(doc);

            Assert.AreEqual(0, anchor.RelList.Count);
            anchor.Rel = "hello world";
            Assert.AreEqual(new[] { "hello", "world" }, anchor.RelList);
            anchor.RelList.Remove("hello");
            Assert.AreEqual("world", anchor.Rel);
        }
Exemple #7
0
 public StyleSheetLinkRelation(HtmlLinkElement link)
     : base(link)
 {
 }
 private StyleSheetRequestProcessor(HtmlLinkElement link, IConfiguration options, IResourceLoader loader)
     : base(loader)
 {
     _link    = link;
     _options = options;
 }
 public ImportLinkRelation(HtmlLinkElement link)
     : base(link, DocumentRequestProcessor.Create(link))
 {
 }
 public StyleSheetLinkRelation(HtmlLinkElement link)
     : base(link, StyleSheetRequestProcessor.Create(link))
 {
 }
 public BaseLinkRelation(HtmlLinkElement link)
 {
     _link = link;
 }
 public void parseAndReleaseLinkElement(HtmlLinkElement element)
 {
     resolveSheet(resetLinkAndReturnURL(element));
 }
        //TODO consider moving this somewhere more appropriate

        /*
         * public StyleExtensionMapEntry getMergedEntryForElement(HtmlElement element) {
         *  JsString cssClassList = element.getAttribute("class");
         *  StyleExtensionMapEntry mergedEntry = null;
         *
         *  if (cssClassList != null) {
         *      var cssClassArray = cssClassList.split(" ");
         *      for (int i = 0; i < cssClassArray.length; i++) {
         *          var cssClass = cssClassArray[i].As<JsString>();
         *          var extensionMapEntry = map.getExtensionEntry(cssClass);
         *
         *          if (extensionMapEntry != null) {
         *              if (mergedEntry == null) {
         *                  //Waiting as long as we can to instantiate
         *                  mergedEntry = new StyleExtensionMapEntry();
         *              }
         *
         *              extensionMapEntry.mergeTo(mergedEntry);
         *          }
         *      }
         *  }
         *
         *  return mergedEntry;
         * }*/

        public bool parsingNeeded(HtmlLinkElement link)
        {
            return(link.rel == "stylesheet/randori");
        }
Exemple #14
0
 public BaseLinkRelation(HtmlLinkElement link, IRequestProcessor processor)
 {
     _link      = link;
     _processor = processor;
 }
 public void SetUp()
 {
     _document = new HtmlDocument();
     _link     = (HtmlLinkElement)_document.CreateElement("link");
 }
Exemple #16
0
 public ImportLinkRelation(HtmlLinkElement link)
     : base(link)
 {
 }
 private StyleSheetRequestProcessor(HtmlLinkElement link, IBrowsingContext context, IResourceLoader loader)
     : base(loader)
 {
     _link    = link;
     _context = context;
 }