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  * Copyright (C) 2003, 2010 Apple Inc. ALl rights reserved.
      5  *
      6  * This library is free software; you can redistribute it and/or
      7  * modify it under the terms of the GNU Library General Public
      8  * License as published by the Free Software Foundation; either
      9  * version 2 of the License, or (at your option) any later version.
     10  *
     11  * This library is distributed in the hope that it will be useful,
     12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14  * Library General Public License for more details.
     15  *
     16  * You should have received a copy of the GNU Library General Public License
     17  * along with this library; see the file COPYING.LIB.  If not, write to
     18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     19  * Boston, MA 02110-1301, USA.
     20  *
     21  */
     22 
     23 #ifndef HTMLStyleElement_h
     24 #define HTMLStyleElement_h
     25 
     26 #include "core/dom/StyleElement.h"
     27 #include "core/html/HTMLElement.h"
     28 
     29 namespace WebCore {
     30 
     31 class HTMLStyleElement;
     32 class StyleSheet;
     33 
     34 template<typename T> class EventSender;
     35 typedef EventSender<HTMLStyleElement> StyleEventSender;
     36 
     37 class HTMLStyleElement FINAL : public HTMLElement, private StyleElement {
     38     WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLStyleElement);
     39 public:
     40     static PassRefPtrWillBeRawPtr<HTMLStyleElement> create(Document&, bool createdByParser);
     41     virtual ~HTMLStyleElement();
     42 
     43     void setType(const AtomicString&);
     44 
     45     ContainerNode* scopingNode();
     46 
     47     using StyleElement::sheet;
     48 
     49     bool disabled() const;
     50     void setDisabled(bool);
     51 
     52     void dispatchPendingEvent(StyleEventSender*);
     53     static void dispatchPendingLoadEvents();
     54 
     55     virtual void trace(Visitor*) OVERRIDE;
     56 
     57 private:
     58     HTMLStyleElement(Document&, bool createdByParser);
     59 
     60     // overload from HTMLElement
     61     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     62     virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
     63     virtual void didNotifySubtreeInsertionsToDocument() OVERRIDE;
     64     virtual void removedFrom(ContainerNode*) OVERRIDE;
     65     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE;
     66 
     67     virtual void finishParsingChildren() OVERRIDE;
     68 
     69     virtual bool sheetLoaded() OVERRIDE { return StyleElement::sheetLoaded(document()); }
     70     virtual void notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred) OVERRIDE;
     71     virtual void startLoadingDynamicSheet() OVERRIDE { StyleElement::startLoadingDynamicSheet(document()); }
     72 
     73     virtual const AtomicString& media() const OVERRIDE;
     74     virtual const AtomicString& type() const OVERRIDE;
     75 
     76     bool m_firedLoad;
     77     bool m_loadedSheet;
     78 };
     79 
     80 } //namespace
     81 
     82 #endif
     83