Changeset 87483 in webkit
- Timestamp:
- May 27, 2011 12:56:25 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87480 r87483 1 2011-05-23 MORITA Hajime <morrita@google.com> 2 3 Reviewed by Tony Chang. 4 5 [Refactoring] DocumentMarker should be carried around as a pointer, not value. 6 https://bugs.webkit.org/show_bug.cgi?id=61262 7 8 - Changed return value of markersInRange() from Vector<DocumentMarker> to Vector<DocumentMarker*>. 9 - Introduced markersFor() that returns Vector<DocumentMarker*> 10 - Removed DocumentMarkerController::setRenderedRectForMarker() which now can be replaced by 11 RenderedDocumentMarker::setRenderedRect(). 12 - This change didn't remove markersForNode() beucase there is patches on review which depends 13 markersForNode(). I'll remove its call after these patches are landed. 14 15 No new tests. No behavior change. 16 17 * WebCore.exp.in: 18 * dom/DocumentMarkerController.cpp: 19 (WebCore::DocumentMarkerController::addTextMatchMarker): 20 (WebCore::DocumentMarkerController::markersFor): 21 (WebCore::DocumentMarkerController::markersInRange): 22 (WebCore::DocumentMarkerController::hasMarkers): 23 * dom/DocumentMarkerController.h: 24 * dom/RenderedDocumentMarker.h: 25 (WebCore::toRenderedDocumentMarker): 26 * editing/CompositeEditCommand.cpp: 27 (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): 28 * editing/DeleteSelectionCommand.cpp: 29 (WebCore::DeleteSelectionCommand::originalStringForAutocorrectionAtBeginningOfSelection): 30 * editing/Editor.cpp: 31 (WebCore::Editor::selectionStartHasMarkerFor): 32 * editing/SpellingCorrectionController.cpp: 33 (WebCore::markersHaveIdenticalDescription): 34 (WebCore::SpellingCorrectionController::respondToChangedSelection): 35 (WebCore::SpellingCorrectionController::recordSpellcheckerResponseForModifiedCorrection): 36 (WebCore::SpellingCorrectionController::processMarkersOnTextToBeReplacedByResult): 37 * editing/SpellingCorrectionController.h: 38 (WebCore::SpellingCorrectionController::shouldStartTimerFor): 39 * rendering/InlineTextBox.cpp: 40 (WebCore::InlineTextBox::paintSpellingOrGrammarMarker): 41 (WebCore::InlineTextBox::paintTextMatchMarker): 42 (WebCore::InlineTextBox::computeRectForReplacementMarker): 43 (WebCore::InlineTextBox::paintDocumentMarkers): 44 * rendering/InlineTextBox.h: 45 * rendering/svg/SVGInlineFlowBox.cpp: 46 (WebCore::SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer): 47 1 48 2011-05-26 MORITA Hajime <morrita@google.com> 2 49 -
trunk/Source/WebCore/WebCore.exp.in
r87335 r87483 584 584 __ZN7WebCore24CachedResourceHandleBase11setResourceEPNS_14CachedResourceE 585 585 __ZN7WebCore24DocumentMarkerController13removeMarkersENS_14DocumentMarker11MarkerTypesE 586 __ZN7WebCore24DocumentMarkerController14markersForNodeEPNS_4NodeE587 __ZN7WebCore24DocumentMarkerController14markersForNodeEPNS_4NodeE588 586 __ZN7WebCore24DocumentMarkerController23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE 589 587 __ZN7WebCore24contextMenuItemTagItalicEv -
trunk/Source/WebCore/dom/DocumentMarkerController.cpp
r86813 r87483 94 94 // matches off-screen are (that haven't been painted yet). 95 95 Node* node = textPiece->startContainer(exception); 96 Vector<DocumentMarker> markers = markersForNode(node); 97 setRenderedRectForMarker(textPiece->startContainer(exception), 98 markers[markers.size() - 1], 99 range->boundingBox()); 96 Vector<DocumentMarker*> markers = markersFor(node); 97 static_cast<RenderedDocumentMarker*>(markers[markers.size() - 1])->setRenderedRect(range->boundingBox()); 100 98 } 101 99 } … … 317 315 } 318 316 317 Vector<DocumentMarker*> DocumentMarkerController::markersFor(Node* node) 318 { 319 Vector<DocumentMarker*> result; 320 MarkerList* list = m_markers.get(node); 321 if (!list) 322 return result; 323 324 for (size_t i = 0; i < list->size(); ++i) 325 result.append(&(list->at(i))); 326 327 return result; 328 } 329 330 // FIXME: Should be removed after all relevant patches are landed 319 331 Vector<DocumentMarker> DocumentMarkerController::markersForNode(Node* node) 320 332 { … … 330 342 } 331 343 332 Vector<DocumentMarker > DocumentMarkerController::markersInRange(Range* range, DocumentMarker::MarkerTypes markerTypes)344 Vector<DocumentMarker*> DocumentMarkerController::markersInRange(Range* range, DocumentMarker::MarkerTypes markerTypes) 333 345 { 334 346 if (!possiblyHasMarkers(markerTypes)) 335 return Vector<DocumentMarker >();336 337 Vector<DocumentMarker > foundMarkers;347 return Vector<DocumentMarker*>(); 348 349 Vector<DocumentMarker*> foundMarkers; 338 350 339 351 Node* startContainer = range->startContainer(); … … 344 356 Node* pastLastNode = range->pastLastNode(); 345 357 for (Node* node = range->firstNode(); node != pastLastNode; node = node->traverseNextNode()) { 346 Vector<DocumentMarker> markers = markersForNode(node); 347 Vector<DocumentMarker>::const_iterator end = markers.end(); 348 for (Vector<DocumentMarker>::const_iterator it = markers.begin(); it != end; ++it) { 349 if (!markerTypes.contains(it->type())) 350 continue; 351 if (node == startContainer && it->endOffset() <= static_cast<unsigned>(range->startOffset())) 352 continue; 353 if (node == endContainer && it->startOffset() >= static_cast<unsigned>(range->endOffset())) 354 continue; 355 foundMarkers.append(*it); 358 Vector<DocumentMarker*> markers = markersFor(node); 359 Vector<DocumentMarker*>::const_iterator end = markers.end(); 360 for (Vector<DocumentMarker*>::const_iterator it = markers.begin(); it != end; ++it) { 361 DocumentMarker* marker = *it; 362 if (!markerTypes.contains(marker->type())) 363 continue; 364 if (node == startContainer && marker->endOffset() <= static_cast<unsigned>(range->startOffset())) 365 continue; 366 if (node == endContainer && marker->startOffset() >= static_cast<unsigned>(range->endOffset())) 367 continue; 368 foundMarkers.append(marker); 356 369 } 357 370 } … … 491 504 } 492 505 493 void DocumentMarkerController::setRenderedRectForMarker(Node* node, const DocumentMarker& marker, const IntRect& r)494 {495 MarkerList* list = m_markers.get(node);496 if (!list) {497 ASSERT_NOT_REACHED(); // shouldn't be trying to set the rect for a marker we don't already know about498 return;499 }500 501 size_t markerCount = list->size();502 for (size_t markerIndex = 0; markerIndex < markerCount; ++markerIndex) {503 RenderedDocumentMarker& m = list->at(markerIndex);504 if (m == marker) {505 m.setRenderedRect(r);506 return;507 }508 }509 510 ASSERT_NOT_REACHED(); // shouldn't be trying to set the rect for a marker we don't already know about511 }512 513 506 void DocumentMarkerController::invalidateRenderedRectsForMarkersInRect(const IntRect& r) 514 507 { … … 610 603 Node* pastLastNode = range->pastLastNode(); 611 604 for (Node* node = range->firstNode(); node != pastLastNode; node = node->traverseNextNode()) { 612 Vector<DocumentMarker> markers = markersForNode(node); 613 Vector<DocumentMarker>::const_iterator end = markers.end(); 614 for (Vector<DocumentMarker>::const_iterator it = markers.begin(); it != end; ++it) { 615 if (!markerTypes.contains(it->type())) 616 continue; 617 if (node == startContainer && it->endOffset() <= static_cast<unsigned>(range->startOffset())) 618 continue; 619 if (node == endContainer && it->startOffset() >= static_cast<unsigned>(range->endOffset())) 605 Vector<DocumentMarker*> markers = markersFor(node); 606 Vector<DocumentMarker*>::const_iterator end = markers.end(); 607 for (Vector<DocumentMarker*>::const_iterator it = markers.begin(); it != end; ++it) { 608 DocumentMarker* marker = *it; 609 if (!markerTypes.contains(marker->type())) 610 continue; 611 if (node == startContainer && marker->endOffset() <= static_cast<unsigned>(range->startOffset())) 612 continue; 613 if (node == endContainer && marker->startOffset() >= static_cast<unsigned>(range->endOffset())) 620 614 continue; 621 615 return true; -
trunk/Source/WebCore/dom/DocumentMarkerController.h
r86813 r87483 65 65 void removeMarkers(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); 66 66 void repaintMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); 67 void setRenderedRectForMarker(Node*, const DocumentMarker&, const IntRect&);68 67 void invalidateRenderedRectsForMarkersInRect(const IntRect&); 69 68 void shiftMarkers(Node*, unsigned startOffset, int delta); … … 72 71 73 72 DocumentMarker* markerContainingPoint(const IntPoint&, DocumentMarker::MarkerType); 73 Vector<DocumentMarker*> markersFor(Node*); 74 Vector<DocumentMarker*> markersInRange(Range*, DocumentMarker::MarkerTypes); 74 75 Vector<DocumentMarker> markersForNode(Node*); 75 Vector<DocumentMarker> markersInRange(Range*, DocumentMarker::MarkerTypes);76 76 Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType); 77 77 void clearDescriptionOnMarkersIntersectingRange(Range*, DocumentMarker::MarkerTypes); -
trunk/Source/WebCore/dom/RenderedDocumentMarker.h
r85118 r87483 63 63 } 64 64 65 inline RenderedDocumentMarker* toRenderedDocumentMarker(DocumentMarker* marker) 66 { 67 return static_cast<RenderedDocumentMarker*>(marker); 68 } 69 65 70 } // namespace 66 71 -
trunk/Source/WebCore/editing/CompositeEditCommand.cpp
r87067 r87483 343 343 RefPtr<Text> node(prpNode); 344 344 DocumentMarkerController* markerController = document()->markers(); 345 Vector<DocumentMarker > markers = markerController->markersInRange(Range::create(document(), node, offset, node, offset + count).get(), DocumentMarker::AllMarkers());345 Vector<DocumentMarker*> markers = markerController->markersInRange(Range::create(document(), node, offset, node, offset + count).get(), DocumentMarker::AllMarkers()); 346 346 replaceTextInNode(node, offset, count, replacementText); 347 347 RefPtr<Range> newRange = Range::create(document(), node, offset, node, offset + replacementText.length()); 348 348 for (size_t i = 0; i < markers.size(); ++i) { 349 if (markers[i] .hasDescription())350 markerController->addMarker(newRange.get(), markers[i] .type(), markers[i].description());349 if (markers[i]->hasDescription()) 350 markerController->addMarker(newRange.get(), markers[i]->type(), markers[i]->description()); 351 351 else 352 markerController->addMarker(newRange.get(), markers[i] .type());352 markerController->addMarker(newRange.get(), markers[i]->type()); 353 353 } 354 354 } -
trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp
r86813 r87483 760 760 761 761 RefPtr<Range> rangeOfFirstCharacter = Range::create(document(), startOfSelection.deepEquivalent(), nextPosition.deepEquivalent()); 762 Vector<DocumentMarker > markers = document()->markers()->markersInRange(rangeOfFirstCharacter.get(), DocumentMarker::Autocorrected);762 Vector<DocumentMarker*> markers = document()->markers()->markersInRange(rangeOfFirstCharacter.get(), DocumentMarker::Autocorrected); 763 763 for (size_t i = 0; i < markers.size(); ++i) { 764 const DocumentMarker &marker = markers[i];765 int startOffset = marker .startOffset();764 const DocumentMarker* marker = markers[i]; 765 int startOffset = marker->startOffset(); 766 766 if (startOffset == startOfSelection.deepEquivalent().offsetInContainerNode()) 767 return marker .description();767 return marker->description(); 768 768 } 769 769 return String(); -
trunk/Source/WebCore/editing/Editor.cpp
r87117 r87483 3200 3200 unsigned int startOffset = static_cast<unsigned int>(from); 3201 3201 unsigned int endOffset = static_cast<unsigned int>(from + length); 3202 Vector<DocumentMarker > markers = m_frame->document()->markers()->markersForNode(node);3202 Vector<DocumentMarker*> markers = m_frame->document()->markers()->markersFor(node); 3203 3203 for (size_t i = 0; i < markers.size(); ++i) { 3204 DocumentMarker marker = markers[i];3205 if (marker .startOffset() <= startOffset && endOffset <= marker.endOffset() && marker.type() == markerType)3204 DocumentMarker* marker = markers[i]; 3205 if (marker->startOffset() <= startOffset && endOffset <= marker->endOffset() && marker->type() == markerType) 3206 3206 return true; 3207 3207 } -
trunk/Source/WebCore/editing/SpellingCorrectionController.cpp
r87117 r87483 73 73 } 74 74 75 static bool markersHaveIdenticalDescription(const Vector<DocumentMarker >& markers)75 static bool markersHaveIdenticalDescription(const Vector<DocumentMarker*>& markers) 76 76 { 77 77 if (markers.isEmpty()) 78 78 return true; 79 79 80 const String& description = markers[0] .description();80 const String& description = markers[0]->description(); 81 81 for (size_t i = 1; i < markers.size(); ++i) { 82 if (description != markers[i] .description())82 if (description != markers[i]->description()) 83 83 return false; 84 84 } … … 404 404 Node* node = position.containerNode(); 405 405 int endOffset = position.offsetInContainerNode(); 406 Vector<DocumentMarker > markers = node->document()->markers()->markersForNode(node);406 Vector<DocumentMarker*> markers = node->document()->markers()->markersFor(node); 407 407 size_t markerCount = markers.size(); 408 408 for (size_t i = 0; i < markerCount; ++i) { 409 const DocumentMarker &marker = markers[i];409 const DocumentMarker* marker = markers[i]; 410 410 if (!shouldStartTimerFor(marker, endOffset)) 411 411 continue; 412 RefPtr<Range> wordRange = Range::create(m_frame->document(), node, marker .startOffset(), node, marker.endOffset());412 RefPtr<Range> wordRange = Range::create(m_frame->document(), node, marker->startOffset(), node, marker->endOffset()); 413 413 String currentWord = plainText(wordRange.get()); 414 414 if (!currentWord.length()) … … 417 417 m_correctionPanelInfo.rangeToBeReplaced = wordRange; 418 418 m_correctionPanelInfo.replacedString = currentWord; 419 if (marker .type() == DocumentMarker::Spelling)419 if (marker->type() == DocumentMarker::Spelling) 420 420 startCorrectionPanelTimer(CorrectionPanelInfo::PanelTypeSpellingSuggestions); 421 421 else { 422 m_correctionPanelInfo.replacementString = marker .description();422 m_correctionPanelInfo.replacementString = marker->description(); 423 423 startCorrectionPanelTimer(CorrectionPanelInfo::PanelTypeReversion); 424 424 } … … 495 495 return; 496 496 DocumentMarkerController* markers = rangeOfCorrection->startContainer()->document()->markers(); 497 Vector<DocumentMarker > correctedOnceMarkers = markers->markersInRange(rangeOfCorrection, DocumentMarker::Autocorrected);497 Vector<DocumentMarker*> correctedOnceMarkers = markers->markersInRange(rangeOfCorrection, DocumentMarker::Autocorrected); 498 498 if (correctedOnceMarkers.isEmpty()) 499 499 return; … … 501 501 // Spelling corrected text has been edited. We need to determine whether user has reverted it to original text or 502 502 // edited it to something else, and notify spellchecker accordingly. 503 if (markersHaveIdenticalDescription(correctedOnceMarkers) && correctedOnceMarkers[0] .description() == corrected)503 if (markersHaveIdenticalDescription(correctedOnceMarkers) && correctedOnceMarkers[0]->description() == corrected) 504 504 client()->recordAutocorrectionResponse(EditorClient::AutocorrectionReverted, corrected, correction); 505 505 else … … 551 551 RefPtr<Range> precedingCharacterRange = Range::create(m_frame->document(), precedingCharacterPosition, beginningOfRange); 552 552 553 Vector<DocumentMarker > markers = markerController->markersInRange(precedingCharacterRange.get(), DocumentMarker::DeletedAutocorrection);553 Vector<DocumentMarker*> markers = markerController->markersInRange(precedingCharacterRange.get(), DocumentMarker::DeletedAutocorrection); 554 554 555 555 for (size_t i = 0; i < markers.size(); ++i) { 556 if (markers[i] .description() == stringToBeReplaced)556 if (markers[i]->description() == stringToBeReplaced) 557 557 return false; 558 558 } -
trunk/Source/WebCore/editing/SpellingCorrectionController.h
r87122 r87483 117 117 void recordAutocorrectionResponseReversed(const String& replacedString, const String& replacementString); 118 118 119 bool shouldStartTimerFor(const DocumentMarker &marker, int endOffset) const119 bool shouldStartTimerFor(const DocumentMarker* marker, int endOffset) const 120 120 { 121 return (((marker .type() == DocumentMarker::Replacement && !marker.description().isNull())122 || marker .type() == DocumentMarker::Spelling) && static_cast<int>(marker.endOffset()) == endOffset);121 return (((marker->type() == DocumentMarker::Replacement && !marker->description().isNull()) 122 || marker->type() == DocumentMarker::Spelling) && static_cast<int>(marker->endOffset()) == endOffset); 123 123 } 124 124 -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r87152 r87483 35 35 #include "Page.h" 36 36 #include "PaintInfo.h" 37 #include "RenderedDocumentMarker.h" 37 38 #include "RenderArena.h" 38 39 #include "RenderBR.h" … … 970 971 } 971 972 972 void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, const DocumentMarker&marker, RenderStyle* style, const Font& font, bool grammar)973 void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, RenderStyle* style, const Font& font, bool grammar) 973 974 { 974 975 // Never print spelling/grammar markers (5327887) … … 984 985 // Determine whether we need to measure text 985 986 bool markerSpansWholeBox = true; 986 if (m_start <= (int)marker .startOffset())987 if (m_start <= (int)marker->startOffset()) 987 988 markerSpansWholeBox = false; 988 if ((end() + 1) != marker .endOffset()) // end points at the last char, not past it989 if ((end() + 1) != marker->endOffset()) // end points at the last char, not past it 989 990 markerSpansWholeBox = false; 990 991 if (m_truncation != cNoTruncation) … … 992 993 993 994 if (!markerSpansWholeBox || grammar) { 994 int startPosition = max<int>(marker .startOffset() - m_start, 0);995 int endPosition = min<int>(marker .endOffset() - m_start, m_len);995 int startPosition = max<int>(marker->startOffset() - m_start, 0); 996 int endPosition = min<int>(marker->endOffset() - m_start, m_len); 996 997 997 998 if (m_truncation != cNoTruncation) … … 1014 1015 markerRect.move(-boxOrigin.x(), -boxOrigin.y()); 1015 1016 markerRect = renderer()->localToAbsoluteQuad(FloatRect(markerRect)).enclosingBoundingBox(); 1016 renderer()->document()->markers()->setRenderedRectForMarker(renderer()->node(), marker,markerRect);1017 toRenderedDocumentMarker(marker)->setRenderedRect(markerRect); 1017 1018 } 1018 1019 } … … 1035 1036 underlineOffset = baseline + 2; 1036 1037 } 1037 pt->drawLineForTextChecking(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + underlineOffset), width, textCheckingLineStyleForMarkerType(marker .type()));1038 } 1039 1040 void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, const DocumentMarker&marker, RenderStyle* style, const Font& font)1038 pt->drawLineForTextChecking(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + underlineOffset), width, textCheckingLineStyleForMarkerType(marker->type())); 1039 } 1040 1041 void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, RenderStyle* style, const Font& font) 1041 1042 { 1042 1043 // Use same y positioning and height as for selection, so that when the selection and this highlight are on … … 1045 1046 int selHeight = selectionHeight(); 1046 1047 1047 int sPos = max(marker .startOffset() - m_start, (unsigned)0);1048 int ePos = min(marker .endOffset() - m_start, (unsigned)m_len);1048 int sPos = max(marker->startOffset() - m_start, (unsigned)0); 1049 int ePos = min(marker->endOffset() - m_start, (unsigned)m_len); 1049 1050 TextRun run = constructTextRun(style, font); 1051 1050 1052 // Always compute and store the rect associated with this marker. The computed rect is in absolute coordinates. 1051 1053 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, IntPoint(m_x, selectionTop()), selHeight, sPos, ePos)); 1052 1054 markerRect = renderer()->localToAbsoluteQuad(FloatRect(markerRect)).enclosingBoundingBox(); 1053 renderer()->document()->markers()->setRenderedRectForMarker(renderer()->node(), marker,markerRect);1055 toRenderedDocumentMarker(marker)->setRenderedRect(markerRect); 1054 1056 1055 1057 // Optionally highlight the text 1056 1058 if (renderer()->frame()->editor()->markedTextMatchesAreHighlighted()) { 1057 Color color = marker .activeMatch() ?1059 Color color = marker->activeMatch() ? 1058 1060 renderer()->theme()->platformActiveTextSearchHighlightColor() : 1059 1061 renderer()->theme()->platformInactiveTextSearchHighlightColor(); … … 1065 1067 } 1066 1068 1067 void InlineTextBox::computeRectForReplacementMarker( const DocumentMarker&marker, RenderStyle* style, const Font& font)1069 void InlineTextBox::computeRectForReplacementMarker(DocumentMarker* marker, RenderStyle* style, const Font& font) 1068 1070 { 1069 1071 // Replacement markers are not actually drawn, but their rects need to be computed for hit testing. … … 1071 1073 int h = selectionHeight(); 1072 1074 1073 1074 int sPos = max(marker.startOffset() - m_start, (unsigned)0); 1075 int ePos = min(marker.endOffset() - m_start, (unsigned)m_len); 1075 int sPos = max(marker->startOffset() - m_start, (unsigned)0); 1076 int ePos = min(marker->endOffset() - m_start, (unsigned)m_len); 1076 1077 TextRun run = constructTextRun(style, font); 1077 1078 IntPoint startPoint = IntPoint(m_x, y); … … 1080 1081 IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, startPoint, h, sPos, ePos)); 1081 1082 markerRect = renderer()->localToAbsoluteQuad(FloatRect(markerRect)).enclosingBoundingBox(); 1082 renderer()->document()->markers()->setRenderedRectForMarker(renderer()->node(), marker,markerRect);1083 toRenderedDocumentMarker(marker)->setRenderedRect(markerRect); 1083 1084 } 1084 1085 … … 1088 1089 return; 1089 1090 1090 Vector<DocumentMarker > markers = renderer()->document()->markers()->markersForNode(renderer()->node());1091 Vector<DocumentMarker >::iterator markerIt = markers.begin();1091 Vector<DocumentMarker*> markers = renderer()->document()->markers()->markersFor(renderer()->node()); 1092 Vector<DocumentMarker*>::const_iterator markerIt = markers.begin(); 1092 1093 1093 1094 // Give any document markers that touch this run a chance to draw before the text has been drawn. 1094 1095 // Note end() points at the last char, not one past it like endOffset and ranges do. 1095 1096 for ( ; markerIt != markers.end(); markerIt++) { 1096 const DocumentMarker&marker = *markerIt;1097 DocumentMarker* marker = *markerIt; 1097 1098 1098 1099 // Paint either the background markers or the foreground markers, but not both 1099 switch (marker .type()) {1100 switch (marker->type()) { 1100 1101 case DocumentMarker::Grammar: 1101 1102 case DocumentMarker::Spelling: … … 1113 1114 } 1114 1115 1115 if (marker .endOffset() <= start())1116 if (marker->endOffset() <= start()) 1116 1117 // marker is completely before this run. This might be a marker that sits before the 1117 1118 // first run we draw, or markers that were within runs we skipped due to truncation. 1118 1119 continue; 1119 1120 1120 if (marker .startOffset() > end())1121 if (marker->startOffset() > end()) 1121 1122 // marker is completely after this run, bail. A later run will paint it. 1122 1123 break; 1123 1124 1124 1125 // marker intersects this run. Paint it. 1125 switch (marker .type()) {1126 switch (marker->type()) { 1126 1127 case DocumentMarker::Spelling: 1127 1128 paintSpellingOrGrammarMarker(pt, boxOrigin, marker, style, font, false); -
trunk/Source/WebCore/rendering/InlineTextBox.h
r87152 r87483 176 176 void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, int decoration, const ShadowData*); 177 177 void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&); 178 void paintSpellingOrGrammarMarker(GraphicsContext*, const FloatPoint& boxOrigin, const DocumentMarker&, RenderStyle*, const Font&, bool grammar);179 void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOrigin, const DocumentMarker&, RenderStyle*, const Font&);180 void computeRectForReplacementMarker( const DocumentMarker&, RenderStyle*, const Font&);178 void paintSpellingOrGrammarMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&, bool grammar); 179 void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&); 180 void computeRectForReplacementMarker(DocumentMarker*, RenderStyle*, const Font&); 181 181 182 182 TextRun::ExpansionBehavior expansionBehavior() const -
trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp
r86813 r87483 28 28 #include "GraphicsContext.h" 29 29 #include "RenderSVGInlineText.h" 30 #include "RenderedDocumentMarker.h" 30 31 #include "SVGInlineTextBox.h" 31 32 #include "SVGRenderSupport.h" … … 93 94 AffineTransform fragmentTransform; 94 95 Document* document = textRenderer->document(); 95 Vector<DocumentMarker > markers = document->markers()->markersForNode(textRenderer->node());96 Vector<DocumentMarker*> markers = document->markers()->markersFor(textRenderer->node()); 96 97 97 Vector<DocumentMarker >::iterator markerEnd = markers.end();98 for (Vector<DocumentMarker >::iterator markerIt = markers.begin(); markerIt != markerEnd; ++markerIt) {99 const DocumentMarker&marker = *markerIt;98 Vector<DocumentMarker*>::iterator markerEnd = markers.end(); 99 for (Vector<DocumentMarker*>::iterator markerIt = markers.begin(); markerIt != markerEnd; ++markerIt) { 100 DocumentMarker* marker = *markerIt; 100 101 101 102 // SVG is only interessted in the TextMatch marker, for now. 102 if (marker .type() != DocumentMarker::TextMatch)103 if (marker->type() != DocumentMarker::TextMatch) 103 104 continue; 104 105 … … 110 111 SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(box); 111 112 112 int markerStartPosition = max<int>(marker .startOffset() - textBox->start(), 0);113 int markerEndPosition = min<int>(marker .endOffset() - textBox->start(), textBox->len());113 int markerStartPosition = max<int>(marker->startOffset() - textBox->start(), 0); 114 int markerEndPosition = min<int>(marker->endOffset() - textBox->start(), textBox->len()); 114 115 115 116 if (markerStartPosition >= markerEndPosition) … … 138 139 } 139 140 140 document->markers()->setRenderedRectForMarker(node, marker,textRenderer->localToAbsoluteQuad(markerRect).enclosingBoundingBox());141 toRenderedDocumentMarker(marker)->setRenderedRect(textRenderer->localToAbsoluteQuad(markerRect).enclosingBoundingBox()); 141 142 } 142 143 }
Note: See TracChangeset
for help on using the changeset viewer.