Changeset 86704 in webkit
- Timestamp:
- May 17, 2011 1:39:18 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86703 r86704 1 2011-05-17 Andrew Wilson <atwilson@chromium.org> 2 3 Unreviewed, rolling out r86647. 4 http://trac.webkit.org/changeset/86647 5 https://bugs.webkit.org/show_bug.cgi?id=56814 6 7 Broke tests downstream in Chromium 8 9 * dom/DocumentMarker.h: 10 (WebCore::DocumentMarker::operator==): 11 (WebCore::DocumentMarker::operator!=): 12 * dom/DocumentMarkerController.cpp: 13 (WebCore::DocumentMarkerController::addMarker): 14 (WebCore::DocumentMarkerController::copyMarkers): 15 (WebCore::DocumentMarkerController::removeMarkers): 16 (WebCore::DocumentMarkerController::markerContainingPoint): 17 (WebCore::DocumentMarkerController::markersInRange): 18 (WebCore::DocumentMarkerController::renderedRectsForMarkers): 19 (WebCore::DocumentMarkerController::removeMarkersFromList): 20 (WebCore::DocumentMarkerController::repaintMarkers): 21 (WebCore::DocumentMarkerController::shiftMarkers): 22 (WebCore::DocumentMarkerController::setMarkersActive): 23 (WebCore::DocumentMarkerController::hasMarkers): 24 (WebCore::DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange): 25 (WebCore::DocumentMarkerController::showMarkers): 26 * dom/DocumentMarkerController.h: 27 * editing/CompositeEditCommand.cpp: 28 (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): 29 * editing/DeleteSelectionCommand.cpp: 30 (WebCore::DeleteSelectionCommand::originalStringForAutocorrectionAtBeginningOfSelection): 31 * editing/Editor.cpp: 32 (WebCore::Editor::selectionStartHasMarkerFor): 33 * editing/SpellingCorrectionController.cpp: 34 (WebCore::SpellingCorrectionController::respondToChangedSelection): 35 * editing/SpellingCorrectionController.h: 36 (WebCore::SpellingCorrectionController::shouldStartTimerFor): 37 * rendering/HitTestResult.cpp: 38 (WebCore::HitTestResult::spellingToolTip): 39 (WebCore::HitTestResult::replacedString): 40 * rendering/InlineTextBox.cpp: 41 (WebCore::InlineTextBox::paintSpellingOrGrammarMarker): 42 (WebCore::InlineTextBox::paintTextMatchMarker): 43 (WebCore::InlineTextBox::computeRectForReplacementMarker): 44 (WebCore::InlineTextBox::paintDocumentMarkers): 45 * rendering/svg/SVGInlineFlowBox.cpp: 46 (WebCore::SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer): 47 1 48 2011-05-17 Andrew Wilson <atwilson@chromium.org> 2 49 -
trunk/Source/WebCore/dom/DocumentMarker.h
r86647 r86704 85 85 } 86 86 }; 87 88 89 DocumentMarker(); 90 DocumentMarker(MarkerType, unsigned startOffset, unsigned endOffset); 91 DocumentMarker(MarkerType, unsigned startOffset, unsigned endOffset, const String& description); 92 DocumentMarker(unsigned startOffset, unsigned endOffset, bool activeMatch); 93 94 MarkerType type() const { return m_type; } 95 unsigned startOffset() const { return m_startOffset; } 96 unsigned endOffset() const { return m_endOffset; } 97 const String& description() const { return m_description; } 98 bool hasDescription() const { return !m_description.isEmpty(); } 99 bool activeMatch() const { return m_activeMatch; } 100 101 void setActiveMatch(bool); 102 void clearDescription() { m_description = String(); } 103 104 // Offset modifications are done by DocumentMarkerController. 105 // Other classes should not call following setters. 106 void setStartOffset(unsigned offset) { m_startOffset = offset; } 107 void setEndOffset(unsigned offset) { m_endOffset = offset; } 108 void shiftOffsets(int delta); 87 88 MarkerType type; 89 unsigned startOffset; 90 unsigned endOffset; 91 String description; 92 bool activeMatch; 109 93 110 94 bool operator==(const DocumentMarker& o) const 111 95 { 112 return type () == o.type() && startOffset() == o.startOffset() && endOffset() == o.endOffset();96 return type == o.type && startOffset == o.startOffset && endOffset == o.endOffset; 113 97 } 114 98 … … 117 101 return !(*this == o); 118 102 } 119 120 private:121 MarkerType m_type;122 unsigned m_startOffset;123 unsigned m_endOffset;124 String m_description;125 bool m_activeMatch;126 103 }; 127 128 inline DocumentMarker::DocumentMarker()129 : m_type(Spelling), m_startOffset(0), m_endOffset(0), m_activeMatch(false)130 {131 }132 133 inline DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned endOffset)134 : m_type(type), m_startOffset(startOffset), m_endOffset(endOffset), m_activeMatch(false)135 {136 }137 138 inline DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned endOffset, const String& description)139 : m_type(type), m_startOffset(startOffset), m_endOffset(endOffset), m_description(description), m_activeMatch(false)140 {141 ASSERT(type == DocumentMarker::Grammar || DocumentMarker::Autocorrected);142 }143 144 inline DocumentMarker::DocumentMarker(unsigned startOffset, unsigned endOffset, bool activeMatch)145 : m_type(DocumentMarker::TextMatch), m_startOffset(startOffset), m_endOffset(endOffset), m_activeMatch(activeMatch)146 {147 }148 149 inline void DocumentMarker::shiftOffsets(int delta)150 {151 m_startOffset += delta;152 m_endOffset += delta;153 }154 155 inline void DocumentMarker::setActiveMatch(bool active)156 {157 ASSERT(m_type == DocumentMarker::TextMatch);158 m_activeMatch = active;159 }160 104 161 105 } // namespace WebCore -
trunk/Source/WebCore/dom/DocumentMarkerController.cpp
r86647 r86704 55 55 } 56 56 57 void DocumentMarkerController::addMarker(Range* range, DocumentMarker::MarkerType type, const String&description)57 void DocumentMarkerController::addMarker(Range* range, DocumentMarker::MarkerType type, String description) 58 58 { 59 59 // Use a TextIterator to visit the potentially multiple nodes the range covers. … … 61 61 RefPtr<Range> textPiece = markedText.range(); 62 62 int exception = 0; 63 addMarker(textPiece->startContainer(exception), 64 DocumentMarker(type, textPiece->startOffset(exception), textPiece->endOffset(exception), description)); 65 } 66 } 67 68 void DocumentMarkerController::addMarker(Range* range, DocumentMarker::MarkerType type) 69 { 70 // Use a TextIterator to visit the potentially multiple nodes the range covers. 71 for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) { 72 RefPtr<Range> textPiece = markedText.range(); 73 int exception = 0; 74 addMarker(textPiece->startContainer(exception), 75 DocumentMarker(type, textPiece->startOffset(exception), textPiece->endOffset(exception))); 76 } 77 78 } 79 80 81 void DocumentMarkerController::addTextMatchMarker(Range* range, bool activeMatch) 82 { 83 // Use a TextIterator to visit the potentially multiple nodes the range covers. 84 for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) { 85 RefPtr<Range> textPiece = markedText.range(); 86 int exception = 0; 87 unsigned startOffset = textPiece->startOffset(exception); 88 unsigned endOffset = textPiece->endOffset(exception); 89 addMarker(textPiece->startContainer(exception), DocumentMarker(activeMatch, startOffset, endOffset)); 90 if (endOffset > startOffset) { 91 // Rendered rects for markers in WebKit are not populated until each time 92 // the markers are painted. However, we need it to happen sooner, because 93 // the whole purpose of tickmarks on the scrollbar is to show where 94 // matches off-screen are (that haven't been painted yet). 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()); 100 } 63 DocumentMarker marker = {type, textPiece->startOffset(exception), textPiece->endOffset(exception), description, false}; 64 addMarker(textPiece->startContainer(exception), marker); 101 65 } 102 66 } … … 121 85 void DocumentMarkerController::addMarker(Node* node, const DocumentMarker& newMarker) 122 86 { 123 ASSERT(newMarker.endOffset () >= newMarker.startOffset());124 if (newMarker.endOffset () == newMarker.startOffset())125 return; 126 127 m_possiblyExistingMarkerTypes.add(newMarker.type ());87 ASSERT(newMarker.endOffset >= newMarker.startOffset); 88 if (newMarker.endOffset == newMarker.startOffset) 89 return; 90 91 m_possiblyExistingMarkerTypes.add(newMarker.type); 128 92 129 93 MarkerList* list = m_markers.get(node); … … 142 106 for (i = 0; i < numMarkers; ++i) { 143 107 DocumentMarker marker = list->at(i); 144 if (marker.startOffset () > toInsert.startOffset())108 if (marker.startOffset > toInsert.startOffset) 145 109 break; 146 if (marker.type () == toInsert.type() && marker.endOffset() >= toInsert.startOffset()) {147 toInsert.s etStartOffset(marker.startOffset());110 if (marker.type == toInsert.type && marker.endOffset >= toInsert.startOffset) { 111 toInsert.startOffset = marker.startOffset; 148 112 list->remove(i); 149 113 numMarkers--; … … 157 121 while (j < numMarkers) { 158 122 DocumentMarker marker = list->at(j); 159 if (marker.startOffset () > toInsert.endOffset())123 if (marker.startOffset > toInsert.endOffset) 160 124 break; 161 if (marker.type () == toInsert.type()) {125 if (marker.type == toInsert.type) { 162 126 list->remove(j); 163 if (toInsert.endOffset () <= marker.endOffset()) {164 toInsert. setEndOffset(marker.endOffset());127 if (toInsert.endOffset <= marker.endOffset) { 128 toInsert.endOffset = marker.endOffset; 165 129 break; 166 130 } … … 199 163 200 164 // stop if we are now past the specified range 201 if (marker.startOffset ()> endOffset)165 if (marker.startOffset > endOffset) 202 166 break; 203 167 204 168 // skip marker that is before the specified range or is the wrong type 205 if (marker.endOffset ()< startOffset)169 if (marker.endOffset < startOffset) 206 170 continue; 207 171 208 172 // pin the marker to the specified range and apply the shift delta 209 173 docDirty = true; 210 if (marker.startOffset() < startOffset) 211 marker.setStartOffset(startOffset); 212 if (marker.endOffset() > endOffset) 213 marker.setEndOffset(endOffset); 214 marker.shiftOffsets(delta); 174 if (marker.startOffset < startOffset) 175 marker.startOffset = startOffset; 176 if (marker.endOffset > endOffset) 177 marker.endOffset = endOffset; 178 marker.startOffset += delta; 179 marker.endOffset += delta; 215 180 216 181 addMarker(dstNode, marker); … … 241 206 242 207 // markers are returned in order, so stop if we are now past the specified range 243 if (marker.startOffset ()>= endOffset)208 if (marker.startOffset >= endOffset) 244 209 break; 245 210 246 211 // skip marker that is wrong type or before target 247 if (marker.endOffset () <= startOffset || !markerTypes.contains(marker.type())) {212 if (marker.endOffset <= startOffset || !markerTypes.contains(marker.type)) { 248 213 i++; 249 214 continue; … … 261 226 262 227 // add either of the resulting slices that are left after removing target 263 if (startOffset > marker.startOffset ()) {228 if (startOffset > marker.startOffset) { 264 229 DocumentMarker newLeft = marker; 265 newLeft. setEndOffset(startOffset);230 newLeft.endOffset = startOffset; 266 231 list->insert(i, RenderedDocumentMarker(newLeft)); 267 232 // i now points to the newly-inserted node, but we want to skip that one 268 233 i++; 269 234 } 270 if (marker.endOffset ()> endOffset) {235 if (marker.endOffset > endOffset) { 271 236 DocumentMarker newRight = marker; 272 newRight.s etStartOffset(endOffset);237 newRight.startOffset = endOffset; 273 238 list->insert(i, RenderedDocumentMarker(newRight)); 274 239 // i now points to the newly-inserted node, but we want to skip that one … … 306 271 307 272 // skip marker that is wrong type 308 if (marker.type ()!= markerType)273 if (marker.type != markerType) 309 274 continue; 310 275 … … 347 312 Vector<DocumentMarker>::const_iterator end = markers.end(); 348 313 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()))314 if (!markerTypes.contains(it->type)) 315 continue; 316 if (node == startContainer && it->endOffset <= static_cast<unsigned>(range->startOffset())) 317 continue; 318 if (node == endContainer && it->startOffset >= static_cast<unsigned>(range->endOffset())) 354 319 continue; 355 320 foundMarkers.append(*it); … … 377 342 378 343 // skip marker that is wrong type 379 if (marker.type ()!= markerType)344 if (marker.type != markerType) 380 345 continue; 381 346 … … 429 394 430 395 // skip nodes that are not of the specified type 431 if (!markerTypes.contains(marker.type ())) {396 if (!markerTypes.contains(marker.type)) { 432 397 ++i; 433 398 continue; … … 476 441 477 442 // skip nodes that are not of the specified type 478 if (markerTypes.contains(marker.type ())) {443 if (markerTypes.contains(marker.type)) { 479 444 nodeNeedsRepaint = true; 480 445 break; … … 537 502 for (size_t i = 0; i != list->size(); ++i) { 538 503 RenderedDocumentMarker& marker = list->at(i); 539 if (marker.startOffset() >= startOffset) { 540 ASSERT((int)marker.startOffset() + delta >= 0); 541 marker.shiftOffsets(delta); 504 if (marker.startOffset >= startOffset) { 505 ASSERT((int)marker.startOffset + delta >= 0); 506 marker.startOffset += delta; 507 marker.endOffset += delta; 542 508 docDirty = true; 543 509 … … 581 547 582 548 // Markers are returned in order, so stop if we are now past the specified range. 583 if (marker.startOffset ()>= endOffset)549 if (marker.startOffset >= endOffset) 584 550 break; 585 551 586 552 // Skip marker that is wrong type or before target. 587 if (marker.endOffset () < startOffset || marker.type()!= DocumentMarker::TextMatch)553 if (marker.endOffset < startOffset || marker.type != DocumentMarker::TextMatch) 588 554 continue; 589 555 590 marker. setActiveMatch(active);556 marker.activeMatch = active; 591 557 docDirty = true; 592 558 } … … 613 579 Vector<DocumentMarker>::const_iterator end = markers.end(); 614 580 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()))581 if (!markerTypes.contains(it->type)) 582 continue; 583 if (node == startContainer && it->endOffset <= static_cast<unsigned>(range->startOffset())) 584 continue; 585 if (node == endContainer && it->startOffset >= static_cast<unsigned>(range->endOffset())) 620 586 continue; 621 587 return true; … … 646 612 647 613 // markers are returned in order, so stop if we are now past the specified range 648 if (marker.startOffset ()>= endOffset)614 if (marker.startOffset >= endOffset) 649 615 break; 650 616 651 617 // skip marker that is wrong type or before target 652 if (marker.endOffset () <= startOffset || !markerTypes.contains(marker.type())) {618 if (marker.endOffset <= startOffset || !markerTypes.contains(marker.type)) { 653 619 i++; 654 620 continue; 655 621 } 656 622 657 marker. clearDescription();623 marker.description = String(); 658 624 } 659 625 } … … 669 635 fprintf(stderr, "%p", node); 670 636 MarkerList* list = nodeIterator->second; 671 for (unsigned markerIndex = 0; markerIndex < list->size(); ++markerIndex) { 672 const DocumentMarker& marker = list->at(markerIndex); 673 fprintf(stderr, " %d:[%d:%d](%d)", marker.type(), marker.startOffset(), marker.endOffset(), marker.activeMatch()); 674 } 675 637 for (unsigned markerIndex = 0; markerIndex < list->size(); ++markerIndex) 638 fprintf(stderr, " %d:[%d:%d](%d)", list->at(markerIndex).type, list->at(markerIndex).startOffset, list->at(markerIndex).endOffset, list->at(markerIndex).activeMatch); 676 639 fprintf(stderr, "\n"); 677 640 } -
trunk/Source/WebCore/dom/DocumentMarkerController.h
r86647 r86704 48 48 49 49 void detach(); 50 void addMarker(Range*, DocumentMarker::MarkerType); 51 void addMarker(Range*, DocumentMarker::MarkerType, const String& description); 52 void addTextMatchMarker(Range*, bool activeMatch); 53 50 void addMarker(Range*, DocumentMarker::MarkerType, String description = String()); 51 void addMarker(Node*, const DocumentMarker&); 54 52 void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstNode, int delta); 55 53 bool hasMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); … … 82 80 83 81 private: 84 void addMarker(Node*, const DocumentMarker&);85 86 82 typedef Vector<RenderedDocumentMarker> MarkerList; 87 83 typedef HashMap<RefPtr<Node>, MarkerList*> MarkerMap; -
trunk/Source/WebCore/editing/CompositeEditCommand.cpp
r86647 r86704 349 349 replaceTextInNode(node, offset, count, replacementText); 350 350 RefPtr<Range> newRange = Range::create(document(), node, offset, node, offset + replacementText.length()); 351 for (size_t i = 0; i < markers.size(); ++i) { 352 if (markers[i].hasDescription()) 353 markerController->addMarker(newRange.get(), markers[i].type(), markers[i].description()); 354 else 355 markerController->addMarker(newRange.get(), markers[i].type()); 356 } 351 for (size_t i = 0; i < markers.size(); ++i) 352 markerController->addMarker(newRange.get(), markers[i].type, markers[i].description); 357 353 } 358 354 -
trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp
r86647 r86704 763 763 for (size_t i = 0; i < markers.size(); ++i) { 764 764 const DocumentMarker& marker = markers[i]; 765 int startOffset = marker.startOffset ();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
r86647 r86704 3220 3220 for (size_t i = 0; i < markers.size(); ++i) { 3221 3221 DocumentMarker marker = markers[i]; 3222 if (marker.startOffset () <= startOffset && endOffset <= marker.endOffset() && marker.type()== markerType)3222 if (marker.startOffset <= startOffset && endOffset <= marker.endOffset && marker.type == markerType) 3223 3223 return true; 3224 3224 } -
trunk/Source/WebCore/editing/SpellingCorrectionController.cpp
r86703 r86704 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 } -
trunk/Source/WebCore/editing/SpellingCorrectionController.h
r86647 r86704 129 129 bool shouldStartTimerFor(const DocumentMarker& marker, int endOffset) const 130 130 { 131 return (((marker.type () == DocumentMarker::Replacement && !marker.description().isNull())132 || marker.type () == DocumentMarker::Spelling) && static_cast<int>(marker.endOffset()) == endOffset);131 return (((marker.type == DocumentMarker::Replacement && !marker.description.isNull()) 132 || marker.type == DocumentMarker::Spelling) && static_cast<int>(marker.endOffset) == endOffset); 133 133 } 134 134 -
trunk/Source/WebCore/rendering/HitTestResult.cpp
r86647 r86704 202 202 if (RenderObject* renderer = m_innerNonSharedNode->renderer()) 203 203 dir = renderer->style()->direction(); 204 return marker->description ();204 return marker->description; 205 205 } 206 206 … … 216 216 return String(); 217 217 218 return marker->description ();218 return marker->description; 219 219 } 220 220 -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r86647 r86704 993 993 // Determine whether we need to measure text 994 994 bool markerSpansWholeBox = true; 995 if (m_start <= (int)marker.startOffset ())995 if (m_start <= (int)marker.startOffset) 996 996 markerSpansWholeBox = false; 997 if ((end() + 1) != marker.endOffset ())// end points at the last char, not past it997 if ((end() + 1) != marker.endOffset) // end points at the last char, not past it 998 998 markerSpansWholeBox = false; 999 999 if (m_truncation != cNoTruncation) … … 1001 1001 1002 1002 if (!markerSpansWholeBox || grammar) { 1003 int startPosition = max<int>(marker.startOffset ()- m_start, 0);1004 int endPosition = min<int>(marker.endOffset ()- m_start, m_len);1003 int startPosition = max<int>(marker.startOffset - m_start, 0); 1004 int endPosition = min<int>(marker.endOffset - m_start, m_len); 1005 1005 1006 1006 if (m_truncation != cNoTruncation) … … 1044 1044 underlineOffset = baseline + 2; 1045 1045 } 1046 pt->drawLineForTextChecking(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + underlineOffset), width, textCheckingLineStyleForMarkerType(marker.type ()));1046 pt->drawLineForTextChecking(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + underlineOffset), width, textCheckingLineStyleForMarkerType(marker.type)); 1047 1047 } 1048 1048 … … 1054 1054 int selHeight = selectionHeight(); 1055 1055 1056 int sPos = max(marker.startOffset ()- m_start, (unsigned)0);1057 int ePos = min(marker.endOffset ()- m_start, (unsigned)m_len);1056 int sPos = max(marker.startOffset - m_start, (unsigned)0); 1057 int ePos = min(marker.endOffset - m_start, (unsigned)m_len); 1058 1058 TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride || style->visuallyOrdered()); 1059 1059 … … 1065 1065 // Optionally highlight the text 1066 1066 if (renderer()->frame()->editor()->markedTextMatchesAreHighlighted()) { 1067 Color color = marker.activeMatch ()?1067 Color color = marker.activeMatch ? 1068 1068 renderer()->theme()->platformActiveTextSearchHighlightColor() : 1069 1069 renderer()->theme()->platformInactiveTextSearchHighlightColor(); … … 1081 1081 int h = selectionHeight(); 1082 1082 1083 int sPos = max(marker.startOffset ()- m_start, (unsigned)0);1084 int ePos = min(marker.endOffset ()- m_start, (unsigned)m_len);1083 int sPos = max(marker.startOffset - m_start, (unsigned)0); 1084 int ePos = min(marker.endOffset - m_start, (unsigned)m_len); 1085 1085 TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_expansion, expansionBehavior(), direction(), m_dirOverride || style->visuallyOrdered()); 1086 1086 IntPoint startPoint = IntPoint(m_x, y); … … 1106 1106 1107 1107 // Paint either the background markers or the foreground markers, but not both 1108 switch (marker.type ()) {1108 switch (marker.type) { 1109 1109 case DocumentMarker::Grammar: 1110 1110 case DocumentMarker::Spelling: … … 1122 1122 } 1123 1123 1124 if (marker.endOffset ()<= start())1124 if (marker.endOffset <= start()) 1125 1125 // marker is completely before this run. This might be a marker that sits before the 1126 1126 // first run we draw, or markers that were within runs we skipped due to truncation. 1127 1127 continue; 1128 1128 1129 if (marker.startOffset ()> end())1129 if (marker.startOffset > end()) 1130 1130 // marker is completely after this run, bail. A later run will paint it. 1131 1131 break; 1132 1132 1133 1133 // marker intersects this run. Paint it. 1134 switch (marker.type ()) {1134 switch (marker.type) { 1135 1135 case DocumentMarker::Spelling: 1136 1136 paintSpellingOrGrammarMarker(pt, boxOrigin, marker, style, font, false); -
trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp
r86647 r86704 100 100 101 101 // SVG is only interessted in the TextMatch marker, for now. 102 if (marker.type ()!= DocumentMarker::TextMatch)102 if (marker.type != DocumentMarker::TextMatch) 103 103 continue; 104 104 … … 110 110 SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(box); 111 111 112 int markerStartPosition = max<int>(marker.startOffset ()- textBox->start(), 0);113 int markerEndPosition = min<int>(marker.endOffset ()- textBox->start(), textBox->len());112 int markerStartPosition = max<int>(marker.startOffset - textBox->start(), 0); 113 int markerEndPosition = min<int>(marker.endOffset - textBox->start(), textBox->len()); 114 114 115 115 if (markerStartPosition >= markerEndPosition) -
trunk/Source/WebKit/chromium/ChangeLog
r86700 r86704 1 2011-05-17 Andrew Wilson <atwilson@chromium.org> 2 3 Unreviewed, rolling out r86647. 4 http://trac.webkit.org/changeset/86647 5 https://bugs.webkit.org/show_bug.cgi?id=56814 6 7 Broke tests downstream in Chromium 8 9 * src/WebFrameImpl.cpp: 10 (WebKit::WebFrameImpl::addMarker): 11 1 12 2011-05-17 Yufeng Shen <miletus@chromium.org> 2 13 -
trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp
r86647 r86704 2241 2241 void WebFrameImpl::addMarker(Range* range, bool activeMatch) 2242 2242 { 2243 frame()->document()->markers()->addTextMatchMarker(range, activeMatch); 2243 // Use a TextIterator to visit the potentially multiple nodes the range 2244 // covers. 2245 TextIterator markedText(range); 2246 for (; !markedText.atEnd(); markedText.advance()) { 2247 RefPtr<Range> textPiece = markedText.range(); 2248 int exception = 0; 2249 2250 DocumentMarker marker = { 2251 DocumentMarker::TextMatch, 2252 textPiece->startOffset(exception), 2253 textPiece->endOffset(exception), 2254 "", 2255 activeMatch 2256 }; 2257 2258 if (marker.endOffset > marker.startOffset) { 2259 // Find the node to add a marker to and add it. 2260 Node* node = textPiece->startContainer(exception); 2261 frame()->document()->markers()->addMarker(node, marker); 2262 2263 // Rendered rects for markers in WebKit are not populated until each time 2264 // the markers are painted. However, we need it to happen sooner, because 2265 // the whole purpose of tickmarks on the scrollbar is to show where 2266 // matches off-screen are (that haven't been painted yet). 2267 Vector<DocumentMarker> markers = frame()->document()->markers()->markersForNode(node); 2268 frame()->document()->markers()->setRenderedRectForMarker( 2269 textPiece->startContainer(exception), 2270 markers[markers.size() - 1], 2271 range->boundingBox()); 2272 } 2273 } 2244 2274 } 2245 2275
Note: See TracChangeset
for help on using the changeset viewer.