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) 2004, 2006, 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 HTMLFrameElementBase_h
     25 #define HTMLFrameElementBase_h
     26 
     27 #include "core/html/HTMLFrameOwnerElement.h"
     28 #include "platform/scroll/ScrollTypes.h"
     29 
     30 namespace WebCore {
     31 
     32 class HTMLFrameElementBase : public HTMLFrameOwnerElement {
     33 public:
     34     virtual ScrollbarMode scrollingMode() const OVERRIDE FINAL { return m_scrolling; }
     35 
     36     int marginWidth() const { return m_marginWidth; }
     37     int marginHeight() const { return m_marginHeight; }
     38 
     39     int width();
     40     int height();
     41 
     42     virtual bool canContainRangeEndPoint() const OVERRIDE FINAL { return false; }
     43 
     44 protected:
     45     HTMLFrameElementBase(const QualifiedName&, Document&);
     46 
     47     bool isURLAllowed() const;
     48 
     49     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     50     virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
     51     virtual void didNotifySubtreeInsertionsToDocument() OVERRIDE FINAL;
     52     virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
     53 
     54     // FIXME: Remove this method once we have input routing in the browser
     55     // process. See http://crbug.com/339659.
     56     virtual void defaultEventHandler(Event*) OVERRIDE;
     57 
     58 private:
     59     virtual bool supportsFocus() const OVERRIDE FINAL;
     60     virtual void setFocus(bool) OVERRIDE FINAL;
     61 
     62     virtual bool isURLAttribute(const Attribute&) const OVERRIDE FINAL;
     63     virtual bool hasLegalLinkAttribute(const QualifiedName&) const OVERRIDE FINAL;
     64     virtual bool isHTMLContentAttribute(const Attribute&) const OVERRIDE FINAL;
     65 
     66     virtual bool areAuthorShadowsAllowed() const OVERRIDE FINAL { return false; }
     67 
     68     void setLocation(const String&);
     69     void setNameAndOpenURL();
     70     void openURL(bool lockBackForwardList = true);
     71 
     72     AtomicString m_URL;
     73     AtomicString m_frameName;
     74 
     75     ScrollbarMode m_scrolling;
     76 
     77     int m_marginWidth;
     78     int m_marginHeight;
     79 };
     80 
     81 inline bool isHTMLFrameElementBase(const Element& element)
     82 {
     83     return isHTMLFrameElement(element) || isHTMLIFrameElement(element);
     84 }
     85 
     86 inline bool isHTMLFrameElementBase(const HTMLElement& element)
     87 {
     88     return isHTMLFrameElement(element) || isHTMLIFrameElement(element);
     89 }
     90 
     91 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLFrameElementBase);
     92 
     93 } // namespace WebCore
     94 
     95 #endif // HTMLFrameElementBase_h
     96