| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 class HTMLTableSectionElement; | 33 class HTMLTableSectionElement; |
| 34 class HTMLToken; | 34 class HTMLToken; |
| 35 | 35 |
| 36 class HTMLViewSourceDocument final : public HTMLDocument { | 36 class HTMLViewSourceDocument final : public HTMLDocument { |
| 37 public: | 37 public: |
| 38 enum SourceAnnotation { | 38 enum SourceAnnotation { |
| 39 AnnotateSourceAsSafe, | 39 AnnotateSourceAsSafe, |
| 40 AnnotateSourceAsXSS | 40 AnnotateSourceAsXSS |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 static PassRefPtrWillBeRawPtr<HTMLViewSourceDocument> create(const DocumentI
nit& initializer, const String& mimeType) | 43 static RawPtr<HTMLViewSourceDocument> create(const DocumentInit& initializer
, const String& mimeType) |
| 44 { | 44 { |
| 45 return adoptRefWillBeNoop(new HTMLViewSourceDocument(initializer, mimeTy
pe)); | 45 return new HTMLViewSourceDocument(initializer, mimeType); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void addSource(const String&, HTMLToken&, SourceAnnotation); | 48 void addSource(const String&, HTMLToken&, SourceAnnotation); |
| 49 | 49 |
| 50 #if !ENABLE(OILPAN) | 50 #if !ENABLE(OILPAN) |
| 51 void dispose() override; | 51 void dispose() override; |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 DECLARE_VIRTUAL_TRACE(); | 54 DECLARE_VIRTUAL_TRACE(); |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 HTMLViewSourceDocument(const DocumentInit&, const String& mimeType); | 57 HTMLViewSourceDocument(const DocumentInit&, const String& mimeType); |
| 58 | 58 |
| 59 PassRefPtrWillBeRawPtr<DocumentParser> createParser() override; | 59 RawPtr<DocumentParser> createParser() override; |
| 60 | 60 |
| 61 void processDoctypeToken(const String& source, HTMLToken&); | 61 void processDoctypeToken(const String& source, HTMLToken&); |
| 62 void processEndOfFileToken(const String& source, HTMLToken&); | 62 void processEndOfFileToken(const String& source, HTMLToken&); |
| 63 void processTagToken(const String& source, HTMLToken&, SourceAnnotation); | 63 void processTagToken(const String& source, HTMLToken&, SourceAnnotation); |
| 64 void processCommentToken(const String& source, HTMLToken&); | 64 void processCommentToken(const String& source, HTMLToken&); |
| 65 void processCharacterToken(const String& source, HTMLToken&, SourceAnnotatio
n); | 65 void processCharacterToken(const String& source, HTMLToken&, SourceAnnotatio
n); |
| 66 | 66 |
| 67 void createContainingTable(); | 67 void createContainingTable(); |
| 68 PassRefPtrWillBeRawPtr<Element> addSpanWithClassName(const AtomicString&); | 68 RawPtr<Element> addSpanWithClassName(const AtomicString&); |
| 69 void addLine(const AtomicString& className); | 69 void addLine(const AtomicString& className); |
| 70 void finishLine(); | 70 void finishLine(); |
| 71 void addText(const String& text, const AtomicString& className, SourceAnnota
tion = AnnotateSourceAsSafe); | 71 void addText(const String& text, const AtomicString& className, SourceAnnota
tion = AnnotateSourceAsSafe); |
| 72 int addRange(const String& source, int start, int end, const AtomicString& c
lassName, bool isLink = false, bool isAnchor = false, const AtomicString& link =
nullAtom); | 72 int addRange(const String& source, int start, int end, const AtomicString& c
lassName, bool isLink = false, bool isAnchor = false, const AtomicString& link =
nullAtom); |
| 73 void maybeAddSpanForAnnotation(SourceAnnotation); | 73 void maybeAddSpanForAnnotation(SourceAnnotation); |
| 74 | 74 |
| 75 PassRefPtrWillBeRawPtr<Element> addLink(const AtomicString& url, bool isAnch
or); | 75 RawPtr<Element> addLink(const AtomicString& url, bool isAnchor); |
| 76 PassRefPtrWillBeRawPtr<Element> addBase(const AtomicString& href); | 76 RawPtr<Element> addBase(const AtomicString& href); |
| 77 | 77 |
| 78 String m_type; | 78 String m_type; |
| 79 RefPtrWillBeMember<Element> m_current; | 79 Member<Element> m_current; |
| 80 RefPtrWillBeMember<HTMLTableSectionElement> m_tbody; | 80 Member<HTMLTableSectionElement> m_tbody; |
| 81 RefPtrWillBeMember<HTMLTableCellElement> m_td; | 81 Member<HTMLTableCellElement> m_td; |
| 82 int m_lineNumber; | 82 int m_lineNumber; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 } // namespace blink | 85 } // namespace blink |
| 86 | 86 |
| 87 #endif // HTMLViewSourceDocument_h | 87 #endif // HTMLViewSourceDocument_h |
| OLD | NEW |