Changeset 20452 in webkit
- Timestamp:
- Mar 23, 2007 1:53:05 PM (17 years ago)
- Location:
- S60/trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
S60/trunk/WebCore/ChangeLog
r20451 r20452 1 rathnasa, reviewed by zalan 2 DESC: [S60] ESMS-6YDMWP: TRUE - GSM - broswer crashes on certain web pages 3 Quick fix to validate null pointers 4 http://bugs.webkit.org/show_bug.cgi?id=13074 5 6 WARNING: NO TEST CASES ADDED OR CHANGED 7 8 * khtml/xml/dom_elementimpl.cpp: 9 (AttrImpl::nodeName): 10 (ElementImpl::blur): 11 (ElementImpl::getAttributeNS): 12 (ElementImpl::tagName): 13 (ElementImpl::styleForRenderer): 14 (ElementImpl::createRenderer): 15 (ElementImpl::childAllowed): 16 (ElementImpl::dispatchAttrRemovalEvent): 17 (ElementImpl::dispatchAttrAdditionEvent): 18 (ElementImpl::updateId): 19 (XMLElementImpl::localName): 20 (XMLElementImpl::namespaceURI): 21 (XMLElementImpl::cloneNode): 22 (NamedAttrMapImpl::mapId): 23 1 24 2007-03-23 bujtas <zbujtas@gmail.com> 2 25 -
S60/trunk/WebCore/khtml/xml/dom_elementimpl.cpp
r16165 r20452 82 82 DOMString AttrImpl::nodeName() const 83 83 { 84 return getDocument()->attrName(m_attribute->id()); 84 DocumentImpl *doc = getDocument(); 85 if (doc) { 86 return doc->attrName(m_attribute->id()); 87 } 88 else { 89 return DOMString(); 90 } 85 91 } 86 92 … … 287 293 DocumentImpl* doc = getDocument(); 288 294 if (doc && doc->focusNode() == this) 289 doc->setFocusNode(0);295 doc->setFocusNode(0); 290 296 } 291 297 … … 293 299 const DOMString &localName) const 294 300 { 295 NodeImpl::Id id = getDocument()->attrId(namespaceURI.implementation(), 301 DocumentImpl *doc = getDocument(); 302 if (doc) { 303 NodeImpl::Id id = doc->attrId(namespaceURI.implementation(), 296 304 localName.implementation(), true); 297 if (!id) return nullAtom; 298 return getAttribute(id); 305 if (!id) return nullAtom; 306 return getAttribute(id); 307 } 308 else { 309 return nullAtom; 310 } 299 311 } 300 312 … … 375 387 DOMString ElementImpl::tagName() const 376 388 { 377 DOMString tn = getDocument()->tagName(id()); 378 379 if (m_prefix) 380 return DOMString(m_prefix) + ":" + tn; 381 382 return tn; 389 DocumentImpl *doc = getDocument(); 390 if (doc) { 391 DOMString tn = doc->tagName(id()); 392 393 if (m_prefix) 394 return DOMString(m_prefix) + ":" + tn; 395 396 return tn; 397 } 398 else { 399 return DOMString(); 400 } 383 401 } 384 402 … … 410 428 RenderStyle *ElementImpl::styleForRenderer(RenderObject *parentRenderer) 411 429 { 412 return getDocument()->styleSelector()->styleForElement(this); 430 DocumentImpl *doc = getDocument(); 431 if (doc) { 432 return doc->styleSelector()->styleForElement(this); 433 } 434 else { 435 return 0; 436 } 413 437 } 414 438 415 439 RenderObject *ElementImpl::createRenderer(RenderArena *arena, RenderStyle *style) 416 440 { 417 if (getDocument()->documentElement() == this && style->display() == NONE) { 441 DocumentImpl *doc = getDocument(); 442 if (doc && doc->documentElement() == this && style->display() == NONE) { 418 443 // Ignore display: none on root elements. Force a display of block in that case. 419 444 RenderBlock* result = new (arena) RenderBlock(this); … … 542 567 543 568 // For XML documents, we are non-validating and do not check against a DTD, even for HTML elements. 544 if (getDocument()->isHTMLDocument()) 545 return checkChild(id(), newChild->id(), !getDocument()->inCompatMode()); 569 DocumentImpl *doc = getDocument(); 570 if (doc && doc->isHTMLDocument()) { 571 return checkChild(id(), newChild->id(), !doc->inCompatMode()); 572 } 546 573 return true; 547 574 } … … 565 592 void ElementImpl::dispatchAttrRemovalEvent(AttributeImpl *attr) 566 593 { 567 if (!getDocument()->hasListenerType(DocumentImpl::DOMATTRMODIFIED_LISTENER)) 568 return; 594 DocumentImpl *doc = getDocument(); 595 if (doc && !doc->hasListenerType(DocumentImpl::DOMATTRMODIFIED_LISTENER)) { 596 return; 597 } 569 598 //int exceptioncode = 0; 570 599 // dispatchEvent(new MutationEventImpl(EventImpl::DOMATTRMODIFIED_EVENT,true,false,attr,attr->value(), … … 574 603 void ElementImpl::dispatchAttrAdditionEvent(AttributeImpl *attr) 575 604 { 576 if (!getDocument()->hasListenerType(DocumentImpl::DOMATTRMODIFIED_LISTENER)) 577 return; 605 DocumentImpl *doc = getDocument(); 606 if (doc && !doc->hasListenerType(DocumentImpl::DOMATTRMODIFIED_LISTENER)) { 607 return; 608 } 578 609 // int exceptioncode = 0; 579 610 // dispatchEvent(new MutationEventImpl(EventImpl::DOMATTRMODIFIED_EVENT,true,false,attr,attr->value(), … … 642 673 643 674 DocumentImpl* doc = getDocument(); 644 if (!oldId.isEmpty()) 645 doc->removeElementById(oldId, this); 646 if (!newId.isEmpty()) 647 doc->addElementById(newId, this); 675 if (!oldId.isEmpty() && doc) { 676 doc->removeElementById(oldId, this); 677 } 678 if (!newId.isEmpty() && doc) { 679 doc->addElementById(newId, this); 680 } 648 681 } 649 682 … … 737 770 DOMString XMLElementImpl::localName() const 738 771 { 739 return getDocument()->tagName(m_id); 772 DocumentImpl *doc = getDocument(); 773 if (doc) { 774 return doc->tagName(m_id); 775 } 776 else { 777 return DOMString(); 778 } 740 779 } 741 780 742 781 DOMString XMLElementImpl::namespaceURI() const 743 782 { 744 return getDocument()->namespaceURI(m_id); 783 DocumentImpl *doc = getDocument(); 784 if (doc) { 785 return doc->namespaceURI(m_id); 786 } 787 else { 788 return DOMString(); 789 } 745 790 } 746 791 … … 749 794 // ### we loose namespace here FIXME 750 795 // should pass id around 751 XMLElementImpl *clone = new XMLElementImpl(docPtr(), getDocument()->tagName(m_id).implementation()); 796 DocumentImpl *doc = getDocument(); 797 if (!doc) { 798 return 0; 799 } 800 801 XMLElementImpl *clone = new XMLElementImpl(docPtr(), doc->tagName(m_id).implementation()); 752 802 clone->m_id = m_id; 753 803 … … 905 955 assert(element); 906 956 if (!element) return 0; 907 return element->getDocument()->attrId(namespaceURI.implementation(), 957 DocumentImpl *doc = element->getDocument(); 958 if (!doc) return 0; 959 return doc->attrId(namespaceURI.implementation(), 908 960 localName.implementation(), readonly); 909 961 }
Note: See TracChangeset
for help on using the changeset viewer.