Source/WebCore/dom/DocumentMarkerController.cpp
void DocumentMarkerController::copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstNode, int delta, DocumentMarker::MarkerType markerType)
{
    if (length <= 0)
        return;

    if (!possiblyHasMarkers(markerType))
        return;
    ASSERT(!m_markers.isEmpty());

    MarkerMapVectorPair* vectorPair = m_markers.get(srcNode);
    if (!vectorPair)
        return;

    ASSERT(vectorPair->first.size() == vectorPair->second.size());

    bool docDirty = false;
    unsigned endOffset = startOffset + length - 1;
    Vector<DocumentMarker>& markers = vectorPair->first;
    for (size_t i = 0; i != markers.size(); ++i) {
        DocumentMarker marker = markers[i];

        // stop if we are now past the specified range
        if (marker.startOffset > endOffset)
            break;

        // skip marker that is before the specified range or is the wrong type
        if (marker.endOffset < startOffset || (marker.type != markerType && markerType != DocumentMarker::AllMarkers))
            continue;

        // pin the marker to the specified range and apply the shift delta
        docDirty = true;
        if (marker.startOffset < startOffset)
            marker.startOffset = startOffset;
        if (marker.endOffset > endOffset)
            marker.endOffset = endOffset;
        marker.startOffset += delta;
        marker.endOffset += delta;

        addMarker(dstNode, marker);
    }

    // repaint the affected node
    if (docDirty && dstNode->renderer())
        dstNode->renderer()->repaint();
}
// copies markers from srcNode to dstNode, applying the specified shift delta to the copies.  The shift is
// useful if, e.g., the caller has created the dstNode from a non-prefix substring of the srcNode.
copies markers from srcNode to dstNode, applying the specified shift delta to the copies.  The shift is
useful if, e.g., the caller has created the dstNode from a non-prefix substring of the srcNode.
copies markers from srcNode to dstNode applying the specified shift delta to the copies . The shift is useful if e . g . the caller has created the dstNode from a non - prefix substring of the srcNode .
void DocumentMarkerController::copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstNode, int delta, DocumentMarker::MarkerType markerType)
{
    if (length <= 0)
        return;
    if (!possiblyHasMarkers(markerType))
        return;
    ASSERT(!m_markers.isEmpty());
    MarkerMapVectorPair* vectorPair = m_markers.get(srcNode);
    if (!vectorPair)
        return;
    ASSERT(vectorPair->first.size() == vectorPair->second.size());
    bool docDirty = false;
    unsigned endOffset = startOffset + length - 1;
    Vector<DocumentMarker>& markers = vectorPair->first;
    for (size_t i = 0; i != markers.size(); ++i) {
        DocumentMarker marker = markers[i];
        if (marker.startOffset > endOffset)
            break;
        if (marker.endOffset < startOffset || (marker.type != markerType && markerType != DocumentMarker::AllMarkers))
            continue;
        docDirty = true;
        if (marker.startOffset < startOffset)
            marker.startOffset = startOffset;
        if (marker.endOffset > endOffset)
            marker.endOffset = endOffset;
        marker.startOffset += delta;
        marker.endOffset += delta;
        addMarker(dstNode, marker);
    }
    if (docDirty && dstNode->renderer())
        dstNode->renderer()->repaint();
}
void DocumentMarkerController :: copyMarkers ( Node * srcNode , unsigned startOffset , int length , Node * dstNode , int delta , DocumentMarker :: MarkerType markerType ) { if ( length <= 0 ) return ; if ( ! possiblyHasMarkers ( markerType ) ) return ; ASSERT ( ! m_markers . isEmpty ( ) ) ; MarkerMapVectorPair * vectorPair = m_markers . get ( srcNode ) ; if ( ! vectorPair ) return ; ASSERT ( vectorPair -> first . size ( ) == vectorPair -> second . size ( ) ) ; bool docDirty = false ; unsigned endOffset = startOffset + length - 1 ; Vector < DocumentMarker > & markers = vectorPair -> first ; for ( size_t i = 0 ; i != markers . size ( ) ; ++ i ) { DocumentMarker marker = markers [ i ] ; if ( marker . startOffset > endOffset ) break ; if ( marker . endOffset < startOffset || ( marker . type != markerType && markerType != DocumentMarker :: AllMarkers ) ) continue ; docDirty = true ; if ( marker . startOffset < startOffset ) marker . startOffset = startOffset ; if ( marker . endOffset > endOffset ) marker . endOffset = endOffset ; marker . startOffset += delta ; marker . endOffset += delta ; addMarker ( dstNode , marker ) ; } if ( docDirty && dstNode -> renderer ( ) ) dstNode -> renderer ( ) -> repaint ( ) ; }
copies markers from srcNode to dstNode, applying the specified shift delta to the copies.
copies markers from srcNode to dstNode applying the specified shift delta to the copies .
// stop if we are now past the specified range // skip marker that is before the specified range or is the wrong type // pin the marker to the specified range and apply the shift delta // repaint the affected node