Home | History | Annotate | Download | only in html
      1 /*
      2  * Copyright (C) 1999 Lars Knoll (knoll (at) kde.org)
      3  *           (C) 1999 Antti Koivisto (koivisto (at) kde.org)
      4  *           (C) 2000 Simon Hausmann <hausmann (at) kde.org>
      5  * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
      6  *
      7  * This library is free software; you can redistribute it and/or
      8  * modify it under the terms of the GNU Library General Public
      9  * License as published by the Free Software Foundation; either
     10  * version 2 of the License, or (at your option) any later version.
     11  *
     12  * This library is distributed in the hope that it will be useful,
     13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15  * Library General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU Library General Public License
     18  * along with this library; see the file COPYING.LIB.  If not, write to
     19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     20  * Boston, MA 02110-1301, USA.
     21  *
     22  */
     23 
     24 #ifndef HTMLAnchorElement_h
     25 #define HTMLAnchorElement_h
     26 
     27 #include "HTMLElement.h"
     28 
     29 namespace WebCore {
     30 
     31 // Link relation bitmask values.
     32 // FIXME: Uncomment as the various link relations are implemented.
     33 enum {
     34 //     RelationAlternate   = 0x00000001,
     35 //     RelationArchives    = 0x00000002,
     36 //     RelationAuthor      = 0x00000004,
     37 //     RelationBoomark     = 0x00000008,
     38 //     RelationExternal    = 0x00000010,
     39 //     RelationFirst       = 0x00000020,
     40 //     RelationHelp        = 0x00000040,
     41 //     RelationIndex       = 0x00000080,
     42 //     RelationLast        = 0x00000100,
     43 //     RelationLicense     = 0x00000200,
     44 //     RelationNext        = 0x00000400,
     45 //     RelationNoFolow    = 0x00000800,
     46     RelationNoReferrer     = 0x00001000,
     47 //     RelationPrev        = 0x00002000,
     48 //     RelationSearch      = 0x00004000,
     49 //     RelationSidebar     = 0x00008000,
     50 //     RelationTag         = 0x00010000,
     51 //     RelationUp          = 0x00020000,
     52 };
     53 
     54 class HTMLAnchorElement : public HTMLElement {
     55 public:
     56     static PassRefPtr<HTMLAnchorElement> create(Document*);
     57     static PassRefPtr<HTMLAnchorElement> create(const QualifiedName&, Document*);
     58 
     59     KURL href() const;
     60     void setHref(const AtomicString&);
     61 
     62     const AtomicString& name() const;
     63 
     64     String hash() const;
     65     void setHash(const String&);
     66 
     67     String host() const;
     68     void setHost(const String&);
     69 
     70     String hostname() const;
     71     void setHostname(const String&);
     72 
     73     String pathname() const;
     74     void setPathname(const String&);
     75 
     76     String port() const;
     77     void setPort(const String&);
     78 
     79     String protocol() const;
     80     void setProtocol(const String&);
     81 
     82     String search() const;
     83     void setSearch(const String&);
     84 
     85     String text() const;
     86 
     87     String toString() const;
     88 
     89     bool isLiveLink() const;
     90 
     91     bool hasRel(uint32_t relation) const;
     92     void setRel(const String&);
     93 
     94 protected:
     95     HTMLAnchorElement(const QualifiedName&, Document*);
     96 
     97     virtual void parseMappedAttribute(MappedAttribute*);
     98 
     99 private:
    100     virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
    101     virtual int tagPriority() const { return 1; }
    102     virtual bool supportsFocus() const;
    103     virtual bool isMouseFocusable() const;
    104     virtual bool isKeyboardFocusable(KeyboardEvent*) const;
    105     virtual void defaultEventHandler(Event*);
    106     virtual void setActive(bool active = true, bool pause = false);
    107     virtual void accessKeyAction(bool fullAction);
    108     virtual bool isURLAttribute(Attribute*) const;
    109     virtual bool canStartSelection() const;
    110     virtual String target() const;
    111     virtual short tabIndex() const;
    112     virtual bool draggable() const;
    113 
    114     RefPtr<Element> m_rootEditableElementForSelectionOnMouseDown;
    115     bool m_wasShiftKeyDownOnMouseDown;
    116     uint32_t m_linkRelations;
    117 };
    118 
    119 } // namespace WebCore
    120 
    121 #endif // HTMLAnchorElement_h
    122