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

Side by Side Diff: WebCore/dom/Element.cpp

Issue 3565007: Merge 68096 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 years, 2 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
« no previous file with comments | « WebCore/dom/Document.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 // with a non-null namespace, because it will return true if the local name happens to match 556 // with a non-null namespace, because it will return true if the local name happens to match
557 // but the namespace does not. 557 // but the namespace does not.
558 if (localName == document()->idAttributeName().localName()) 558 if (localName == document()->idAttributeName().localName())
559 updateId(old ? old->value() : nullAtom, value); 559 updateId(old ? old->value() : nullAtom, value);
560 560
561 if (old && value.isNull()) 561 if (old && value.isNull())
562 m_attributeMap->removeAttribute(old->name()); 562 m_attributeMap->removeAttribute(old->name());
563 else if (!old && !value.isNull()) 563 else if (!old && !value.isNull())
564 m_attributeMap->addAttribute(createAttribute(QualifiedName(nullAtom, loc alName, nullAtom), value)); 564 m_attributeMap->addAttribute(createAttribute(QualifiedName(nullAtom, loc alName, nullAtom), value));
565 else if (old && !value.isNull()) { 565 else if (old && !value.isNull()) {
566 old->setValue(value); 566 if (Attr* attrNode = old->attr())
567 attrNode->setValue(value);
568 else
569 old->setValue(value);
567 attributeChanged(old); 570 attributeChanged(old);
568 } 571 }
569 572
570 #if ENABLE(INSPECTOR) 573 #if ENABLE(INSPECTOR)
571 if (!isSynchronizingStyleAttribute()) 574 if (!isSynchronizingStyleAttribute())
572 InspectorController::didModifyDOMAttr(this); 575 InspectorController::didModifyDOMAttr(this);
573 #endif 576 #endif
574 } 577 }
575 578
576 void Element::setAttribute(const QualifiedName& name, const AtomicString& value, ExceptionCode&) 579 void Element::setAttribute(const QualifiedName& name, const AtomicString& value, ExceptionCode&)
577 { 580 {
578 #if ENABLE(INSPECTOR) 581 #if ENABLE(INSPECTOR)
579 if (!isSynchronizingStyleAttribute()) 582 if (!isSynchronizingStyleAttribute())
580 InspectorController::willModifyDOMAttr(this); 583 InspectorController::willModifyDOMAttr(this);
581 #endif 584 #endif
582 585
583 document()->incDOMTreeVersion(); 586 document()->incDOMTreeVersion();
584 587
585 // Allocate attribute map if necessary. 588 // Allocate attribute map if necessary.
586 Attribute* old = attributes(false)->getAttributeItem(name); 589 Attribute* old = attributes(false)->getAttributeItem(name);
587 590
588 if (isIdAttributeName(name)) 591 if (isIdAttributeName(name))
589 updateId(old ? old->value() : nullAtom, value); 592 updateId(old ? old->value() : nullAtom, value);
590 593
591 if (old && value.isNull()) 594 if (old && value.isNull())
592 m_attributeMap->removeAttribute(name); 595 m_attributeMap->removeAttribute(name);
593 else if (!old && !value.isNull()) 596 else if (!old && !value.isNull())
594 m_attributeMap->addAttribute(createAttribute(name, value)); 597 m_attributeMap->addAttribute(createAttribute(name, value));
595 else if (old) { 598 else if (old) {
596 old->setValue(value); 599 if (Attr* attrNode = old->attr())
600 attrNode->setValue(value);
601 else
602 old->setValue(value);
597 attributeChanged(old); 603 attributeChanged(old);
598 } 604 }
599 605
600 #if ENABLE(INSPECTOR) 606 #if ENABLE(INSPECTOR)
601 if (!isSynchronizingStyleAttribute()) 607 if (!isSynchronizingStyleAttribute())
602 InspectorController::didModifyDOMAttr(this); 608 InspectorController::didModifyDOMAttr(this);
603 #endif 609 #endif
604 } 610 }
605 611
606 PassRefPtr<Attribute> Element::createAttribute(const QualifiedName& name, const AtomicString& value) 612 PassRefPtr<Attribute> Element::createAttribute(const QualifiedName& name, const AtomicString& value)
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 #endif 1625 #endif
1620 1626
1621 #if ENABLE(FULLSCREEN_API) 1627 #if ENABLE(FULLSCREEN_API)
1622 void Element::webkitRequestFullScreen(unsigned short flags) 1628 void Element::webkitRequestFullScreen(unsigned short flags)
1623 { 1629 {
1624 document()->webkitRequestFullScreenForElement(this, flags); 1630 document()->webkitRequestFullScreenForElement(this, flags);
1625 } 1631 }
1626 #endif 1632 #endif
1627 1633
1628 } // namespace WebCore 1634 } // namespace WebCore
OLDNEW
« no previous file with comments | « WebCore/dom/Document.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698