Changeset 35640 in webkit
- Timestamp:
- Aug 8, 2008 5:59:30 AM (16 years ago)
- Location:
- branches/XBL2
- Files:
-
- 7 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/XBL2/LayoutTests/ChangeLog
r35416 r35640 1 2008-08-08 Julien Chaffraix <jchaffraix@webkit.org> 2 3 Reviewed by Eric. 4 5 Test case for bug 20212: [XBL] Add full support for element="" attachment 6 7 * fast/xbl/xbl-crash-inline-expected.txt: Added. 8 * fast/xbl/xbl-crash-inline.xhtml: Added. 9 * fast/xbl/xbl-document-sheets-modification-expected.txt: Added. 10 * fast/xbl/xbl-document-sheets-modification.xhtml: Added. 11 * fast/xbl/xbl-element-binding-expected.txt: Added. 12 * fast/xbl/xbl-element-binding.xhtml: Added. 13 1 14 2008-07-28 Julien Chaffraix <jchaffraix@webkit.org> 2 15 -
branches/XBL2/WebCore/ChangeLog
r35637 r35640 1 2008-08-08 Julien Chaffraix <jchaffraix@webkit.org> 2 3 Reviewed by Eric. 4 5 Tests: fast/xbl/xbl-crash-inline.xhtml 6 fast/xbl/xbl-document-sheets-modification.xhtml 7 fast/xbl/xbl-element-binding.xhtml 8 9 Bug 20212: [XBL] Add full support for element="" attachment 10 11 - Add attributeChanged method to XBLBindingElement to catch "element" 12 changes and update the bindings. 13 14 - Translate "element" attribute to a stylesheet that is added to the bound 15 document's sheets. 16 17 * GNUmakefile.am: Add XBLBindingElement.cpp. 18 * WebCore.pro: Ditto. 19 * WebCore.xcodeproj/project.pbxproj: Ditto. 20 21 * css/CSSStyleSelector.cpp: 22 (WebCore::CSSStyleSelector::CSSStyleSelector): Add binding 23 sheets. 24 25 * dom/Document.cpp: 26 (WebCore::Document::~Document): Remove binding 27 sheet information. 28 29 (WebCore::Document::recalcStyleSelector): When 30 recalculating the style selector, remove all the bindings 31 as the removed sheets would never remove theirs. 32 33 (WebCore::Document::addBindingSheet): Update binding manager 34 information. 35 (WebCore::Document::removeBindingSheet): Ditto. 36 37 * dom/Document.h: 38 * xbl/XBLBindingElement.cpp: Added. 39 (WebCore::XBLBindingElement::XBLBindingElement): 40 (WebCore::XBLBindingElement::attributeChanged): Check 41 for "element" changes and update the cached sheet and the 42 bound element's bindings style sheets. 43 44 (WebCore::XBLBindingElement::generateBindingSheet): Create 45 the style sheet from the "element" attribute. 46 47 * xbl/XBLBindingElement.h: 48 * xbl/XBLBindingManager.cpp: 49 (WebCore::XBLBindingManager::addBindingSheet): 50 (WebCore::XBLBindingManager::removeBindingSheet): 51 (WebCore::XBLBindingManager::clearBindingSheets): 52 (WebCore::XBLBindingManager::getBindingSheets): All 4 previous 53 methods are used to manage the binding sheets. 54 55 * xbl/XBLBindingManager.h: 56 1 57 2008-08-08 Julien Chaffraix <jchaffraix@webkit.org> 2 58 -
branches/XBL2/WebCore/GNUmakefile.am
r35412 r35640 1445 1445 webcore_sources += \ 1446 1446 WebCore/loader/CachedXBLDocument.cpp \ 1447 WebCore/xbl/XBLBindingElement.cpp \ 1447 1448 WebCore/xbl/XBLBindingManager.cpp \ 1448 1449 WebCore/xbl/XBLXBLElement.cpp -
branches/XBL2/WebCore/WebCore.pro
r35412 r35640 1237 1237 SOURCES += \ 1238 1238 loader/CachedXBLDocument.cpp \ 1239 xbl/XBLBindingElement.cpp \ 1239 1240 xbl/XBLBindingManager.cpp \ 1240 1241 xbl/XBLXBLElement.cpp -
branches/XBL2/WebCore/WebCore.xcodeproj/project.pbxproj
r35325 r35640 1830 1830 A10D21420E389A18007E500B /* XBLTemplateElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A10D21410E389A18007E500B /* XBLTemplateElement.h */; }; 1831 1831 A1172D6E0E0C539E00175C88 /* XBLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = A1172D6D0E0C539E00175C88 /* XBLDocument.h */; }; 1832 A14EF7AC0E3F106900DA9F39 /* XBLBindingElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A14EF7AB0E3F106900DA9F39 /* XBLBindingElement.cpp */; }; 1832 1833 A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1833 1834 A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */; }; … … 6304 6305 A10D21410E389A18007E500B /* XBLTemplateElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XBLTemplateElement.h; sourceTree = "<group>"; }; 6305 6306 A1172D6D0E0C539E00175C88 /* XBLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XBLDocument.h; sourceTree = "<group>"; }; 6307 A14EF7AB0E3F106900DA9F39 /* XBLBindingElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XBLBindingElement.cpp; sourceTree = "<group>"; }; 6306 6308 A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; }; 6307 6309 A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; }; … … 13306 13308 A10D21410E389A18007E500B /* XBLTemplateElement.h */, 13307 13309 A10D213F0E389A0D007E500B /* XBLBindingElement.h */, 13310 A14EF7AB0E3F106900DA9F39 /* XBLBindingElement.cpp */, 13308 13311 A10D20A30E386DCF007E500B /* XBLBinding.h */, 13309 13312 A10D20A40E386DCF007E500B /* XBLBindingManager.cpp */, … … 17104 17107 F9C6760B0DEC7903008D0C2F /* XBLNames.cpp in Sources */, 17105 17108 A10D20A70E386DCF007E500B /* XBLBindingManager.cpp in Sources */, 17109 A14EF7AC0E3F106900DA9F39 /* XBLBindingElement.cpp in Sources */, 17106 17110 ); 17107 17111 runOnlyForDeploymentPostprocessing = 0; -
branches/XBL2/WebCore/css/CSSStyleSelector.cpp
r35416 r35640 378 378 m_authorStyle->addRulesFromSheet(static_cast<CSSStyleSheet*>(sheet), *m_medium, this); 379 379 } 380 381 #if ENABLE(XBL) 382 // Add bindings's style sheets. 383 XBLBindingManager* manager = XBLBindingManager::sharedInstance(); 384 StyleSheetVector* bindingSheets = manager->getBindingSheets(doc); 385 386 if (!bindingSheets) 387 return; 388 389 for (StyleSheetVector::iterator it = bindingSheets->begin(); it != bindingSheets->end(); ++it) 390 if ((*it)->isCSSStyleSheet() && !(*it)->disabled()) 391 m_authorStyle->addRulesFromSheet(static_cast<CSSStyleSheet*>((*it).get()), *m_medium, this); 392 #endif 380 393 } 381 394 -
branches/XBL2/WebCore/dom/Document.cpp
r35324 r35640 128 128 129 129 #if ENABLE(XBL) 130 #include "XBLBindingManager.h" 130 131 #include "XBLElement.h" 131 132 #include "XBLElementFactory.h" … … 403 404 delete m_svgExtensions; 404 405 #endif 406 #if ENABLE(XBL) 407 XBLBindingManager* manager = XBLBindingManager::sharedInstance(); 408 manager->clearBindingSheets(this); 409 #endif 405 410 406 411 XMLHttpRequest::detachRequests(this); … … 2269 2274 sheets.append(sheet); 2270 2275 2276 #if ENABLE(XBL) 2277 // Remove all bindings as some binding sheets may be removed 2278 // and they wouldn't update their bindings. 2279 // FIXME: This should be done only if a binding sheet was removed instead of always. 2280 if (n->isElementNode()) { 2281 XBLBindingManager* manager = XBLBindingManager::sharedInstance(); 2282 manager->removeAllBindings(static_cast<Element*>(n)); 2283 } 2284 #endif 2271 2285 // For HTML documents, stylesheets are not allowed within/after the <BODY> tag. So we 2272 2286 // can stop searching here. … … 3636 3650 #endif 3637 3651 3652 #if ENABLE(XBL) 3653 void Document::addBindingSheet(PassRefPtr<CSSStyleSheet> sheet) 3654 { 3655 XBLBindingManager* manager = XBLBindingManager::sharedInstance(); 3656 manager->addBindingSheet(this, sheet); 3657 } 3658 3659 void Document::removeBindingSheet(CSSStyleSheet* sheet) 3660 { 3661 XBLBindingManager* manager = XBLBindingManager::sharedInstance(); 3662 manager->removeBindingSheet(this, sheet); 3663 } 3664 #endif 3665 3638 3666 PassRefPtr<HTMLCollection> Document::images() 3639 3667 { -
branches/XBL2/WebCore/dom/Document.h
r35324 r35640 935 935 #endif 936 936 937 #if ENABLE(XBL) 938 void addBindingSheet(PassRefPtr<CSSStyleSheet>); 939 void removeBindingSheet(CSSStyleSheet*); 940 #endif 941 937 942 void initSecurityContext(); 938 943 SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); } … … 995 1000 SVGDocumentExtensions* m_svgExtensions; 996 1001 #endif 997 1002 998 1003 #if ENABLE(DASHBOARD_SUPPORT) 999 1004 Vector<DashboardRegionValue> m_dashboardRegions; -
branches/XBL2/WebCore/xbl/XBLBindingElement.h
r35325 r35640 34 34 namespace WebCore { 35 35 36 class Attribute; 37 class CSSStyleSheet; 38 36 39 class XBLBindingElement : public XBLElement { 37 40 public: 38 XBLBindingElement(const WebCore::QualifiedName& qName, WebCore::Document* doc) 39 : XBLElement(qName, doc) 40 { 41 } 41 XBLBindingElement(const QualifiedName&, Document*); 42 43 virtual void attributeChanged(Attribute*, bool preserveDecls = false); 44 45 // Generate the binding sheet associated by this element. 46 PassRefPtr<CSSStyleSheet> generateBindingSheet(); 47 48 private: 49 // FIXME: This should be moved to the XBLBindingPrototype when it is created. 50 RefPtr<CSSStyleSheet> m_bindingSheet; 42 51 }; 43 52 -
branches/XBL2/WebCore/xbl/XBLBindingManager.cpp
r35416 r35640 29 29 #if ENABLE(XBL) 30 30 31 #include "CSSStyleSheet.h" 31 32 #include "XBLBinding.h" 32 33 … … 89 90 } 90 91 92 93 void XBLBindingManager::addBindingSheet(Document* document, PassRefPtr<CSSStyleSheet> sheet) 94 { 95 StyleSheetVector* documentSheets = m_bindingSheets.get(document); 96 if (!documentSheets) { 97 documentSheets = new StyleSheetVector(); 98 m_bindingSheets.add(document, documentSheets); 99 } 100 documentSheets->append(sheet); 101 } 102 103 void XBLBindingManager::removeBindingSheet(Document* document, PassRefPtr<CSSStyleSheet> sheet) 104 { 105 StyleSheetVector* documentSheets = m_bindingSheets.get(document); 106 107 // documentSheets is null if no sheets were added for this document. 108 if (documentSheets) { 109 for (StyleSheetVector::iterator it = documentSheets->begin(); it != documentSheets->end(); ++it) 110 if (*it == sheet) { 111 documentSheets->remove(it - documentSheets->begin()); 112 return; 113 } 114 } 115 116 // If we arrive here, it means that we did not find the sheet to remove, which 117 // should NEVER occur. 118 ASSERT_NOT_REACHED(); 119 } 120 121 void XBLBindingManager::clearBindingSheets(Document* document) 122 { 123 delete m_bindingSheets.take(document); 124 } 125 126 StyleSheetVector* XBLBindingManager::getBindingSheets(Document* document) 127 { 128 return m_bindingSheets.get(document); 129 } 130 91 131 }; 92 132 -
branches/XBL2/WebCore/xbl/XBLBindingManager.h
r35324 r35640 31 31 #if ENABLE(XBL) 32 32 33 #include "StyleSheetList.h" 33 34 #include "wtf/HashMap.h" 34 35 #include "wtf/Vector.h" … … 36 37 namespace WebCore { 37 38 39 class CSSStyleSheet; 40 class Document; 38 41 class Element; 39 42 class XBLBinding; … … 50 53 // Used by Element destructor to prevent leakage. 51 54 void removeAllBindings(Element* boundElement); 55 56 // Binding style sheets management. 57 void addBindingSheet(Document*, PassRefPtr<CSSStyleSheet>); 58 void removeBindingSheet(Document*, PassRefPtr<CSSStyleSheet>); 59 void clearBindingSheets(Document*); 60 StyleSheetVector* getBindingSheets(Document*); 61 52 62 private: 53 63 XBLBindingManager(); 54 64 55 65 HashMap<Element*, Vector<XBLBinding>* > m_bindings; 66 HashMap<Document*, StyleSheetVector*> m_bindingSheets; 56 67 }; 57 68
Note: See TracChangeset
for help on using the changeset viewer.