| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  * Copyright (C) 2009 Google Inc. All rights reserved. |     2  * Copyright (C) 2009 Google Inc. All rights reserved. | 
|     3  * |     3  * | 
|     4  * Redistribution and use in source and binary forms, with or without |     4  * Redistribution and use in source and binary forms, with or without | 
|     5  * modification, are permitted provided that the following conditions are |     5  * modification, are permitted provided that the following conditions are | 
|     6  * met: |     6  * met: | 
|     7  * |     7  * | 
|     8  *     * Redistributions of source code must retain the above copyright |     8  *     * Redistributions of source code must retain the above copyright | 
|     9  * notice, this list of conditions and the following disclaimer. |     9  * notice, this list of conditions and the following disclaimer. | 
|    10  *     * Redistributions in binary form must reproduce the above |    10  *     * Redistributions in binary form must reproduce the above | 
| (...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1271 } |  1271 } | 
|  1272  |  1272  | 
|  1273 void WebFrameImpl::replaceMisspelledRange(const WebString& text) |  1273 void WebFrameImpl::replaceMisspelledRange(const WebString& text) | 
|  1274 { |  1274 { | 
|  1275     // If this caret selection has two or more markers, this function replace th
      e range covered by the first marker with the specified word as Microsoft Word do
      es. |  1275     // If this caret selection has two or more markers, this function replace th
      e range covered by the first marker with the specified word as Microsoft Word do
      es. | 
|  1276     if (pluginContainerFromFrame(frame())) |  1276     if (pluginContainerFromFrame(frame())) | 
|  1277         return; |  1277         return; | 
|  1278     RefPtr<Range> caretRange = frame()->selection().toNormalizedRange(); |  1278     RefPtr<Range> caretRange = frame()->selection().toNormalizedRange(); | 
|  1279     if (!caretRange) |  1279     if (!caretRange) | 
|  1280         return; |  1280         return; | 
|  1281     Vector<DocumentMarker*> markers = frame()->document()->markers()->markersInR
      ange(caretRange.get(), DocumentMarker::MisspellingMarkers()); |  1281     Vector<DocumentMarker*> markers = frame()->document()->markers().markersInRa
      nge(caretRange.get(), DocumentMarker::MisspellingMarkers()); | 
|  1282     if (markers.size() < 1 || markers[0]->startOffset() >= markers[0]->endOffset
      ()) |  1282     if (markers.size() < 1 || markers[0]->startOffset() >= markers[0]->endOffset
      ()) | 
|  1283         return; |  1283         return; | 
|  1284     RefPtr<Range> markerRange = Range::create(caretRange->ownerDocument(), caret
      Range->startContainer(), markers[0]->startOffset(), caretRange->endContainer(), 
      markers[0]->endOffset()); |  1284     RefPtr<Range> markerRange = Range::create(caretRange->ownerDocument(), caret
      Range->startContainer(), markers[0]->startOffset(), caretRange->endContainer(), 
      markers[0]->endOffset()); | 
|  1285     if (!markerRange) |  1285     if (!markerRange) | 
|  1286         return; |  1286         return; | 
|  1287     frame()->selection().setSelection(markerRange.get(), CharacterGranularity); |  1287     frame()->selection().setSelection(markerRange.get(), CharacterGranularity); | 
|  1288     frame()->editor().replaceSelectionWithText(text, false, false); |  1288     frame()->editor().replaceSelectionWithText(text, false, false); | 
|  1289 } |  1289 } | 
|  1290  |  1290  | 
|  1291 void WebFrameImpl::removeSpellingMarkers() |  1291 void WebFrameImpl::removeSpellingMarkers() | 
|  1292 { |  1292 { | 
|  1293     frame()->document()->markers()->removeMarkers(DocumentMarker::MisspellingMar
      kers()); |  1293     frame()->document()->markers().removeMarkers(DocumentMarker::MisspellingMark
      ers()); | 
|  1294 } |  1294 } | 
|  1295  |  1295  | 
|  1296 bool WebFrameImpl::hasSelection() const |  1296 bool WebFrameImpl::hasSelection() const | 
|  1297 { |  1297 { | 
|  1298     WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); |  1298     WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); | 
|  1299     if (pluginContainer) |  1299     if (pluginContainer) | 
|  1300         return pluginContainer->plugin()->hasSelection(); |  1300         return pluginContainer->plugin()->hasSelection(); | 
|  1301  |  1301  | 
|  1302     // frame()->selection()->isNone() never returns true. |  1302     // frame()->selection()->isNone() never returns true. | 
|  1303     return frame()->selection().start() != frame()->selection().end(); |  1303     return frame()->selection().start() != frame()->selection().end(); | 
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1578     return true; |  1578     return true; | 
|  1579 } |  1579 } | 
|  1580  |  1580  | 
|  1581 void WebFrameImpl::stopFinding(bool clearSelection) |  1581 void WebFrameImpl::stopFinding(bool clearSelection) | 
|  1582 { |  1582 { | 
|  1583     if (!clearSelection) |  1583     if (!clearSelection) | 
|  1584         setFindEndstateFocusAndSelection(); |  1584         setFindEndstateFocusAndSelection(); | 
|  1585     cancelPendingScopingEffort(); |  1585     cancelPendingScopingEffort(); | 
|  1586  |  1586  | 
|  1587     // Remove all markers for matches found and turn off the highlighting. |  1587     // Remove all markers for matches found and turn off the highlighting. | 
|  1588     frame()->document()->markers()->removeMarkers(DocumentMarker::TextMatch); |  1588     frame()->document()->markers().removeMarkers(DocumentMarker::TextMatch); | 
|  1589     frame()->editor().setMarkedTextMatchesAreHighlighted(false); |  1589     frame()->editor().setMarkedTextMatchesAreHighlighted(false); | 
|  1590     clearFindMatchesCache(); |  1590     clearFindMatchesCache(); | 
|  1591  |  1591  | 
|  1592     // Let the frame know that we don't want tickmarks or highlighting anymore. |  1592     // Let the frame know that we don't want tickmarks or highlighting anymore. | 
|  1593     invalidateArea(InvalidateAll); |  1593     invalidateArea(InvalidateAll); | 
|  1594 } |  1594 } | 
|  1595  |  1595  | 
|  1596 void WebFrameImpl::scopeStringMatches(int identifier, const WebString& searchTex
      t, const WebFindOptions& options, bool reset) |  1596 void WebFrameImpl::scopeStringMatches(int identifier, const WebString& searchTex
      t, const WebFindOptions& options, bool reset) | 
|  1597 { |  1597 { | 
|  1598     if (reset) { |  1598     if (reset) { | 
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2384     if ((area & InvalidateScrollbar) == InvalidateScrollbar) { |  2384     if ((area & InvalidateScrollbar) == InvalidateScrollbar) { | 
|  2385         // Invalidate the vertical scroll bar region for the view. |  2385         // Invalidate the vertical scroll bar region for the view. | 
|  2386         Scrollbar* scrollbar = view->verticalScrollbar(); |  2386         Scrollbar* scrollbar = view->verticalScrollbar(); | 
|  2387         if (scrollbar) |  2387         if (scrollbar) | 
|  2388             scrollbar->invalidate(); |  2388             scrollbar->invalidate(); | 
|  2389     } |  2389     } | 
|  2390 } |  2390 } | 
|  2391  |  2391  | 
|  2392 void WebFrameImpl::addMarker(Range* range, bool activeMatch) |  2392 void WebFrameImpl::addMarker(Range* range, bool activeMatch) | 
|  2393 { |  2393 { | 
|  2394     frame()->document()->markers()->addTextMatchMarker(range, activeMatch); |  2394     frame()->document()->markers().addTextMatchMarker(range, activeMatch); | 
|  2395 } |  2395 } | 
|  2396  |  2396  | 
|  2397 void WebFrameImpl::setMarkerActive(Range* range, bool active) |  2397 void WebFrameImpl::setMarkerActive(Range* range, bool active) | 
|  2398 { |  2398 { | 
|  2399     if (!range || range->collapsed(IGNORE_EXCEPTION)) |  2399     if (!range || range->collapsed(IGNORE_EXCEPTION)) | 
|  2400         return; |  2400         return; | 
|  2401     frame()->document()->markers()->setMarkersActive(range, active); |  2401     frame()->document()->markers().setMarkersActive(range, active); | 
|  2402 } |  2402 } | 
|  2403  |  2403  | 
|  2404 int WebFrameImpl::ordinalOfFirstMatchForFrame(WebFrameImpl* frame) const |  2404 int WebFrameImpl::ordinalOfFirstMatchForFrame(WebFrameImpl* frame) const | 
|  2405 { |  2405 { | 
|  2406     int ordinal = 0; |  2406     int ordinal = 0; | 
|  2407     WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl(); |  2407     WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl(); | 
|  2408     // Iterate from the main frame up to (but not including) |frame| and |  2408     // Iterate from the main frame up to (but not including) |frame| and | 
|  2409     // add up the number of matches found so far. |  2409     // add up the number of matches found so far. | 
|  2410     for (WebFrameImpl* it = mainFrameImpl; it != frame; it = toWebFrameImpl(it->
      traverseNext(true))) { |  2410     for (WebFrameImpl* it = mainFrameImpl; it != frame; it = toWebFrameImpl(it->
      traverseNext(true))) { | 
|  2411         if (it->m_lastMatchCount > 0) |  2411         if (it->m_lastMatchCount > 0) | 
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2512  |  2512  | 
|  2513         // There is a possibility that the frame being detached was the only |  2513         // There is a possibility that the frame being detached was the only | 
|  2514         // pending one. We need to make sure final replies can be sent. |  2514         // pending one. We need to make sure final replies can be sent. | 
|  2515         flushCurrentScopingEffort(m_findRequestIdentifier); |  2515         flushCurrentScopingEffort(m_findRequestIdentifier); | 
|  2516  |  2516  | 
|  2517         cancelPendingScopingEffort(); |  2517         cancelPendingScopingEffort(); | 
|  2518     } |  2518     } | 
|  2519 } |  2519 } | 
|  2520  |  2520  | 
|  2521 } // namespace blink |  2521 } // namespace blink | 
| OLD | NEW |