summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/xml/document_xslt.h
blob: 1b9fe11caf87b0f521f88f8b705bdfedae0649ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_XML_DOCUMENT_XSLT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_XML_DOCUMENT_XSLT_H_

#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/platform/heap/handle.h"

namespace blink {

class Document;
class ProcessingInstruction;

class DocumentXSLT final : public GarbageCollected<DocumentXSLT>,
                           public Supplement<Document> {
  USING_GARBAGE_COLLECTED_MIXIN(DocumentXSLT);

 public:
  static const char kSupplementName[];

  Document* TransformSourceDocument() {
    return transform_source_document_.Get();
  }

  void SetTransformSourceDocument(Document* document) {
    DCHECK(document);
    transform_source_document_ = document;
  }

  static DocumentXSLT& From(Document&);

  // The following static methods don't use any instance of DocumentXSLT.
  // They are just using DocumentXSLT namespace.
  static void ApplyXSLTransform(Document&, ProcessingInstruction*);
  static ProcessingInstruction* FindXSLStyleSheet(Document&);
  static bool ProcessingInstructionInsertedIntoDocument(Document&,
                                                        ProcessingInstruction*);
  static bool ProcessingInstructionRemovedFromDocument(Document&,
                                                       ProcessingInstruction*);
  static bool SheetLoaded(Document&, ProcessingInstruction*);
  static bool HasTransformSourceDocument(Document&);

  explicit DocumentXSLT(Document&);
  void Trace(Visitor*) override;

 private:
  Member<Document> transform_source_document_;
  DISALLOW_COPY_AND_ASSIGN(DocumentXSLT);
};

}  // namespace blink

#endif