Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: Source/core/dom/CustomElementCallback.h

Issue 17707002: Implement Custom Elements inserted and removed callbacks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 19 matching lines...) Expand all
30 30
31 #ifndef CustomElementCallback_h 31 #ifndef CustomElementCallback_h
32 #define CustomElementCallback_h 32 #define CustomElementCallback_h
33 33
34 #include "wtf/RefCounted.h" 34 #include "wtf/RefCounted.h"
35 35
36 namespace WebCore { 36 namespace WebCore {
37 37
38 class Element; 38 class Element;
39 39
40 class CustomElementCallback : public RefCounted<CustomElementCallback> { 40 class CustomElementCallback : public RefCounted<CustomElementCallback> {
dglazkov 2013/06/25 18:04:31 I wonder if these should be named CustomElementLif
41 public: 41 public:
42 virtual ~CustomElementCallback() { } 42 virtual ~CustomElementCallback() { }
43 43
44 bool hasReady() const { return m_which == Ready; } 44 bool hasReady() const { return m_which & Ready; }
45 virtual void ready(Element*) = 0; 45 virtual void ready(Element*) = 0;
46 46
47 protected: 47 bool hasInserted() const { return m_which & Inserted; }
48 virtual void inserted(Element*) = 0;
49
50 bool hasRemoved() const { return m_which & Removed; }
51 virtual void removed(Element*) = 0;
52
48 enum CallbackType { 53 enum CallbackType {
49 None, 54 None = 0,
50 Ready 55 Ready = 1 << 0,
56 Inserted = 1 << 1,
57 Removed = 1 << 2
51 }; 58 };
52 59
60 protected:
53 CustomElementCallback(CallbackType which) : m_which(which) { } 61 CustomElementCallback(CallbackType which) : m_which(which) { }
54 62
55 private: 63 private:
56 CallbackType m_which; 64 CallbackType m_which;
57 }; 65 };
58 66
59 } 67 }
60 68
61 #endif // CustomElementCallback_h 69 #endif // CustomElementCallback_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698