File: html_documentimpl.h

package info (click to toggle)
khtml 5.54.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,940 kB
  • sloc: cpp: 206,281; java: 4,060; ansic: 2,829; perl: 2,313; yacc: 1,497; python: 339; sh: 141; xml: 37; makefile: 7
file content (129 lines) | stat: -rw-r--r-- 3,419 bytes parent folder | download | duplicates (5)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * This file is part of the DOM implementation for KDE.
 *
 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

#ifndef HTML_DOCUMENTIMPL_H
#define HTML_DOCUMENTIMPL_H

#include "xml/dom_docimpl.h"
#include "html/html_miscimpl.h"

#include <QMap>

class KHTMLView;
class QString;

namespace DOM
{

class Element;
class HTMLElement;
class HTMLElementImpl;
class DOMString;
class HTMLMapElementImpl;

class HTMLDocumentImpl : public DOM::DocumentImpl
{
    Q_OBJECT
public:
    HTMLDocumentImpl(KHTMLView *v = nullptr);
    ~HTMLDocumentImpl();

    bool isHTMLDocument() const override
    {
        return true;
    }

    DOMString referrer() const;
    DOMString lastModified() const;
    DOMString cookie() const;
    void setCookie(const DOMString &);
    NodeListImpl *getElementsByName(const DOMString &elementName);

    HTMLCollectionImpl *images();
    HTMLCollectionImpl *applets();
    HTMLCollectionImpl *links();
    HTMLCollectionImpl *forms();
    HTMLCollectionImpl *layers();
    HTMLCollectionImpl *anchors();
    HTMLCollectionImpl *all();
    HTMLCollectionImpl *scripts();

    void setBody(HTMLElementImpl *_body, int &exceptioncode);

    khtml::Tokenizer *createTokenizer() override;

    bool childAllowed(NodeImpl *newChild) override;

    ElementImpl *createElement(const DOMString &tagName, int *pExceptioncode) override;

    // HTML5
    ElementImpl *activeElement() const;

    HTMLMapElementImpl *getMap(const DOMString &url_);

    void determineParseMode() override;
    void close() override;
    void contentLoaded() override;

    void setAutoFill()
    {
        m_doAutoFill = true;
    }

    // If true, HTML was requested by mimetype (e.g. HTTP Content-Type). Otherwise XHTML was requested.
    // This is independent of the actual doctype, of course. (#86446)
    void setHTMLRequested(bool html)
    {
        m_htmlRequested = html;
    }

    // Change parse and html modes
    void changeModes(ParseMode newPMode, HTMLMode newHMode);

protected:
    HTMLElementImpl *htmlElement;
    friend class HTMLMapElementImpl;
    friend class HTMLImageElementImpl;
    QMap<QString, HTMLMapElementImpl *> mapMap;
    bool m_doAutoFill;
    bool m_htmlRequested;
    bool m_determineParseMode;

protected Q_SLOTS:
    /**
     * Repaints, so that all links get the proper color
     */
    void slotHistoryChanged();
};

// Used to display text in iframes
class HTMLTextDocumentImpl: public HTMLDocumentImpl
{
public:
    HTMLTextDocumentImpl(KHTMLView *v = nullptr);
    khtml::Tokenizer *createTokenizer() override;
};

} //namespace

#endif