Changeset 66657 in webkit
- Timestamp:
- Sep 2, 2010 3:58:04 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r66655 r66657 15 15 (WebCore::DOMSelection::collapse): 16 16 (WebCore::DOMSelection::selectAllChildren): 17 18 2010-09-02 Eric Seidel <eric@webkit.org> 19 20 Reviewed by Dimitri Glazkov. 21 22 Share more code between HTMLObjectElement and HTMLEmbedElement 23 https://bugs.webkit.org/show_bug.cgi?id=45054 24 25 This pushes more of HTMLObjectElement code down into 26 HTMLPlugInImageElement so that it can be shared with HTMLEmbedElement. 27 28 This patch was originally written in one piece and reviewed by Dimitri. 29 I'm landing it as four separate changes for easier readability and less 30 chance of regression. 31 32 No functional change, thus no tests. 33 34 * html/HTMLEmbedElement.cpp: 35 (WebCore::HTMLEmbedElement::HTMLEmbedElement): 36 (WebCore::HTMLEmbedElement::create): 37 * html/HTMLEmbedElement.h: 38 * html/HTMLObjectElement.cpp: 39 (WebCore::HTMLObjectElement::HTMLObjectElement): 40 * html/HTMLObjectElement.h: 41 * html/HTMLPlugInImageElement.cpp: 42 (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): 43 (WebCore::HTMLPlugInImageElement::detach): 44 (WebCore::HTMLPlugInImageElement::finishParsingChildren): 45 * html/HTMLPlugInImageElement.h: 46 * html/HTMLTagNames.in: 17 47 18 48 2010-09-02 Eric Seidel <eric@webkit.org> -
trunk/WebCore/html/HTMLEmbedElement.cpp
r66653 r66657 43 43 using namespace HTMLNames; 44 44 45 inline HTMLEmbedElement::HTMLEmbedElement(const QualifiedName& tagName, Document* document )46 : HTMLPlugInImageElement(tagName, document )45 inline HTMLEmbedElement::HTMLEmbedElement(const QualifiedName& tagName, Document* document, bool createdByParser) 46 : HTMLPlugInImageElement(tagName, document, createdByParser) 47 47 { 48 48 ASSERT(hasTagName(embedTag)); 49 49 } 50 50 51 PassRefPtr<HTMLEmbedElement> HTMLEmbedElement::create(const QualifiedName& tagName, Document* document )52 { 53 return adoptRef(new HTMLEmbedElement(tagName, document ));51 PassRefPtr<HTMLEmbedElement> HTMLEmbedElement::create(const QualifiedName& tagName, Document* document, bool createdByParser) 52 { 53 return adoptRef(new HTMLEmbedElement(tagName, document, createdByParser)); 54 54 } 55 55 -
trunk/WebCore/html/HTMLEmbedElement.h
r66653 r66657 30 30 class HTMLEmbedElement : public HTMLPlugInImageElement { 31 31 public: 32 static PassRefPtr<HTMLEmbedElement> create(const QualifiedName&, Document* );32 static PassRefPtr<HTMLEmbedElement> create(const QualifiedName&, Document*, bool createdByParser); 33 33 34 34 private: 35 HTMLEmbedElement(const QualifiedName&, Document* );35 HTMLEmbedElement(const QualifiedName&, Document*, bool createdByParser); 36 36 37 37 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; -
trunk/WebCore/html/HTMLObjectElement.cpp
r66653 r66657 47 47 48 48 inline HTMLObjectElement::HTMLObjectElement(const QualifiedName& tagName, Document* document, bool createdByParser) 49 : HTMLPlugInImageElement(tagName, document )49 : HTMLPlugInImageElement(tagName, document, createdByParser) 50 50 , m_docNamedItem(true) 51 51 , m_useFallbackContent(false) 52 52 { 53 // HTMLObjectElement tries to delay updating its widget while parsing until54 // after all of its children are parsed.55 setNeedsWidgetUpdate(!createdByParser);56 53 ASSERT(hasTagName(objectTag)); 57 54 } … … 148 145 } 149 146 150 void HTMLObjectElement::finishParsingChildren()151 {152 HTMLPlugInImageElement::finishParsingChildren();153 if (!useFallbackContent()) {154 setNeedsWidgetUpdate(true);155 if (inDocument())156 setNeedsStyleRecalc();157 }158 }159 160 void HTMLObjectElement::detach()161 {162 if (attached() && renderer() && !useFallbackContent())163 // Update the widget the next time we attach (detaching destroys the plugin).164 setNeedsWidgetUpdate(true);165 HTMLPlugInImageElement::detach();166 }167 168 147 void HTMLObjectElement::insertedIntoDocument() 169 148 { -
trunk/WebCore/html/HTMLObjectElement.h
r66653 r66657 49 49 virtual void attach(); 50 50 virtual bool rendererIsNeeded(RenderStyle*); 51 virtual void finishParsingChildren();52 virtual void detach();53 51 virtual void insertedIntoDocument(); 54 52 virtual void removedFromDocument(); -
trunk/WebCore/html/HTMLPlugInImageElement.cpp
r66653 r66657 32 32 namespace WebCore { 33 33 34 HTMLPlugInImageElement::HTMLPlugInImageElement(const QualifiedName& tagName, Document* document )34 HTMLPlugInImageElement::HTMLPlugInImageElement(const QualifiedName& tagName, Document* document, bool createdByParser) 35 35 : HTMLPlugInElement(tagName, document) 36 , m_needsWidgetUpdate(false) 36 // m_needsWidgetUpdate(!createdByParser) allows HTMLObjectElement to delay 37 // widget updates until after all children are parsed. For HTMLEmbedElement 38 // this delay is unnecessary, but it is simpler to make both classes share 39 // the same codepath in this class. 40 , m_needsWidgetUpdate(!createdByParser) 37 41 { 38 42 } … … 75 79 } 76 80 81 void HTMLPlugInImageElement::detach() 82 { 83 if (attached() && renderer() && !useFallbackContent()) 84 // Update the widget the next time we attach (detaching destroys the plugin). 85 setNeedsWidgetUpdate(true); 86 HTMLPlugInElement::detach(); 87 } 88 77 89 void HTMLPlugInImageElement::updateWidget() 78 90 { … … 80 92 if (needsWidgetUpdate() && renderEmbeddedObject() && !useFallbackContent() && !isImageType()) 81 93 renderEmbeddedObject()->updateWidget(true); 94 } 95 96 void HTMLPlugInImageElement::finishParsingChildren() 97 { 98 HTMLPlugInElement::finishParsingChildren(); 99 if (!useFallbackContent()) { 100 setNeedsWidgetUpdate(true); 101 if (inDocument()) 102 setNeedsStyleRecalc(); 103 } 82 104 } 83 105 -
trunk/WebCore/html/HTMLPlugInImageElement.h
r66653 r66657 39 39 40 40 RenderEmbeddedObject* renderEmbeddedObject() const; 41 41 42 42 protected: 43 HTMLPlugInImageElement(const QualifiedName& tagName, Document* );43 HTMLPlugInImageElement(const QualifiedName& tagName, Document*, bool createdByParser); 44 44 45 45 bool isImageType(); 46 47 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);48 49 static void updateWidgetCallback(Node*);50 46 51 47 OwnPtr<HTMLImageLoader> m_imageLoader; … … 53 49 String m_url; 54 50 51 static void updateWidgetCallback(Node*); 52 virtual void detach(); 53 55 54 private: 56 55 virtual bool canLazyAttach() { return false; } 57 56 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); 57 58 virtual void finishParsingChildren(); 58 59 virtual void willMoveToNewOwnerDocument(); 59 60 -
trunk/WebCore/html/HTMLTagNames.in
r64018 r66657 44 44 dt interfaceName=HTMLElement 45 45 em interfaceName=HTMLElement 46 embed 46 embed constructorNeedsCreatedByParser 47 47 fieldset interfaceName=HTMLFieldSetElement, constructorNeedsFormElement 48 48 figcaption interfaceName=HTMLElement -
trunk/WebCore/loader/SubframeLoader.cpp
r66650 r66657 41 41 #include "HTMLPlugInImageElement.h" 42 42 #include "MIMETypeRegistry.h" 43 #include "Node.h"44 43 #include "Page.h" 45 44 #include "PluginData.h"
Note: See TracChangeset
for help on using the changeset viewer.