summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav/SelectText.cpp
Commit message (Collapse)AuthorAgeFilesLines
* do a better job of finding closest selectable textCary Clark2010-11-191-11/+24
| | | | | | | | | | | | Measure the closest to the edge, instead of closest to the center. Identify vertical overlaps, and use them to discount characters which are vertically closer. Add more debugging. bug:3183434 Change-Id: I80a14be25260113220e446b876868566440be252
* improve select text anchor trackingCary Clark2010-11-171-2/+6
| | | | | | | | | | The initial point for the touch relative to the anchor was erroneously calculated, causing the select anchor to jump to the left or right each time a drag was initiated. With this fix, the anchor no longer jumps. bug:3089212 Change-Id: I995afa97ef9851fc5f15d642d7975797d8eb2022
* increase the select text anchor hit slopCary Clark2010-11-151-1/+1
| | | | | bug:3195900 Change-Id: I55317b6c2d1f2dd48e2522df9ba45653a479793a
* compute select text distance biasing x over yCary Clark2010-11-111-17/+23
| | | | | | | | | | | | Rather than using a regular distance function, first find the closest match in Y then look for the closest match in X. This allows the touch point to be well to the right or left of the paragraph and still move the selection to the next or preceeding line while the selection is extended. bug:3183434 Change-Id: I6abf14b9dbca4b7bafe2cb9a96a2915732038ce1
* use layer id to maintain selectionCary Clark2010-11-111-2/+9
| | | | | | | | | | | | | | | | | | The pictures used to draw the page content can change in response to refreshes, as the selection is moved or as the screen is scrolled or zoomed. Track the layer id, instead of the picture pointer, to find the picture that contains the current selection. Before, the selection would disappear as the screen was pinched, or the highlight might disappear even though the anchors draw, or the highlight and anchors might be drawn offset from the screen data. This change eliminates this class of bugs. Change-Id: Ifc440b8aa0c9d6d232e298e42c4c544a41629442 http://b/3183492
* build select region for one characterCary Clark2010-11-101-0/+2
| | | | | bug:3183119 Change-Id: Iebd070feeb9c9a52e0d6214563c378647d97b977
* Adjust layers when parent layer scrollsCary Clark2010-11-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a page has layers, it causes the main body of the page to become a layer as well. The scroll position of the WebView must be applied to the layer to translate the cursor rings correctly for hit-testing. Today, applying the scroll position of the WebView screws up overflow scrolling. Until this gets figured out, skip using the scroll position in CacheFrame adjust() and unadjust(). The position of the layer, and all of its parent layers, should be considered when adjusting the rectangle bounds contained by that layer. Before, only the child layer's position was considered. The clip used by scrollable divs may be initialized but never set. If it is empty, ignore it, rather than clipping out all content. In CacheBuilder, remove a couple of unnecessary lines -- the CacheInput initialization clears all members. In SelectText, reverse the order of the xfer mode and paint objects to remove a Skia ref count assert. In CachedInput, make the debug printout current. Overall, added more debugging output (turned off by default). bug:3030370 Change-Id: Ic19c24b3bf33d081a1d0c1f8c06601dcb56ae881
* rewrite select text and others for layersCary Clark2010-10-271-48/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Layers contain pictures, and draw them offset from the top of the page. Several readers of pictures need to account for this displacement when computing what part of the picture intersects a tap on the screen. The tap may not correspond to the first layer that intersects it, so all layers must be checked to find the best match. The root layer usually draws everywhere, so for a match to correspond to the root, the match must additionally intersect text. Layers may create offscreen bitmaps when drawing to correctly alpha blend the results to the screen, but this causes the items in the bitmap to draw to an unexpected location when the picture is treated as a spatial database. To get around this, call the SkCanvas::save() from the overridden saveLayer() to push and pop the canvas layer state without creating an offscreen. WebCore/platform/graphics/android/LayerAndroid.cpp WebCore/platform/graphics/android/LayerAndroid.h - In find(), iterate through all children, instead of stopping on the first match. - Check to see if the child actually draws at the desired location, and if it draws text there as well. - Specify a slop factor to allow for inaccuracies in touch. - Check the root for text before checking the children. WebKit/android/nav/CachedFrame.cpp WebKit/android/nav/CachedFrame.h - Modify the (x,y) co-ordinate by the layer's offset, when finding the picture corresponding to a point. WebKit/android/nav/CachedLayer.cpp WebKit/android/nav/CachedLayer.h - More plumbing to adjust the point if the picture is contained in an offset layer. WebKit/android/nav/CachedRoot.cpp WebKit/android/nav/CachedRoot.h - Correct the (x,y) locations by the layer offset. - Add some debugging (disabled by default) WebKit/android/nav/ParsedCanvas.h - One stop shopping that calls save() from saveLayer(). - Reset the bounder to null to balance its ref count. WebKit/android/nav/SelectText.cpp WebKit/android/nav/SelectText.h - Rearrange the way pictures are tracked. Record the picture corresponding to the input location when the selection starts, requiring that the picture remain unchanged as the selection extends. - Only draw adornments for when the corresponding picture is drawn. This fixes a Gmail specific problem, where the layers come and go as the page scrolls. - Always use the supplied visible bounds instead of computing it from the canvas. - Correct location points by layer offsets. - Add to the picture ref count so it can't be deleted during selection. WebKit/android/nav/WebView.cpp - Simplify visibleRect code. - Simplify all SelectText interfaces. bug:3114609 Change-Id: I43dc3252fc86c4b6500edcd650126b2559f530e3
* am e0482608: am 5cff132a: change webkit text select to orangeCary Clark2010-10-121-49/+80
|\ | | | | | | | | | | | | Merge commit 'e0482608f9ee8684ac41fc225ec82ee33ae8e123' * commit 'e0482608f9ee8684ac41fc225ec82ee33ae8e123': change webkit text select to orange
| * change webkit text select to orangeCary Clark2010-10-111-49/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the selection to a transparent orange. This won't match the UI exactly, because this draws transparently over the text instead of opaquely behind the text. This also changes the design of the text selection handles to match the bitmaps in the UI. http://b/3083069 Change-Id: I02656c42a3020f9b1e5dbc431c47bf2b51d22de8
| * Do not merge -- restrict text selection to the main layerCary Clark2010-09-151-0/+6
| | | | | | | | | | | | | | | | | | Gmail causes layers to appear as a message is scrolled. This confuses the text selection logic. To workaround this in Gingerbread, text selection is only allowed to be drawn in the main layer. Change-Id: Idd814bcb5dfeef2fc12d6b0d586a63f711351d96 http://b/2998882
| * DO NOT MERGE make the text selection easier to hitCary Clark2010-08-261-1/+4
| | | | | | | | | | Change-Id: I47b7aa04ebc2a8f0bf2c6b4399ef65e5f4c58d4e http://b/2626451
* | am e7a07088: am 21ed5a45: Merge "check for null pictures when selecting ↵Cary Clark2010-08-241-0/+9
|\ \ | |/ | | | | | | | | | | | | | | text" into gingerbread Merge commit 'e7a0708886b515f34d0a7e034cdea391681bf7f1' * commit 'e7a0708886b515f34d0a7e034cdea391681bf7f1': check for null pictures when selecting text
| * check for null pictures when selecting textCary Clark2010-08-241-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The LayerAndroid supplied to SelectText may have no picture associated with it. If that's the case, ignore it. This change was original uploaded as https://android-git.corp.google.com/g/#change,62627 in master, but then I realized it should go into gingerbread as well, and get merged into master automagically. http://b/2930142 Change-Id: If6332d81f1f9baba804131caae124dd18e0b0799
| * DO NOT MERGE Refactor find and select dialogsCary Clark2010-08-201-173/+1248
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Change imported by hand from master, based on https://android-git.corp.google.com/g/#change,53489 ) SelectText now permits incremental extension of the selection using either touch or trackball data. SelectText adds word selection and select all interfaces. SelectText has been rewritten to do a better job of finding space characters and selecting text outside of the visible window. Companion changes in frameworks/base and packages/apps/Browser Change-Id: I28a815375345d842f79464edbf0cb3a2019b7fe8 http://b/2626451
* | order text selection by line centersCary Clark2010-08-201-3/+3
| | | | | | | | | | | | | | | | | | The older logic assumed that lines don't overlap, but in the case of Google news, the lines do overlap. The new logic uses the line centers for ordering. Change-Id: I56074d289f76ed5027e3a498753caf50644b97f0 http://b/262451
* | Merge WebKit at r65072: String class has moved to the WTF namespace.Ben Murdoch2010-08-131-3/+3
| | | | | | | | | | | | See http://trac.webkit.org/changeset/65021 Change-Id: I779a8ec0c3e1e0aed8f8d1894cfc1e5ca33ee549
* | select text out of orderCary Clark2010-07-211-117/+246
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the selected text visual order doesn't match the picture order, the text is selected spacially. The rectangle described by the start and end points limits what text is selected. This can fail when the rectangle described is too narrow to enclose all the lines between the top and bottom. This change extends the lines by including the text adjacent to the start and end when computing the limit bounds. And: - Refactor the code so that drawing the region and selecting the text can share this logic. - Add slashes as characters that prevent inserting spaces at the ends of lines. (ASCII characters space, dash, slash, and backslash cause lines to wrap.) - Narrow the error term for detecting spaces. The 1/2 value before inserted spaces incorrectly. Change-Id: I645f38dc246c61b1bc7c94e61553e5e6e36e3f85 http://b/2817635
* | handle out of order selectionsCary Clark2010-07-091-108/+295
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usually, the text on a webpage is drawn from top to bottom but sometimes it is drawn out of order. In these cases the picture finds the select end before it finds the select start. When the select start and end are ordered, all of the text in the picture between the two are selected. This allows selecting all of the text on the page, even if the start isn't spacially before the end. When the select start and end are flipped, select the text spacially between the two. The flipped page scenario was found by http://code.google.com/p/android/issues/detail?id=8533 Change-Id: Ia22d49396d68fefc3d64fad438c4b0c02f668c1c
* | refine text selectionCary Clark2010-06-291-24/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change 'select all' to begin with the first character and end with the last rather than relying on the top left and bottom right. The old algorithm failed for pages broken into multiple columns. Similarly, capture the text from the beginning selection to the ending selection, rather than relying on the characters contained by the selection region. Reduce the gap required to add a linebreak from twice the lineheight to 1.5x the lineheight. Change-Id: Ib90a719ea3353feeaa3a6cc692d0dd9cff498cb5 http://b/262451
* | Refactor find and select dialogsCary Clark2010-06-251-126/+779
| | | | | | | | | | | | | | | | | | | | | | | | | | | | SelectText now permits incremental extension of the selection using either touch or trackball data. SelectText adds word selection and select all interfaces. SelectText has been rewritten to do a better job of finding space characters and selecting text outside of the visible window. Companion changes in frameworks/base and packages/apps/Browser Change-Id: I917a14124a41a3c9bd72ffa48fe36e55e7c4e543 http://b/2626451
* | reverse RTL characters in copyCary Clark2010-05-211-0/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Text is copied from the picture in visual left-to-right order. Reverse right-to-left substrings before returning the result. This algorithm for reversal is also used by webkit to draw text, and has the same limitations. This fixes text pasted into the title bar, but does not work correctly for text pasted into an input field -- LTR text is placed incorrectly -- but that's another bug. Change-Id: I4709b74e32495d4b77d33910ac8da34d4a88edd0 http://b/2525085
* | Merge webkit.org at r58033 : Update location of CString.hSteve Block2010-05-111-1/+1
|/ | | | | | See http://trac.webkit.org/changeset/56825 Change-Id: I8ba6a9685dcd1d8c4dec3400fba81e19fcbfe74d
* use advance widths to deduce spaces in selected textCary Clark2010-03-011-15/+41
| | | | | | | | | | | | | The earlier method of using bounding boxes does not work if the characters have sufficiently large kerning, such as 'A Java' or sufficiently small kerning, such as '16'. Also, don't add spaces after hyphens or dashes, and detect baseline changes correctly. Reset the first space condition once text is clipped out. http://b/2457350 http://b/2165553
* refactor drawing to support layersCary Clark2010-02-241-0/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drawing elements that appear atop or below layers need to be drawn both in the proper order and with the correct canvas to respect clipping and the matrix. Drawing the find results, text selection, or the cursor ring, interleaves with any layers that may be drawn. The main picture is treated as owned by a LayerAndroid so each component can decide when to draw. This change leave the main picture in WebViewCore.cpp, and draws everything else in WebView.cpp -- in the future, additional refactoring can put all drawing in one place. The logic of what to draw is still in WebView.java, but the actual drawing calls are now triggered inside the layer code. Android.mk - Add rule to trigger building without layers from buildspec.mk. LayerAndroid.* - Replace FindOnPage reference with abstract DrawExtra class to draw adornments in the layers' canvas context. - Add a LayerAndroid constructor to create a dummy layer with a SkPicture* and a uniqueId==-1 so that extras can detect when they are drawn by the main picture. android_graphics.* - Move cursor ring drawing out of WebView.cpp to here. - Separate cursor ring setup from actual drawing. - Get the cursor ring metrics in local coordinates. ChromeClientAndroid.cpp - Fix compiler warnings. WebViewCore.* - Move updateCursorBounds from WebView.cpp. This permits it to be called from CursorRing::setup. CachedFrame.* CachedNode.* CachedLayer.* - Add local bounds getters. CachedRoot.h - Move class FindCanvas to the android namespace. DrawExtra.h - Add an abstract class called by LayerAndroid to optionally draw extra elements in its canvas context. FindCanvas.* SelectText.* - Refactor drawing to draw in layers context. WebView.cpp - Move drawing from WebView.java. - Remove selection code to SelectText.cpp. - Use inverseScale to simplify viewPort metrics. - Simplify layer root so java doesn't need to know about it. Requires companion change in frameworks/base http://b/2457316 http://b/2454127 http://b/2454149
* extract selected text from the pictureCary Clark2010-01-051-4/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The deleted code extracted the selected text from the WebKit DOM by looking for text in the render tree that matched the selection region. This has never worked well. The replacement approach matches the glyphs in the picture instead. - WebViewCore.* Remove getSelection() and supporting routines. Part of the deleted code looked for punctuation between segments to add space characters that might not be present in the markup. There's no equivalent in the replacement code; it uses spacial gaps to detect the need to add extra spaces. - SelectText.* Match the text to the selected region and convert the glyph to unicode. The tricky part is that spaces need to be inserted into the string when there are gaps in the text. - WebView.cpp Return the selection as a string to the java caller instead of a region. To convert the glyphs into text, a companion change was made to external/skia. To update the UI thread/webkit thread messaging, a companion change was also made to frameworks/base. Fixes http://b/2166748
* Fixes license headers for all files in WebKit/android, other than those in stl/.Steve Block2009-11-131-1/+2
| | | | | | | | | | | | | These files have not yet been upstreamed to webkit.org. WebKit requires either a BSD-style or LGPL 2.1 license for all code. We use a BSD-style 2-clause license for Android-specific files that will be upstreamed to webkit.org. This change adds licenses where absent or simply fixes the names of copyright holders in the license text to 'THE COPYRIGHT OWNER' and cleans up formatting. Files in stl/ currently use licenses other than BSD-style and will require more careful treatment. Change-Id: I67ad4b8932e432d3eaaeecdfeb0d09418496228d
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+263
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-263/+0
|
* auto import from //branches/cupcake/...@126645The Android Open Source Project2009-01-151-10/+19
|
* Code drop from //branches/cupcake/...@124589The Android Open Source Project2008-12-171-0/+254