18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
28e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
38e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *           (C) 1999 Antti Koivisto (koivisto@kde.org)
48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This library is free software; you can redistribute it and/or
78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modify it under the terms of the GNU Library General Public
88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * License as published by the Free Software Foundation; either
98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * version 2 of the License, or (at your option) any later version.
108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This library is distributed in the hope that it will be useful,
128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * but WITHOUT ANY WARRANTY; without even the implied warranty of
138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Library General Public License for more details.
158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * You should have received a copy of the GNU Library General Public License
178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * along with this library; see the file COPYING.LIB.  If not, write to
188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Boston, MA 02110-1301, USA.
208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Portions are Copyright (C) 2002 Netscape Communications Corporation.
228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Other contributors: David Baron <dbaron@fas.harvard.edu>
238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This library is free software; you can redistribute it and/or
258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modify it under the terms of the GNU Lesser General Public
268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * License as published by the Free Software Foundation; either
278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * version 2.1 of the License, or (at your option) any later version.
288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This library is distributed in the hope that it will be useful,
308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * but WITHOUT ANY WARRANTY; without even the implied warranty of
318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Lesser General Public License for more details.
338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * You should have received a copy of the GNU Lesser General Public
358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * License along with this library; if not, write to the Free Software
368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Alternatively, the document type parsing portions of this file may be used
398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * under the terms of either the Mozilla Public License Version 1.1, found at
408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (the "GPL"), in which case the provisions of the MPL or the GPL are
438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * applicable instead of those above.  If you wish to allow use of your
448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * version of this file only under the terms of one of those two
458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * licenses (the MPL or the GPL) and not to allow others to use your
468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * version of this file under the LGPL, indicate your decision by
478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * deleting the provisions above and replace them with the notice and
488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * other provisions required by the MPL or the GPL, as the case may be.
498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * If you do not delete the provisions above, a recipient may use your
508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * version of this file under any of the LGPL, the MPL or the GPL.
518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */
528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "config.h"
548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "HTMLDocument.h"
558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "CSSPropertyNames.h"
578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "CSSStyleSelector.h"
588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "CookieJar.h"
598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "DocumentLoader.h"
608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "DocumentType.h"
618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "ExceptionCode.h"
628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "FocusController.h"
638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "Frame.h"
648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "FrameLoader.h"
658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "FrameTree.h"
668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "FrameView.h"
67bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen#include "HashTools.h"
6806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen#include "HTMLDocumentParser.h"
698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "HTMLBodyElement.h"
708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "HTMLElementFactory.h"
718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "HTMLNames.h"
722fc2651226baac27029e38c9d6ef883fa32084dbSteve Block#include "InspectorInstrumentation.h"
738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "KURL.h"
748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "Page.h"
75e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block#include "Settings.h"
76dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#include <wtf/text/CString.h>
778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectnamespace WebCore {
798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectusing namespace HTMLNames;
818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
822fc2651226baac27029e38c9d6ef883fa32084dbSteve BlockHTMLDocument::HTMLDocument(Frame* frame, const KURL& url)
832fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    : Document(frame, url, false, true)
848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    clearXMLVersion();
868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectHTMLDocument::~HTMLDocument()
898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectint HTMLDocument::width()
938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    updateLayoutIgnorePendingStylesheets();
958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    FrameView* frameView = view();
968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    return frameView ? frameView->contentsWidth() : 0;
978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectint HTMLDocument::height()
1008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
1018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    updateLayoutIgnorePendingStylesheets();
1028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    FrameView* frameView = view();
1038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    return frameView ? frameView->contentsHeight() : 0;
1048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
1058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectString HTMLDocument::dir()
1078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
1088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLElement* b = body();
1098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (!b)
1108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        return String();
111231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    return b->getAttribute(dirAttr);
1128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
1138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::setDir(const String& value)
1158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
1168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLElement* b = body();
1178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (b)
118231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        b->setAttribute(dirAttr, value);
1198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
1208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectString HTMLDocument::designMode() const
1228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
1238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    return inDesignMode() ? "on" : "off";
1248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
1258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::setDesignMode(const String& value)
1278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
1288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    InheritedBool mode;
1298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (equalIgnoringCase(value, "on"))
1308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        mode = on;
1318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    else if (equalIgnoringCase(value, "off"))
1328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        mode = off;
1338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    else
1348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        mode = inherit;
1358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    Document::setDesignMode(mode);
1368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
1378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectElement* HTMLDocument::activeElement()
1398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
1408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (Node* node = focusedNode())
1418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        if (node->isElementNode())
1428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project            return static_cast<Element*>(node);
1438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    return body();
1448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
1458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectbool HTMLDocument::hasFocus()
1478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
1480bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    Page* page = this->page();
1490bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    if (!page)
1508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        return false;
1510bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    if (!page->focusController()->isActive())
1520bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch        return false;
1530bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    if (Frame* focusedFrame = page->focusController()->focusedFrame()) {
1548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        if (focusedFrame->tree()->isDescendantOf(frame()))
1558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project            return true;
1568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    }
1578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    return false;
1588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
1598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectString HTMLDocument::bgColor()
1618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
1628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLElement* b = body();
1638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
1648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (!bodyElement)
1668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        return String();
1678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    return bodyElement->bgColor();
1688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
1698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::setBgColor(const String& value)
1718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
1728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLElement* b = body();
1738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
1748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (bodyElement)
1768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        bodyElement->setBgColor(value);
1778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
1788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectString HTMLDocument::fgColor()
1808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
1818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLElement* b = body();
1828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
1838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (!bodyElement)
1858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        return String();
1868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    return bodyElement->text();
1878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
1888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::setFgColor(const String& value)
1908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
1918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLElement* b = body();
1928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
1938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (bodyElement)
1958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        bodyElement->setText(value);
1968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
1978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectString HTMLDocument::alinkColor()
1998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
2008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLElement* b = body();
2018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
2028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (!bodyElement)
2048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        return String();
2058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    return bodyElement->aLink();
2068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
2078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::setAlinkColor(const String& value)
2098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
2108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLElement* b = body();
2118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
2128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (bodyElement) {
2148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        // This check is a bit silly, but some benchmarks like to set the
2158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        // document's link colors over and over to the same value and we
2168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        // don't want to incur a style update each time.
2178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        if (bodyElement->aLink() != value)
2188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project            bodyElement->setALink(value);
2198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    }
2208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
2218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectString HTMLDocument::linkColor()
2238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
2248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLElement* b = body();
2258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
2268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (!bodyElement)
2288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        return String();
2298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    return bodyElement->link();
2308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
2318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::setLinkColor(const String& value)
2338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
2348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLElement* b = body();
2358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
2368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (bodyElement) {
2388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        // This check is a bit silly, but some benchmarks like to set the
2398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        // document's link colors over and over to the same value and we
2408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        // don't want to incur a style update each time.
2418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        if (bodyElement->link() != value)
2428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project            bodyElement->setLink(value);
2438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    }
2448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
2458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectString HTMLDocument::vlinkColor()
2478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
2488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLElement* b = body();
2498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
2508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (!bodyElement)
2528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        return String();
2538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    return bodyElement->vLink();
2548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
2558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::setVlinkColor(const String& value)
2578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
2588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLElement* b = body();
2598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
2608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (bodyElement) {
2628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        // This check is a bit silly, but some benchmarks like to set the
2638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        // document's link colors over and over to the same value and we
2648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        // don't want to incur a style update each time.
2658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        if (bodyElement->vLink() != value)
2668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project            bodyElement->setVLink(value);
2678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    }
2688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
2698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::captureEvents()
2718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
2728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
2738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::releaseEvents()
2758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
2768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
2778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
278e8b154fd68f9b33be40a3590e58347f353835f5cSteve BlockPassRefPtr<DocumentParser> HTMLDocument::createParser()
2798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
2802fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    bool reportErrors = InspectorInstrumentation::hasFrontend(this->page());
281e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block    return HTMLDocumentParser::create(this, reportErrors);
2828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
2838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project// --------------------------------------------------------------------------
2858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project// not part of the DOM
2868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project// --------------------------------------------------------------------------
2878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source ProjectPassRefPtr<Element> HTMLDocument::createElement(const AtomicString& name, ExceptionCode& ec)
2898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
2908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (!isValidName(name)) {
2918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        ec = INVALID_CHARACTER_ERR;
2928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        return 0;
2938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    }
294cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block    return HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom, name.lower(), xhtmlNamespaceURI), this, 0, false);
2958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
2968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2975af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkevoid HTMLDocument::addItemToMap(HashCountedSet<AtomicStringImpl*>& map, const AtomicString& name)
2988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
2998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (name.isEmpty())
3008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        return;
3010bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    map.add(name.impl());
3025af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke    if (Frame* f = frame())
3035af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke        f->script()->namedItemAdded(this, name);
3048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
3058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3065af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkevoid HTMLDocument::removeItemFromMap(HashCountedSet<AtomicStringImpl*>& map, const AtomicString& name)
3078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
3088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    if (name.isEmpty())
3098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        return;
310f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick    map.remove(name.impl());
3115af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke    if (Frame* f = frame())
3125af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke        f->script()->namedItemRemoved(this, name);
3138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
3148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::addNamedItem(const AtomicString& name)
3168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
3178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    addItemToMap(m_namedItemCounts, name);
3188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
3198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3200bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochvoid HTMLDocument::removeNamedItem(const AtomicString& name)
3218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
3228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    removeItemFromMap(m_namedItemCounts, name);
3238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
3248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::addExtraNamedItem(const AtomicString& name)
3268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
3278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    addItemToMap(m_extraNamedItemCounts, name);
3288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
3298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::removeExtraNamedItem(const AtomicString& name)
3318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
3328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    removeItemFromMap(m_extraNamedItemCounts, name);
3338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
3348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3355ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsenvoid HTMLDocument::setCompatibilityModeFromDoctype()
3368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
3375ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    // There are three possible compatibility modes:
3385ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    // Quirks - quirks mode emulates WinIE and NS4.  CSS parsing is also relaxed in this mode, e.g., unit types can
3398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // be omitted from numbers.
3405ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    // Limited Quirks - This mode is identical to no-quirks mode except for its treatment of line-height in the inline box model.
3415ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    // No Quirks - no quirks apply.  Web pages will obey the specifications to the letter.
3428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    DocumentType* docType = doctype();
3435ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    if (!docType)
3445ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        return;
3455ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen
3465ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    // Check for Quirks Mode.
3475ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    const String& publicId = docType->publicId();
3485ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    if (docType->name() != "html"
3495ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("+//Silmaril//dtd html Pro v0r11 19970101//", false)
3505ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//", false)
3515ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//AS//DTD HTML 3.0 asWedit + extensions//", false)
3525ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML 2.0 Level 1//", false)
3535ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML 2.0 Level 2//", false)
3545ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML 2.0 Strict Level 1//", false)
3555ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML 2.0 Strict Level 2//", false)
3565ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML 2.0 Strict//", false)
3575ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML 2.0//", false)
3585ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML 2.1E//", false)
3595ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML 3.0//", false)
3605ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML 3.2 Final//", false)
3615ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML 3.2//", false)
3625ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML 3//", false)
3635ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML Level 0//", false)
3645ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML Level 1//", false)
3655ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML Level 2//", false)
3665ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML Level 3//", false)
3675ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML Strict Level 0//", false)
3685ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML Strict Level 1//", false)
3695ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML Strict Level 2//", false)
3705ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML Strict Level 3//", false)
3715ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML Strict//", false)
3725ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//IETF//DTD HTML//", false)
3735ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//Metrius//DTD Metrius Presentational//", false)
3745ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//", false)
3755ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//Microsoft//DTD Internet Explorer 2.0 HTML//", false)
3765ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//Microsoft//DTD Internet Explorer 2.0 Tables//", false)
3775ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//", false)
3785ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//Microsoft//DTD Internet Explorer 3.0 HTML//", false)
3795ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//Microsoft//DTD Internet Explorer 3.0 Tables//", false)
3805ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//Netscape Comm. Corp.//DTD HTML//", false)
3815ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//Netscape Comm. Corp.//DTD Strict HTML//", false)
3825ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//O'Reilly and Associates//DTD HTML 2.0//", false)
3835ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//O'Reilly and Associates//DTD HTML Extended 1.0//", false)
3845ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//", false)
3855ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//", false)
3865ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//", false)
3875ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//Spyglass//DTD HTML 2.0 Extended//", false)
3885ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//SQ//DTD HTML 2.0 HoTMetaL + extensions//", false)
3895ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//Sun Microsystems Corp.//DTD HotJava HTML//", false)
3905ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//Sun Microsystems Corp.//DTD HotJava Strict HTML//", false)
3915ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//W3C//DTD HTML 3 1995-03-24//", false)
3925ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//W3C//DTD HTML 3.2 Draft//", false)
3935ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//W3C//DTD HTML 3.2 Final//", false)
3945ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//W3C//DTD HTML 3.2//", false)
3955ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//W3C//DTD HTML 3.2S Draft//", false)
3965ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//W3C//DTD HTML 4.0 Frameset//", false)
3975ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//W3C//DTD HTML 4.0 Transitional//", false)
3985ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//W3C//DTD HTML Experimental 19960712//", false)
3995ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//W3C//DTD HTML Experimental 970421//", false)
4005ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//W3C//DTD W3 HTML//", false)
4015ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//W3O//DTD W3 HTML 3.0//", false)
4025ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || equalIgnoringCase(publicId, "-//W3O//DTD W3 HTML Strict 3.0//EN//")
4035ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//WebTechs//DTD Mozilla HTML 2.0//", false)
4045ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//WebTechs//DTD Mozilla HTML//", false)
4055ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || equalIgnoringCase(publicId, "-/W3C/DTD HTML 4.0 Transitional/EN")
4065ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || equalIgnoringCase(publicId, "HTML")
4075ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || equalIgnoringCase(docType->systemId(), "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd")
4085ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || (docType->systemId().isEmpty() && publicId.startsWith("-//W3C//DTD HTML 4.01 Frameset//", false))
4095ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || (docType->systemId().isEmpty() && publicId.startsWith("-//W3C//DTD HTML 4.01 Transitional//", false))) {
4105ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        setCompatibilityMode(QuirksMode);
4115ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        return;
4128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    }
4135ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen
4145ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    // Check for Limited Quirks Mode.
4155ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    if (publicId.startsWith("-//W3C//DTD XHTML 1.0 Frameset//", false)
4165ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || publicId.startsWith("-//W3C//DTD XHTML 1.0 Transitional//", false)
4175ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || (!docType->systemId().isEmpty() && publicId.startsWith("-//W3C//DTD HTML 4.01 Frameset//", false))
4185ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        || (!docType->systemId().isEmpty() && publicId.startsWith("-//W3C//DTD HTML 4.01 Transitional//", false))) {
4195ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        setCompatibilityMode(LimitedQuirksMode);
4205ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen        return;
421d0825bca7fe65beaee391d30da42e937db621564Steve Block    }
4225ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen
4235ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    // Otherwise we are No Quirks Mode.
4245ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    setCompatibilityMode(NoQuirksMode);
4255ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    return;
4268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
4278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
4288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectvoid HTMLDocument::clear()
4298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
4308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // FIXME: This does nothing, and that seems unlikely to be correct.
4318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // We've long had a comment saying that IE doesn't support this.
4328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // But I do see it in the documentation for Mozilla.
4338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
4348f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian
4358f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qianbool HTMLDocument::isFrameSet() const
4368f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian{
4378f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian    HTMLElement* bodyElement = body();
438e14391e94c850b8bd03680c23b38978db68687a8John Reck    return bodyElement && bodyElement->hasTagName(framesetTag);
4398f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian}
4408f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian
4418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
442