private void RewriteStyleTags(ResponseAnalysisContext context, string html) { foreach (var index in FastHtmlParser.FindAllTagIndexes(html, "style")) { // get content var inner = FastHtmlParser.GetInnerHtml(html, index, "style"); if (inner == null) { continue; } // compute hash var inline = ContentHashCache.GetOrAdd(inner.Value.Trim().TrimHtmlCdata().Trim().Value, v => CreateContent(v)); InlineContentService.TryAddStyleByHash(inline.Hash, inline.Content); // add change var tagSpan = FastHtmlParser.GetFullTagSpan(html, index, "style"); context.AddChange(TextChange.Replace(html, index, tagSpan.Value.Length, inline.Tag)); } }