本文整理汇总了C++中MarkerList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ MarkerList::size方法的具体用法?C++ MarkerList::size怎么用?C++ MarkerList::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MarkerList
的用法示例。
在下文中一共展示了MarkerList::size方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shiftMarkers
void DocumentMarkerController::shiftMarkers(Node* node, unsigned startOffset, int delta)
{
if (!possiblyHasMarkers(DocumentMarker::AllMarkers()))
return;
ASSERT(!m_markers.isEmpty());
MarkerList* list = m_markers.get(node);
if (!list)
return;
bool docDirty = false;
for (size_t i = 0; i != list->size(); ) {
RenderedDocumentMarker& marker = list->at(i);
#if PLATFORM(IOS)
int targetStartOffset = marker.startOffset() + delta;
int targetEndOffset = marker.endOffset() + delta;
if (targetStartOffset >= node->maxCharacterOffset() || targetEndOffset <= 0) {
list->remove(i);
continue;
}
#endif
if (marker.startOffset() >= startOffset) {
ASSERT((int)marker.startOffset() + delta >= 0);
marker.shiftOffsets(delta);
docDirty = true;
// Marker moved, so previously-computed rendered rectangle is now invalid
marker.invalidate();
#if !PLATFORM(IOS)
}
#else
// FIXME: Inserting text inside a DocumentMarker does not grow the marker.
// See <https://bugs.webkit.org/show_bug.cgi?id=62504>.
} else if (marker.endOffset() > startOffset) {
示例2: repaintMarkers
void DocumentMarkerController::repaintMarkers(DocumentMarker::MarkerTypes markerTypes)
{
if (!possiblyHasMarkers(markerTypes))
return;
ASSERT(!m_markers.isEmpty());
// outer loop: process each markered node in the document
MarkerMap::iterator end = m_markers.end();
for (MarkerMap::iterator i = m_markers.begin(); i != end; ++i) {
Node* node = i->key.get();
// inner loop: process each marker in the current node
MarkerList* list = i->value.get();
bool nodeNeedsRepaint = false;
for (size_t i = 0; i != list->size(); ++i) {
DocumentMarker marker = list->at(i);
// skip nodes that are not of the specified type
if (markerTypes.contains(marker.type())) {
nodeNeedsRepaint = true;
break;
}
}
if (!nodeNeedsRepaint)
continue;
// cause the node to be redrawn
if (auto renderer = node->renderer())
renderer->repaint();
}
}
示例3: ASSERT
Vector<IntRect> DocumentMarkerController::renderedRectsForMarkers(DocumentMarker::MarkerType markerType)
{
Vector<IntRect> result;
if (!possiblyHasMarkers(markerType))
return result;
ASSERT(!(m_markers.isEmpty()));
// outer loop: process each node
MarkerMap::iterator end = m_markers.end();
for (MarkerMap::iterator nodeIterator = m_markers.begin(); nodeIterator != end; ++nodeIterator) {
// inner loop; process each marker in this node
MarkerList* list = nodeIterator->value.get();
unsigned markerCount = list->size();
for (unsigned markerIndex = 0; markerIndex < markerCount; ++markerIndex) {
const RenderedDocumentMarker& marker = list->at(markerIndex);
// skip marker that is wrong type
if (marker.type() != markerType)
continue;
if (!marker.isRendered())
continue;
result.append(marker.renderedRect());
}
}
return result;
}
示例4: markerContainingPoint
DocumentMarker* DocumentMarkerController::markerContainingPoint(const LayoutPoint& point, DocumentMarker::MarkerType markerType)
{
if (!possiblyHasMarkers(markerType))
return 0;
ASSERT(!(m_markers.isEmpty()));
// outer loop: process each node that contains any markers
MarkerMap::iterator end = m_markers.end();
for (MarkerMap::iterator nodeIterator = m_markers.begin(); nodeIterator != end; ++nodeIterator) {
// inner loop; process each marker in this node
MarkerList* list = nodeIterator->value.get();
unsigned markerCount = list->size();
for (unsigned markerIndex = 0; markerIndex < markerCount; ++markerIndex) {
RenderedDocumentMarker& marker = list->at(markerIndex);
// skip marker that is wrong type
if (marker.type() != markerType)
continue;
if (marker.contains(point))
return ▮
}
}
return 0;
}
示例5: invalidateRenderedRectsForMarkersInRect
void DocumentMarkerController::invalidateRenderedRectsForMarkersInRect(const LayoutRect& r)
{
// outer loop: process each markered node in the document
MarkerMap::iterator end = m_markers.end();
for (MarkerMap::iterator i = m_markers.begin(); i != end; ++i) {
// inner loop: process each rect in the current node
MarkerList* list = i->value.get();
for (size_t listIndex = 0; listIndex < list->size(); ++listIndex)
list->at(listIndex).invalidate(r);
}
}
示例6:
Vector<RenderedDocumentMarker*> DocumentMarkerController::markersFor(Node* node, DocumentMarker::MarkerTypes markerTypes)
{
Vector<RenderedDocumentMarker*> result;
MarkerList* list = m_markers.get(node);
if (!list)
return result;
for (size_t i = 0; i < list->size(); ++i) {
if (markerTypes.contains(list->at(i).type()))
result.append(&(list->at(i)));
}
return result;
}
示例7: copyMarkers
// 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)
{
if (length <= 0)
return;
if (!possiblyHasMarkers(DocumentMarker::AllMarkers()))
return;
ASSERT(!m_markers.isEmpty());
MarkerList* list = m_markers.get(srcNode);
if (!list)
return;
bool docDirty = false;
unsigned endOffset = startOffset + length - 1;
for (size_t i = 0; i != list->size(); ++i) {
DocumentMarker marker = list->at(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)
continue;
// pin the marker to the specified range and apply the shift delta
docDirty = true;
if (marker.startOffset() < startOffset)
marker.setStartOffset(startOffset);
if (marker.endOffset() > endOffset)
marker.setEndOffset(endOffset);
marker.shiftOffsets(delta);
addMarker(dstNode, marker);
}
// repaint the affected node
if (docDirty && dstNode->renderer())
dstNode->renderer()->repaint();
}
示例8: removeMarkersFromList
void DocumentMarkerController::removeMarkersFromList(MarkerMap::iterator iterator, DocumentMarker::MarkerTypes markerTypes)
{
bool needsRepainting = false;
bool listCanBeRemoved;
if (markerTypes == DocumentMarker::AllMarkers()) {
needsRepainting = true;
listCanBeRemoved = true;
} else {
MarkerList* list = iterator->value.get();
for (size_t i = 0; i != list->size(); ) {
DocumentMarker marker = list->at(i);
// skip nodes that are not of the specified type
if (!markerTypes.contains(marker.type())) {
++i;
continue;
}
// pitch the old marker
list->remove(i);
needsRepainting = true;
// i now is the index of the next marker
}
listCanBeRemoved = list->isEmpty();
}
if (needsRepainting) {
if (auto renderer = iterator->key->renderer())
renderer->repaint();
}
if (listCanBeRemoved) {
m_markers.remove(iterator);
if (m_markers.isEmpty())
m_possiblyExistingMarkerTypes = 0;
}
}
示例9: removeMarkers
void DocumentMarkerController::removeMarkers(Node* node, unsigned startOffset, int length, DocumentMarker::MarkerTypes markerTypes, RemovePartiallyOverlappingMarkerOrNot shouldRemovePartiallyOverlappingMarker)
{
if (length <= 0)
return;
if (!possiblyHasMarkers(markerTypes))
return;
ASSERT(!(m_markers.isEmpty()));
MarkerList* list = m_markers.get(node);
if (!list)
return;
bool docDirty = false;
unsigned endOffset = startOffset + length;
for (size_t i = 0; i < list->size();) {
DocumentMarker marker = list->at(i);
// markers are returned in order, so stop if we are now past the specified range
if (marker.startOffset() >= endOffset)
break;
// skip marker that is wrong type or before target
if (marker.endOffset() <= startOffset || !markerTypes.contains(marker.type())) {
i++;
continue;
}
// at this point we know that marker and target intersect in some way
docDirty = true;
// pitch the old marker
list->remove(i);
if (shouldRemovePartiallyOverlappingMarker)
// Stop here. Don't add resulting slices back.
continue;
// add either of the resulting slices that are left after removing target
if (startOffset > marker.startOffset()) {
DocumentMarker newLeft = marker;
newLeft.setEndOffset(startOffset);
list->insert(i, RenderedDocumentMarker(newLeft));
// i now points to the newly-inserted node, but we want to skip that one
i++;
}
if (marker.endOffset() > endOffset) {
DocumentMarker newRight = marker;
newRight.setStartOffset(endOffset);
list->insert(i, RenderedDocumentMarker(newRight));
// i now points to the newly-inserted node, but we want to skip that one
i++;
}
}
if (list->isEmpty()) {
m_markers.remove(node);
if (m_markers.isEmpty())
m_possiblyExistingMarkerTypes = 0;
}
// repaint the affected node
if (docDirty && node->renderer())
node->renderer()->repaint();
}