Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: Source/core/page/TouchAdjustment.cpp

Issue 23618052: TextBreakIterator should use the C++ icu API instead of the C one (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Downcast to icu::RuleBasedBreakIterator Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (!node->isTextNode()) 151 if (!node->isTextNode())
152 return appendBasicSubtargetsForNode(node, subtargets); 152 return appendBasicSubtargetsForNode(node, subtargets);
153 153
154 Text* textNode = static_cast<WebCore::Text*>(node); 154 Text* textNode = static_cast<WebCore::Text*>(node);
155 RenderText* textRenderer = static_cast<RenderText*>(textNode->renderer()); 155 RenderText* textRenderer = static_cast<RenderText*>(textNode->renderer());
156 156
157 if (textRenderer->frame()->editor().behavior().shouldSelectOnContextualMenuC lick()) { 157 if (textRenderer->frame()->editor().behavior().shouldSelectOnContextualMenuC lick()) {
158 // Make subtargets out of every word. 158 // Make subtargets out of every word.
159 String textValue = textNode->data(); 159 String textValue = textNode->data();
160 TextBreakIterator* wordIterator = wordBreakIterator(textValue, 0, textVa lue.length()); 160 TextBreakIterator* wordIterator = wordBreakIterator(textValue, 0, textVa lue.length());
161 int lastOffset = textBreakFirst(wordIterator); 161 int lastOffset = wordIterator->first();
162 if (lastOffset == -1) 162 if (lastOffset == -1)
163 return; 163 return;
164 int offset; 164 int offset;
165 while ((offset = textBreakNext(wordIterator)) != -1) { 165 while ((offset = wordIterator->next()) != -1) {
166 if (isWordTextBreak(wordIterator)) { 166 if (isWordTextBreak(wordIterator)) {
167 Vector<FloatQuad> quads; 167 Vector<FloatQuad> quads;
168 textRenderer->absoluteQuadsForRange(quads, lastOffset, offset); 168 textRenderer->absoluteQuadsForRange(quads, lastOffset, offset);
169 appendQuadsToSubtargetList(quads, textNode, subtargets); 169 appendQuadsToSubtargetList(quads, textNode, subtargets);
170 } 170 }
171 lastOffset = offset; 171 lastOffset = offset;
172 } 172 }
173 } else { 173 } else {
174 if (textRenderer->selectionState() == RenderObject::SelectionNone) 174 if (textRenderer->selectionState() == RenderObject::SelectionNone)
175 return appendBasicSubtargetsForNode(node, subtargets); 175 return appendBasicSubtargetsForNode(node, subtargets);
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 488
489 bool findBestZoomableArea(Node*& targetNode, IntRect& targetArea, const IntPoint & touchHotspot, const IntRect& touchArea, const Vector<RefPtr<Node> >& nodes) 489 bool findBestZoomableArea(Node*& targetNode, IntRect& targetArea, const IntPoint & touchHotspot, const IntRect& touchArea, const Vector<RefPtr<Node> >& nodes)
490 { 490 {
491 IntPoint targetPoint; 491 IntPoint targetPoint;
492 TouchAdjustment::SubtargetGeometryList subtargets; 492 TouchAdjustment::SubtargetGeometryList subtargets;
493 TouchAdjustment::compileZoomableSubtargets(nodes, subtargets); 493 TouchAdjustment::compileZoomableSubtargets(nodes, subtargets);
494 return TouchAdjustment::findNodeWithLowestDistanceMetric(targetNode, targetP oint, targetArea, touchHotspot, touchArea, subtargets, TouchAdjustment::zoomable IntersectionQuotient); 494 return TouchAdjustment::findNodeWithLowestDistanceMetric(targetNode, targetP oint, targetArea, touchHotspot, touchArea, subtargets, TouchAdjustment::zoomable IntersectionQuotient);
495 } 495 }
496 496
497 } // namespace WebCore 497 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleUnits.cpp ('k') | Source/core/platform/graphics/mac/ComplexTextController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698