Changeset 64889 in webkit


Ignore:
Timestamp:
Aug 6, 2010 6:30:16 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-08-06 Tony Gentilcore <tonyg@chromium.org>

Reviewed by Adam Barth.

Fix style violations in Document
https://bugs.webkit.org/show_bug.cgi?id=43657

No new tests because no new functionality.

  • dom/Document.cpp: (WebCore::acceptsEditingFocus): (WebCore::Document::Document): (WebCore::Document::importNode): (WebCore::Document::adoptNode): (WebCore::Document::getElementById): (WebCore::Document::readyState): (WebCore::Document::createTreeWalker): (WebCore::Document::shouldScheduleLayout): (WebCore::Document::nextFocusableNode): (WebCore::Document::previousFocusableNode): (WebCore::Document::nodeAbsIndex): (WebCore::Document::nodeWithAbsIndex): (WebCore::Document::childTypeAllowed): (WebCore::Document::canReplaceChild): (WebCore::Document::recalcStyleSelector): (WebCore::Document::setFocusedNode): (WebCore::Document::attachNodeIterator): (WebCore::Document::detachNodeIterator): (WebCore::Document::parseQualifiedName): (WebCore::Document::getImageMap): (WebCore::Document::setInPageCache): (WebCore::Document::addMarker): (WebCore::Document::copyMarkers): (WebCore::Document::shiftMarkers): (WebCore::Document::setMarkersActive): (WebCore::Document::parentDocument): (WebCore::Document::topDocument): (WebCore::FormElementKeyHash::hash): (WebCore::Document::initSecurityContext):
  • dom/Document.h: (WebCore::Document::incDOMTreeVersion): (WebCore::Document::domTreeVersion):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r64886 r64889  
     12010-08-06  Tony Gentilcore  <tonyg@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Fix style violations in Document
     6        https://bugs.webkit.org/show_bug.cgi?id=43657
     7
     8        No new tests because no new functionality.
     9
     10        * dom/Document.cpp:
     11        (WebCore::acceptsEditingFocus):
     12        (WebCore::Document::Document):
     13        (WebCore::Document::importNode):
     14        (WebCore::Document::adoptNode):
     15        (WebCore::Document::getElementById):
     16        (WebCore::Document::readyState):
     17        (WebCore::Document::createTreeWalker):
     18        (WebCore::Document::shouldScheduleLayout):
     19        (WebCore::Document::nextFocusableNode):
     20        (WebCore::Document::previousFocusableNode):
     21        (WebCore::Document::nodeAbsIndex):
     22        (WebCore::Document::nodeWithAbsIndex):
     23        (WebCore::Document::childTypeAllowed):
     24        (WebCore::Document::canReplaceChild):
     25        (WebCore::Document::recalcStyleSelector):
     26        (WebCore::Document::setFocusedNode):
     27        (WebCore::Document::attachNodeIterator):
     28        (WebCore::Document::detachNodeIterator):
     29        (WebCore::Document::parseQualifiedName):
     30        (WebCore::Document::getImageMap):
     31        (WebCore::Document::setInPageCache):
     32        (WebCore::Document::addMarker):
     33        (WebCore::Document::copyMarkers):
     34        (WebCore::Document::shiftMarkers):
     35        (WebCore::Document::setMarkersActive):
     36        (WebCore::Document::parentDocument):
     37        (WebCore::Document::topDocument):
     38        (WebCore::FormElementKeyHash::hash):
     39        (WebCore::Document::initSecurityContext):
     40        * dom/Document.h:
     41        (WebCore::Document::incDOMTreeVersion):
     42        (WebCore::Document::domTreeVersion):
     43
    1442010-08-06  Eric Carlson  <eric.carlson@apple.com>
    245
  • trunk/WebCore/dom/Document.cpp

    r64873 r64889  
    8080#include "HTMLNameCollection.h"
    8181#include "HTMLNames.h"
    82 #include "LegacyHTMLTreeBuilder.h"
    8382#include "HTMLStyleElement.h"
    8483#include "HTMLTitleElement.h"
    85 #include "LegacyHTMLDocumentParser.h"
    8684#include "HTTPParsers.h"
    8785#include "HistoryItem.h"
     
    9290#include "InspectorTimelineAgent.h"
    9391#include "KeyboardEvent.h"
     92#include "LegacyHTMLDocumentParser.h"
     93#include "LegacyHTMLTreeBuilder.h"
    9494#include "Logging.h"
    9595#include "MessageEvent.h"
     
    137137#include "WebKitTransitionEvent.h"
    138138#include "WheelEvent.h"
     139#include "XMLDocumentParser.h"
    139140#include "XMLHttpRequest.h"
    140141#include "XMLNSNames.h"
    141142#include "XMLNames.h"
    142 #include "XMLDocumentParser.h"
    143143#include "htmlediting.h"
    144144#include <wtf/CurrentTime.h>
     
    175175#include "SVGElementFactory.h"
    176176#include "SVGNames.h"
     177#include "SVGStyleElement.h"
    177178#include "SVGZoomEvent.h"
    178 #include "SVGStyleElement.h"
    179179#endif
    180180
     
    304304}
    305305
    306 static bool acceptsEditingFocus(Node *node)
     306static bool acceptsEditingFocus(Node* node)
    307307{
    308308    ASSERT(node);
    309309    ASSERT(node->isContentEditable());
    310310
    311     Node *root = node->rootEditableElement();
     311    Node* root = node->rootEditableElement();
    312312    Frame* frame = node->document()->frame();
    313313    if (!frame || !root)
     
    361361Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
    362362    : ContainerNode(0)
    363     , m_domtree_version(0)
     363    , m_domTreeVersion(0)
    364364    , m_styleSheets(StyleSheetList::create(this))
    365365    , m_styleRecalcTimer(this, &Document::styleRecalcTimerFired)
     
    726726
    727727    switch (importedNode->nodeType()) {
    728         case TEXT_NODE:
    729             return createTextNode(importedNode->nodeValue());
    730         case CDATA_SECTION_NODE:
    731             return createCDATASection(importedNode->nodeValue(), ec);
    732         case ENTITY_REFERENCE_NODE:
    733             return createEntityReference(importedNode->nodeName(), ec);
    734         case PROCESSING_INSTRUCTION_NODE:
    735             return createProcessingInstruction(importedNode->nodeName(), importedNode->nodeValue(), ec);
    736         case COMMENT_NODE:
    737             return createComment(importedNode->nodeValue());
    738         case ELEMENT_NODE: {
    739             Element* oldElement = static_cast<Element*>(importedNode);
    740             RefPtr<Element> newElement = createElementNS(oldElement->namespaceURI(), oldElement->tagQName().toString(), ec);
    741                        
    742             if (ec)
    743                 return 0;
    744 
    745             NamedNodeMap* attrs = oldElement->attributes(true);
    746             if (attrs) {
    747                 unsigned length = attrs->length();
    748                 for (unsigned i = 0; i < length; i++) {
    749                     Attribute* attr = attrs->attributeItem(i);
    750                     newElement->setAttribute(attr->name(), attr->value().impl(), ec);
    751                     if (ec)
    752                         return 0;
    753                 }
     728    case TEXT_NODE:
     729        return createTextNode(importedNode->nodeValue());
     730    case CDATA_SECTION_NODE:
     731        return createCDATASection(importedNode->nodeValue(), ec);
     732    case ENTITY_REFERENCE_NODE:
     733        return createEntityReference(importedNode->nodeName(), ec);
     734    case PROCESSING_INSTRUCTION_NODE:
     735        return createProcessingInstruction(importedNode->nodeName(), importedNode->nodeValue(), ec);
     736    case COMMENT_NODE:
     737        return createComment(importedNode->nodeValue());
     738    case ELEMENT_NODE: {
     739        Element* oldElement = static_cast<Element*>(importedNode);
     740        RefPtr<Element> newElement = createElementNS(oldElement->namespaceURI(), oldElement->tagQName().toString(), ec);
     741                   
     742        if (ec)
     743            return 0;
     744
     745        NamedNodeMap* attrs = oldElement->attributes(true);
     746        if (attrs) {
     747            unsigned length = attrs->length();
     748            for (unsigned i = 0; i < length; i++) {
     749                Attribute* attr = attrs->attributeItem(i);
     750                newElement->setAttribute(attr->name(), attr->value().impl(), ec);
     751                if (ec)
     752                    return 0;
    754753            }
    755 
    756             newElement->copyNonAttributeProperties(oldElement);
    757 
    758             if (deep) {
    759                 for (Node* oldChild = oldElement->firstChild(); oldChild; oldChild = oldChild->nextSibling()) {
    760                     RefPtr<Node> newChild = importNode(oldChild, true, ec);
    761                     if (ec)
    762                         return 0;
    763                     newElement->appendChild(newChild.release(), ec);
    764                     if (ec)
    765                         return 0;
    766                 }
     754        }
     755
     756        newElement->copyNonAttributeProperties(oldElement);
     757
     758        if (deep) {
     759            for (Node* oldChild = oldElement->firstChild(); oldChild; oldChild = oldChild->nextSibling()) {
     760                RefPtr<Node> newChild = importNode(oldChild, true, ec);
     761                if (ec)
     762                    return 0;
     763                newElement->appendChild(newChild.release(), ec);
     764                if (ec)
     765                    return 0;
    767766            }
    768 
    769             return newElement.release();
    770767        }
    771         case ATTRIBUTE_NODE:
    772             return Attr::create(0, this, static_cast<Attr*>(importedNode)->attr()->clone());
    773         case DOCUMENT_FRAGMENT_NODE: {
    774             DocumentFragment* oldFragment = static_cast<DocumentFragment*>(importedNode);
    775             RefPtr<DocumentFragment> newFragment = createDocumentFragment();
    776             if (deep) {
    777                 for (Node* oldChild = oldFragment->firstChild(); oldChild; oldChild = oldChild->nextSibling()) {
    778                     RefPtr<Node> newChild = importNode(oldChild, true, ec);
    779                     if (ec)
    780                         return 0;
    781                     newFragment->appendChild(newChild.release(), ec);
    782                     if (ec)
    783                         return 0;
    784                 }
     768
     769        return newElement.release();
     770    }
     771    case ATTRIBUTE_NODE:
     772        return Attr::create(0, this, static_cast<Attr*>(importedNode)->attr()->clone());
     773    case DOCUMENT_FRAGMENT_NODE: {
     774        DocumentFragment* oldFragment = static_cast<DocumentFragment*>(importedNode);
     775        RefPtr<DocumentFragment> newFragment = createDocumentFragment();
     776        if (deep) {
     777            for (Node* oldChild = oldFragment->firstChild(); oldChild; oldChild = oldChild->nextSibling()) {
     778                RefPtr<Node> newChild = importNode(oldChild, true, ec);
     779                if (ec)
     780                    return 0;
     781                newFragment->appendChild(newChild.release(), ec);
     782                if (ec)
     783                    return 0;
    785784            }
    786            
    787             return newFragment.release();
    788785        }
    789         case ENTITY_NODE:
    790         case NOTATION_NODE:
    791             // FIXME: It should be possible to import these node types, however in DOM3 the DocumentType is readonly, so there isn't much sense in doing that.
    792             // Ability to add these imported nodes to a DocumentType will be considered for addition to a future release of the DOM.
    793         case DOCUMENT_NODE:
    794         case DOCUMENT_TYPE_NODE:
    795         case XPATH_NAMESPACE_NODE:
    796             break;
     786       
     787        return newFragment.release();
     788    }
     789    case ENTITY_NODE:
     790    case NOTATION_NODE:
     791        // FIXME: It should be possible to import these node types, however in DOM3 the DocumentType is readonly, so there isn't much sense in doing that.
     792        // Ability to add these imported nodes to a DocumentType will be considered for addition to a future release of the DOM.
     793    case DOCUMENT_NODE:
     794    case DOCUMENT_TYPE_NODE:
     795    case XPATH_NAMESPACE_NODE:
     796        break;
    797797    }
    798798
     
    815815
    816816    switch (source->nodeType()) {
    817         case ENTITY_NODE:
    818         case NOTATION_NODE:
    819         case DOCUMENT_NODE:
    820         case DOCUMENT_TYPE_NODE:
    821         case XPATH_NAMESPACE_NODE:
    822             ec = NOT_SUPPORTED_ERR;
    823             return 0;           
    824         case ATTRIBUTE_NODE: {                   
    825             Attr* attr = static_cast<Attr*>(source.get());
    826             if (attr->ownerElement())
    827                 attr->ownerElement()->removeAttributeNode(attr, ec);
    828             attr->setSpecified(true);
    829             break;
    830         }       
    831         default:
    832             if (source->hasTagName(iframeTag))
    833                 static_cast<HTMLIFrameElement*>(source.get())->setRemainsAliveOnRemovalFromTree(attached());
    834 
    835             if (source->parentNode())
    836                 source->parentNode()->removeChild(source.get(), ec);
     817    case ENTITY_NODE:
     818    case NOTATION_NODE:
     819    case DOCUMENT_NODE:
     820    case DOCUMENT_TYPE_NODE:
     821    case XPATH_NAMESPACE_NODE:
     822        ec = NOT_SUPPORTED_ERR;
     823        return 0;           
     824    case ATTRIBUTE_NODE: {                   
     825        Attr* attr = static_cast<Attr*>(source.get());
     826        if (attr->ownerElement())
     827            attr->ownerElement()->removeAttributeNode(attr, ec);
     828        attr->setSpecified(true);
     829        break;
     830    }       
     831    default:
     832        if (source->hasTagName(iframeTag))
     833            static_cast<HTMLIFrameElement*>(source.get())->setRemainsAliveOnRemovalFromTree(attached());
     834
     835        if (source->parentNode())
     836            source->parentNode()->removeChild(source.get(), ec);
    837837    }
    838838               
     
    924924    if (m_duplicateIds.contains(elementId.impl())) {
    925925        // We know there's at least one node with this id, but we don't know what the first one is.
    926         for (Node *n = traverseNextNode(); n != 0; n = n->traverseNextNode()) {
     926        for (Node* n = traverseNextNode(); n; n = n->traverseNextNode()) {
    927927            if (n->isElementNode()) {
    928928                element = static_cast<Element*>(n);
     
    946946        if (parsing())
    947947            return "loading";
    948       return "loaded";
    949       // FIXME: What does "interactive" mean?
    950       // FIXME: Missing support for "uninitialized".
     948        return "loaded";
     949        // FIXME: What does "interactive" mean?
     950        // FIXME: Missing support for "uninitialized".
    951951    }
    952952    return String();
     
    13531353}
    13541354
    1355 PassRefPtr<TreeWalker> Document::createTreeWalker(Node *root, unsigned whatToShow,
     1355PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow,
    13561356    PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionCode& ec)
    13571357{
     
    20492049    //    (b) Only schedule layout once we have a body element.
    20502050
    2051     return (haveStylesheetsLoaded() && body()) ||
    2052         (documentElement() && !documentElement()->hasTagName(htmlTag));
     2051    return (haveStylesheetsLoaded() && body())
     2052        || (documentElement() && !documentElement()->hasTagName(htmlTag));
    20532053}
    20542054
     
    23202320            return winner;
    23212321
    2322         if (start->tabIndex() == 0)
     2322        if (!start->tabIndex())
    23232323            // We've reached the last node in the document with a tabindex of 0. This is the end of the tabbing order.
    23242324            return 0;
     
    23392339{
    23402340    Node* last;
    2341     for (last = this; last->lastChild(); last = last->lastChild())
    2342         ; // Empty loop.
     2341    for (last = this; last->lastChild(); last = last->lastChild()) { }
    23432342
    23442343    // First try to find the last node in the document that comes before start and has the same tabindex as start.
     
    23762375
    23772376    int absIndex = 0;
    2378     for (Node *n = node; n && n != this; n = n->traversePreviousNode())
     2377    for (Node* n = node; n && n != this; n = n->traversePreviousNode())
    23792378        absIndex++;
    23802379    return absIndex;
    23812380}
    23822381
    2383 Node *Document::nodeWithAbsIndex(int absIndex)
    2384 {
    2385     Node *n = this;
    2386     for (int i = 0; n && (i < absIndex); i++) {
     2382Node* Document::nodeWithAbsIndex(int absIndex)
     2383{
     2384    Node* n = this;
     2385    for (int i = 0; n && (i < absIndex); i++)
    23872386        n = n->traverseNextNode();
    2388     }
    23892387    return n;
    23902388}
     
    25312529{
    25322530    switch (type) {
     2531    case ATTRIBUTE_NODE:
     2532    case CDATA_SECTION_NODE:
     2533    case DOCUMENT_FRAGMENT_NODE:
     2534    case DOCUMENT_NODE:
     2535    case ENTITY_NODE:
     2536    case ENTITY_REFERENCE_NODE:
     2537    case NOTATION_NODE:
     2538    case TEXT_NODE:
     2539    case XPATH_NAMESPACE_NODE:
     2540        return false;
     2541    case COMMENT_NODE:
     2542    case PROCESSING_INSTRUCTION_NODE:
     2543        return true;
     2544    case DOCUMENT_TYPE_NODE:
     2545    case ELEMENT_NODE:
     2546        // Documents may contain no more than one of each of these.
     2547        // (One Element and one DocumentType.)
     2548        for (Node* c = firstChild(); c; c = c->nextSibling())
     2549            if (c->nodeType() == type)
     2550                return false;
     2551        return true;
     2552    }
     2553    return false;
     2554}
     2555
     2556bool Document::canReplaceChild(Node* newChild, Node* oldChild)
     2557{
     2558    if (!oldChild)
     2559        // ContainerNode::replaceChild will raise a NOT_FOUND_ERR.
     2560        return true;
     2561
     2562    if (oldChild->nodeType() == newChild->nodeType())
     2563        return true;
     2564
     2565    int numDoctypes = 0;
     2566    int numElements = 0;
     2567
     2568    // First, check how many doctypes and elements we have, not counting
     2569    // the child we're about to remove.
     2570    for (Node* c = firstChild(); c; c = c->nextSibling()) {
     2571        if (c == oldChild)
     2572            continue;
     2573       
     2574        switch (c->nodeType()) {
     2575        case DOCUMENT_TYPE_NODE:
     2576            numDoctypes++;
     2577            break;
     2578        case ELEMENT_NODE:
     2579            numElements++;
     2580            break;
     2581        default:
     2582            break;
     2583        }
     2584    }
     2585   
     2586    // Then, see how many doctypes and elements might be added by the new child.
     2587    if (newChild->nodeType() == DOCUMENT_FRAGMENT_NODE) {
     2588        for (Node* c = firstChild(); c; c = c->nextSibling()) {
     2589            switch (c->nodeType()) {
     2590            case ATTRIBUTE_NODE:
     2591            case CDATA_SECTION_NODE:
     2592            case DOCUMENT_FRAGMENT_NODE:
     2593            case DOCUMENT_NODE:
     2594            case ENTITY_NODE:
     2595            case ENTITY_REFERENCE_NODE:
     2596            case NOTATION_NODE:
     2597            case TEXT_NODE:
     2598            case XPATH_NAMESPACE_NODE:
     2599                return false;
     2600            case COMMENT_NODE:
     2601            case PROCESSING_INSTRUCTION_NODE:
     2602                break;
     2603            case DOCUMENT_TYPE_NODE:
     2604                numDoctypes++;
     2605                break;
     2606            case ELEMENT_NODE:
     2607                numElements++;
     2608                break;
     2609            }
     2610        }
     2611    } else {
     2612        switch (newChild->nodeType()) {
    25332613        case ATTRIBUTE_NODE:
    25342614        case CDATA_SECTION_NODE:
     
    25452625            return true;
    25462626        case DOCUMENT_TYPE_NODE:
     2627            numDoctypes++;
     2628            break;
    25472629        case ELEMENT_NODE:
    2548             // Documents may contain no more than one of each of these.
    2549             // (One Element and one DocumentType.)
    2550             for (Node* c = firstChild(); c; c = c->nextSibling())
    2551                 if (c->nodeType() == type)
    2552                     return false;
    2553             return true;
    2554     }
    2555     return false;
    2556 }
    2557 
    2558 bool Document::canReplaceChild(Node* newChild, Node* oldChild)
    2559 {
    2560     if (!oldChild)
    2561         // ContainerNode::replaceChild will raise a NOT_FOUND_ERR.
    2562         return true;
    2563 
    2564     if (oldChild->nodeType() == newChild->nodeType())
    2565         return true;
    2566 
    2567     int numDoctypes = 0;
    2568     int numElements = 0;
    2569 
    2570     // First, check how many doctypes and elements we have, not counting
    2571     // the child we're about to remove.
    2572     for (Node* c = firstChild(); c; c = c->nextSibling()) {
    2573         if (c == oldChild)
    2574             continue;
    2575        
    2576         switch (c->nodeType()) {
    2577             case DOCUMENT_TYPE_NODE:
    2578                 numDoctypes++;
    2579                 break;
    2580             case ELEMENT_NODE:
    2581                 numElements++;
    2582                 break;
    2583             default:
    2584                 break;
    2585         }
    2586     }
    2587    
    2588     // Then, see how many doctypes and elements might be added by the new child.
    2589     if (newChild->nodeType() == DOCUMENT_FRAGMENT_NODE) {
    2590         for (Node* c = firstChild(); c; c = c->nextSibling()) {
    2591             switch (c->nodeType()) {
    2592                 case ATTRIBUTE_NODE:
    2593                 case CDATA_SECTION_NODE:
    2594                 case DOCUMENT_FRAGMENT_NODE:
    2595                 case DOCUMENT_NODE:
    2596                 case ENTITY_NODE:
    2597                 case ENTITY_REFERENCE_NODE:
    2598                 case NOTATION_NODE:
    2599                 case TEXT_NODE:
    2600                 case XPATH_NAMESPACE_NODE:
    2601                     return false;
    2602                 case COMMENT_NODE:
    2603                 case PROCESSING_INSTRUCTION_NODE:
    2604                     break;
    2605                 case DOCUMENT_TYPE_NODE:
    2606                     numDoctypes++;
    2607                     break;
    2608                 case ELEMENT_NODE:
    2609                     numElements++;
    2610                     break;
    2611             }
    2612         }
    2613     } else {
    2614         switch (newChild->nodeType()) {
    2615             case ATTRIBUTE_NODE:
    2616             case CDATA_SECTION_NODE:
    2617             case DOCUMENT_FRAGMENT_NODE:
    2618             case DOCUMENT_NODE:
    2619             case ENTITY_NODE:
    2620             case ENTITY_REFERENCE_NODE:
    2621             case NOTATION_NODE:
    2622             case TEXT_NODE:
    2623             case XPATH_NAMESPACE_NODE:
    2624                 return false;
    2625             case COMMENT_NODE:
    2626             case PROCESSING_INSTRUCTION_NODE:
    2627                 return true;
    2628             case DOCUMENT_TYPE_NODE:
    2629                 numDoctypes++;
    2630                 break;
    2631             case ELEMENT_NODE:
    2632                 numElements++;
    2633                 break;
     2630            numElements++;
     2631            break;
    26342632        }               
    26352633    }
     
    28302828            if (e->hasLocalName(linkTag)) {
    28312829                // <LINK> element
    2832                 HTMLLinkElement* l = static_cast<HTMLLinkElement*>(n);
    2833                 if (l->isDisabled())
     2830                HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(n);
     2831                if (linkElement->isDisabled())
    28342832                    continue;
    2835                 enabledViaScript = l->isEnabledViaScript();
    2836                 if (l->isLoading()) {
     2833                enabledViaScript = linkElement->isEnabledViaScript();
     2834                if (linkElement->isLoading()) {
    28372835                    // it is loading but we should still decide which style sheet set to use
    28382836                    if (!enabledViaScript && !title.isEmpty() && m_preferredStylesheetSet.isEmpty()) {
     
    28452843                    continue;
    28462844                }
    2847                 if (!l->sheet())
     2845                if (!linkElement->sheet())
    28482846                    title = nullAtom;
    28492847            }
     
    30533051        // ### find a better place in the code for this
    30543052        if (view()) {
    3055             Widget *focusWidget = widgetForNode(m_focusedNode.get());
     3053            Widget* focusWidget = widgetForNode(m_focusedNode.get());
    30563054            if (focusWidget) {
    30573055                // Make sure a widget has the right size before giving it focus.
     
    31093107}
    31103108
    3111 void Document::attachNodeIterator(NodeIterator *ni)
     3109void Document::attachNodeIterator(NodeIterator* ni)
    31123110{
    31133111    m_nodeIterators.add(ni);
    31143112}
    31153113
    3116 void Document::detachNodeIterator(NodeIterator *ni)
     3114void Document::detachNodeIterator(NodeIterator* ni)
    31173115{
    31183116    m_nodeIterators.remove(ni);
     
    35643562    unsigned length = qualifiedName.length();
    35653563
    3566     if (length == 0) {
     3564    if (!length) {
    35673565        ec = INVALID_CHARACTER_ERR;
    35683566        return false;
     
    36473645}
    36483646
    3649 HTMLMapElement *Document::getImageMap(const String& url) const
     3647HTMLMapElement* Document::getImageMap(const String& url) const
    36503648{
    36513649    if (url.isNull())
     
    36833681    m_inPageCache = flag;
    36843682    if (flag) {
    3685         ASSERT(m_savedRenderer == 0);
     3683        ASSERT(!m_savedRenderer);
    36863684        m_savedRenderer = renderer();
    36873685        if (FrameView* v = view())
     
    36893687        unscheduleStyleRecalc();
    36903688    } else {
    3691         ASSERT(renderer() == 0 || renderer() == m_savedRenderer);
     3689        ASSERT(!renderer() || renderer() == m_savedRenderer);
    36923690        ASSERT(m_renderArena);
    36933691        setRenderer(m_savedRenderer);
     
    38053803}
    38063804
    3807 void Document::addMarker(Range *range, DocumentMarker::MarkerType type, String description)
     3805void Document::addMarker(Range* range, DocumentMarker::MarkerType type, String description)
    38083806{
    38093807    // Use a TextIterator to visit the potentially multiple nodes the range covers.
     
    39023900// copies markers from srcNode to dstNode, applying the specified shift delta to the copies.  The shift is
    39033901// useful if, e.g., the caller has created the dstNode from a non-prefix substring of the srcNode.
    3904 void Document::copyMarkers(Node *srcNode, unsigned startOffset, int length, Node *dstNode, int delta, DocumentMarker::MarkerType markerType)
     3902void Document::copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstNode, int delta, DocumentMarker::MarkerType markerType)
    39053903{
    39063904    if (length <= 0)
     
    42074205}
    42084206
    4209 void Document::shiftMarkers(Node *node, unsigned startOffset, int delta, DocumentMarker::MarkerType markerType)
     4207void Document::shiftMarkers(Node* node, unsigned startOffset, int delta, DocumentMarker::MarkerType markerType)
    42104208{
    42114209    MarkerMapVectorPair* vectorPair = m_markers.get(node);
     
    42194217    bool docDirty = false;
    42204218    for (size_t i = 0; i != markers.size(); ++i) {
    4221         DocumentMarker &marker = markers[i];
     4219        DocumentMarker& marker = markers[i];
    42224220        if (marker.startOffset >= startOffset && (markerType == DocumentMarker::AllMarkers || marker.type == markerType)) {
    42234221            ASSERT((int)marker.startOffset + delta >= 0);
     
    42644262    bool docDirty = false;
    42654263    for (size_t i = 0; i != markers.size(); ++i) {
    4266         DocumentMarker &marker = markers[i];
     4264        DocumentMarker& marker = markers[i];
    42674265
    42684266        // Markers are returned in order, so stop if we are now past the specified range.
     
    43264324}
    43274325
    4328 Document *Document::parentDocument() const
    4329 {
    4330     Frame *childPart = frame();
     4326Document* Document::parentDocument() const
     4327{
     4328    Frame* childPart = frame();
    43314329    if (!childPart)
    43324330        return 0;
    4333     Frame *parent = childPart->tree()->parent();
     4331    Frame* parent = childPart->tree()->parent();
    43344332    if (!parent)
    43354333        return 0;
     
    43374335}
    43384336
    4339 Document *Document::topDocument() const
    4340 {
    4341     Document *doc = const_cast<Document *>(this);
    4342     Element *element;
     4337Document* Document::topDocument() const
     4338{
     4339    Document* doc = const_cast<Document *>(this);
     4340    Element* element;
    43434341    while ((element = doc->ownerElement()))
    43444342        doc = element->document();
     
    46554653    // signal "hash not computed yet", using a value that is likely to be
    46564654    // effectively the same as 0 when the low bits are masked
    4657     if (hash == 0)
     4655    if (!hash)
    46584656        hash = 0x80000000;
    46594657
     
    46894687{
    46904688    if (securityOrigin() && !securityOrigin()->isEmpty())
    4691         return;  // m_securityOrigin has already been initialized.
     4689        return; // m_securityOrigin has already been initialized.
    46924690
    46934691    if (!m_frame) {
  • trunk/WebCore/dom/Document.h

    r64873 r64889  
    2929#include "CachedResourceHandle.h"
    3030#include "CheckedRadioButtons.h"
    31 #include "ContainerNode.h"
    3231#include "CollectionCache.h"
    3332#include "CollectionType.h"
    3433#include "Color.h"
     34#include "ContainerNode.h"
    3535#include "Document.h"
    3636#include "DocumentMarker.h"
     
    4949namespace WebCore {
    5050
    51     class AsyncScriptRunner;
    52     class Attr;
    53     class AXObjectCache;
    54     class CDATASection;
    55     class CachedCSSStyleSheet;
    56     class CachedScript;
    57     class CanvasRenderingContext;
    58     class CharacterData;
    59     class CSSStyleDeclaration;
    60     class CSSStyleSelector;
    61     class CSSStyleSheet;
    62     class Comment;
    63     class Database;
    64     class DOMImplementation;
    65     class DOMSelection;
    66     class DOMWindow;
    67     class DatabaseThread;
    68     class DocLoader;
    69     class DocumentFragment;
    70     class DocumentType;
    71     class DocumentWeakReference;
    72     class EditingText;
    73     class Element;
    74     class EntityReference;
    75     class Event;
    76     class EventListener;
    77     class Frame;
    78     class FrameView;
    79     class HTMLCanvasElement;
    80     class HTMLCollection;
    81     class HTMLAllCollection;
    82     class HTMLDocument;
    83     class HTMLElement;
    84     class HTMLFormElement;
    85     class HTMLFrameOwnerElement;
    86     class HTMLHeadElement;
    87     class HTMLInputElement;
    88     class HTMLMapElement;
    89     class HistoryItem;
    90     class HitTestRequest;
    91     class HitTestResult;
    92     class InspectorTimelineAgent;
    93     class IntPoint;
    94     class DOMWrapperWorld;
    95     class JSNode;
    96     class MediaCanStartListener;
    97     class MouseEventWithHitTestResults;
    98     class NodeFilter;
    99     class NodeIterator;
    100     class Page;
    101     class PlatformMouseEvent;
    102     class ProcessingInstruction;
    103     class Range;
    104     class RegisteredEventListener;
    105     class RenderArena;
    106     class RenderView;
    107     class ScriptableDocumentParser;
    108     class ScriptElementData;
    109     class SecurityOrigin;
    110     class SerializedScriptValue;
    111     class SegmentedString;
    112     class Settings;
    113     class StyleSheet;
    114     class StyleSheetList;
    115     class Text;
    116     class TextResourceDecoder;
    117     class DocumentParser;
    118     class TreeWalker;
    119     class XMLHttpRequest;
     51class AsyncScriptRunner;
     52class Attr;
     53class AXObjectCache;
     54class CDATASection;
     55class CachedCSSStyleSheet;
     56class CachedScript;
     57class CanvasRenderingContext;
     58class CharacterData;
     59class CSSStyleDeclaration;
     60class CSSStyleSelector;
     61class CSSStyleSheet;
     62class Comment;
     63class Database;
     64class DOMImplementation;
     65class DOMSelection;
     66class DOMWindow;
     67class DatabaseThread;
     68class DocLoader;
     69class DocumentFragment;
     70class DocumentType;
     71class DocumentWeakReference;
     72class EditingText;
     73class Element;
     74class EntityReference;
     75class Event;
     76class EventListener;
     77class Frame;
     78class FrameView;
     79class HTMLCanvasElement;
     80class HTMLCollection;
     81class HTMLAllCollection;
     82class HTMLDocument;
     83class HTMLElement;
     84class HTMLFormElement;
     85class HTMLFrameOwnerElement;
     86class HTMLHeadElement;
     87class HTMLInputElement;
     88class HTMLMapElement;
     89class HistoryItem;
     90class HitTestRequest;
     91class HitTestResult;
     92class InspectorTimelineAgent;
     93class IntPoint;
     94class DOMWrapperWorld;
     95class JSNode;
     96class MediaCanStartListener;
     97class MouseEventWithHitTestResults;
     98class NodeFilter;
     99class NodeIterator;
     100class Page;
     101class PlatformMouseEvent;
     102class ProcessingInstruction;
     103class Range;
     104class RegisteredEventListener;
     105class RenderArena;
     106class RenderView;
     107class ScriptableDocumentParser;
     108class ScriptElementData;
     109class SecurityOrigin;
     110class SerializedScriptValue;
     111class SegmentedString;
     112class Settings;
     113class StyleSheet;
     114class StyleSheetList;
     115class Text;
     116class TextResourceDecoder;
     117class DocumentParser;
     118class TreeWalker;
     119class XMLHttpRequest;
    120120
    121121#if ENABLE(SVG)
    122     class SVGDocumentExtensions;
    123 #endif
    124    
     122class SVGDocumentExtensions;
     123#endif
     124
    125125#if ENABLE(XSLT)
    126     class TransformSource;
     126class TransformSource;
    127127#endif
    128128
    129129#if ENABLE(XBL)
    130     class XBLBindingManager;
     130class XBLBindingManager;
    131131#endif
    132132
    133133#if ENABLE(XPATH)
    134     class XPathEvaluator;
    135     class XPathExpression;
    136     class XPathNSResolver;
    137     class XPathResult;
     134class XPathEvaluator;
     135class XPathExpression;
     136class XPathNSResolver;
     137class XPathResult;
    138138#endif
    139139
    140140#if ENABLE(DASHBOARD_SUPPORT)
    141     struct DashboardRegionValue;
    142 #endif
    143 
    144     typedef int ExceptionCode;
     141struct DashboardRegionValue;
     142#endif
     143
     144typedef int ExceptionCode;
    145145
    146146class FormElementKey {
     
    860860#endif
    861861
    862     void incDOMTreeVersion() { ++m_domtree_version; }
    863     unsigned domTreeVersion() const { return m_domtree_version; }
     862    void incDOMTreeVersion() { ++m_domTreeVersion; }
     863    unsigned domTreeVersion() const { return m_domTreeVersion; }
    864864
    865865    void setDocType(PassRefPtr<DocumentType>);
     
    10711071
    10721072    // Document URLs.
    1073     KURL m_url;  // Document.URL: The URL from which this document was retrieved.
    1074     KURL m_baseURL;  // Node.baseURI: The URL to use when resolving relative URLs.
    1075     KURL m_baseElementURL;  // The URL set by the <base> element.
    1076     KURL m_cookieURL;  // The URL to use for cookie access.
     1073    KURL m_url; // Document.URL: The URL from which this document was retrieved.
     1074    KURL m_baseURL; // Node.baseURI: The URL to use when resolving relative URLs.
     1075    KURL m_baseElementURL; // The URL set by the <base> element.
     1076    KURL m_cookieURL; // The URL to use for cookie access.
    10771077    KURL m_firstPartyForCookies; // The policy URL for third-party cookie blocking.
    10781078
     
    11251125    mutable RefPtr<Element> m_documentElement;
    11261126
    1127     unsigned m_domtree_version;
     1127    unsigned m_domTreeVersion;
    11281128   
    11291129    HashSet<NodeIterator*> m_nodeIterators;
Note: See TracChangeset for help on using the changeset viewer.