webengine/osswebengine/WebCore/html/HTMLMetaElement.cpp
changeset 0 dd21522fd290
child 16 a359256acfc6
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /**
       
     2  * This file is part of the DOM implementation for KDE.
       
     3  *
       
     4  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
       
     5  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
       
     6  *           (C) 2001 Dirk Mueller (mueller@kde.org)
       
     7  * Copyright (C) 2003 Apple Computer, Inc.
       
     8  *
       
     9  * This library is free software; you can redistribute it and/or
       
    10  * modify it under the terms of the GNU Library General Public
       
    11  * License as published by the Free Software Foundation; either
       
    12  * version 2 of the License, or (at your option) any later version.
       
    13  *
       
    14  * This library is distributed in the hope that it will be useful,
       
    15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    17  * Library General Public License for more details.
       
    18  *
       
    19  * You should have received a copy of the GNU Library General Public License
       
    20  * along with this library; see the file COPYING.LIB.  If not, write to
       
    21  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    22  * Boston, MA 02110-1301, USA.
       
    23  */
       
    24 #include "config.h"
       
    25 #include "HTMLMetaElement.h"
       
    26 
       
    27 #include "Document.h"
       
    28 #include "HTMLNames.h"
       
    29 #if PLATFORM(SYMBIAN)
       
    30 #include "Frame.h"
       
    31 #include "WebCoreFrameBridge.h"
       
    32 #endif
       
    33 
       
    34 namespace WebCore {
       
    35 
       
    36 using namespace HTMLNames;
       
    37 
       
    38 HTMLMetaElement::HTMLMetaElement(Document* doc)
       
    39     : HTMLElement(metaTag, doc)
       
    40 {
       
    41 }
       
    42 
       
    43 HTMLMetaElement::~HTMLMetaElement()
       
    44 {
       
    45 }
       
    46 
       
    47 void HTMLMetaElement::parseMappedAttribute(MappedAttribute* attr)
       
    48 {
       
    49     if (attr->name() == http_equivAttr) {
       
    50         m_equiv = attr->value();
       
    51         process();
       
    52     } else if (attr->name() == contentAttr) {
       
    53         m_content = attr->value();
       
    54         process();
       
    55     } else if (attr->name() == nameAttr) {
       
    56         // Do nothing.
       
    57     } else
       
    58         HTMLElement::parseMappedAttribute(attr);
       
    59 }
       
    60 
       
    61 void HTMLMetaElement::insertedIntoDocument()
       
    62 {
       
    63     HTMLElement::insertedIntoDocument();
       
    64     process();
       
    65 }
       
    66 
       
    67 void HTMLMetaElement::process()
       
    68 {
       
    69 #if PLATFORM(SYMBIAN)
       
    70     String str = name();
       
    71     if(!str.isEmpty()) {
       
    72         String v = content();
       
    73         //Inform the bridge about this meta value;
       
    74         if (inDocument()) {
       
    75             static_cast<WebCoreFrameBridge*>(document()->frame()->bridge())->notifyMetaData(str,v);
       
    76         }
       
    77     }
       
    78 #endif
       
    79     // Get the document to process the tag, but only if we're actually part of DOM tree (changing a meta tag while
       
    80     // it's not in the tree shouldn't have any effect on the document)
       
    81     if (inDocument() && !m_equiv.isNull() && !m_content.isNull())
       
    82         document()->processHttpEquiv(m_equiv, m_content);
       
    83 }
       
    84 
       
    85 String HTMLMetaElement::content() const
       
    86 {
       
    87     return getAttribute(contentAttr);
       
    88 }
       
    89 
       
    90 void HTMLMetaElement::setContent(const String& value)
       
    91 {
       
    92     setAttribute(contentAttr, value);
       
    93 }
       
    94 
       
    95 String HTMLMetaElement::httpEquiv() const
       
    96 {
       
    97     return getAttribute(http_equivAttr);
       
    98 }
       
    99 
       
   100 void HTMLMetaElement::setHttpEquiv(const String& value)
       
   101 {
       
   102     setAttribute(http_equivAttr, value);
       
   103 }
       
   104 
       
   105 String HTMLMetaElement::name() const
       
   106 {
       
   107     return getAttribute(nameAttr);
       
   108 }
       
   109 
       
   110 void HTMLMetaElement::setName(const String& value)
       
   111 {
       
   112     setAttribute(nameAttr, value);
       
   113 }
       
   114 
       
   115 String HTMLMetaElement::scheme() const
       
   116 {
       
   117     return getAttribute(schemeAttr);
       
   118 }
       
   119 
       
   120 void HTMLMetaElement::setScheme(const String &value)
       
   121 {
       
   122     setAttribute(schemeAttr, value);
       
   123 }
       
   124 
       
   125 }