summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/android/android_graphics.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge WebKit at r75315: Move Android-specific WebCore files to SourceSteve Block2011-05-121-76/+0
| | | | | | | | | | | | | This moves files in the following WebCore subdirectories ... - bindings/js - bindings/v8/custom - plugins/android - platform/android - platform/graphics/android - page/ - css/ - dom/ - loader/archive/android
* Implements the focus ring drawing in GL.Nicolas Roard2011-04-111-0/+1
| | | | | | | | | In WebView::drawGL(), we check if the extras to draw are rings, and if so we get their rectangles and pass that to GLWebViewState. Updated with holo colors Change-Id: Id5f8941f16dba1733e8a84eae8cd2b317fbc7c55
* fix buttons in GLCary Clark2011-02-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Buttons failed to draw when selected with the keyboard, and sometimes when selected by touch, for three reasons: 1) GL short-circuits if the last extra rectangle and the curent extra rectangle match. When buttons change color, the rectangles do match, but the picture still needs to be redrawn. 2) Buttons do not have cursor rings, so the button's bounds was not passed to GL. 3) The timeout logic to switch from a focused state to a normal state was incorrect. This adds a flag to GLWebViewState::setExtra that can skip the equal rectangle case. Note that the equal rectangle test hides a more serious bug where the setExtra is called repeatedly -- so it would be worthwhile to examine this further. The logic that determines if the cursor is a button was split out so that the cursor ring can be associated with a button even if the cursor is hidden. bug:3364248 Change-Id: I75944cb045486c128743aa13922d20758ccf783f
* reenable draw extras when GL is turned onCary Clark2010-11-231-1/+2
| | | | | | | | | | | | | | | | This captures the drawing in the UI thread, then passes the drawing to the tile imaging thread. The draw extras interface now takes an additional rectangle, and each draw extra fills in the inval area formed as that part is drawn. The old extra implementation in GLWebViewState has been removed. The inval portion of the setBaseLayer call has been split out so it can be called directly. bug:3161294 Change-Id: I28d3e6879059770b973e7c0f7c0796909f7359aa
* simplify cursor ring draw stateCary Clark2010-08-251-10/+1
| | | | | | | | | | | | | | | | | | | | | | Removed old code and state that used to allow for the cursor ring to be different if a synthetic link was pressed, state that allowed the ring to animate, and state that attempted to show the ring until the link it represented was replaced by a new page. The new code - shows the cursor ring indefinitely when the trackball or dpad is moved - shows the cursor for 500 ms when the trackball or dpad is clicked or if the screen is tapped. This is separate from logic that attempts to select whether to show the cursor ring at all; this merely chooses how long to show the cursor ring when the cursor changes. Requires a companion change in frameworks/base Change-Id: I309abe346f6b67ed3b665aaa79c367f4599bf1cd http://b/2135321
* Add CSS cursor ring definitionsCary Clark2010-08-181-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows web pages to have fine-grain control over the appearance of the rings drawn around nodes. Generated links (email, addresses, phone numbers) are no longer given unique colors. To preserve this feature, a separate change could add an HTML extension similar to vlink to provide the cursor ring defintions for theses links. The mechanism implemented below isn't appropriate since these links don't necessarily correspond to single DOM nodes or other DOM elements. ------------ CSS examples ------------ The CSS to specify the ring looks like: -webkit-ring-fill-color:rgba(0,0,255,0.4); -webkit-ring-inner-width:2 px; -webkit-ring-outer-width:3.5 px; -webkit-ring-outset: 8 px; -webkit-ring-pressed-inner-color:rgba(0,0,255,0.8); -webkit-ring-pressed-outer-color:rgba(0,0,127,0.3); -webkit-ring-radius: 10 px; -webkit-ring-selected-inner-color:rgba(63,63,255,0.8); -webkit-ring-selected-outer-color:rgba(63,63,127,0.3); and may be alternately defined with a property shortcut: -webkit-ring:rgba(255,0,0,0.4) 5px 7px rgba(255,0,0,0.8) rgba(127,0,0,0.3) 20px rgba(255,63,63,0.8) rgba(127,63,63,0.3); -------------------- Property definitions -------------------- A vertical cross-section of the ring corresponds to these parameters as shown: ______ R / ___O_ R = corner radius / / __I_ o I = inner ring / / / _O_ ^ O = outer ring | | | / F | F = fill |O|I|O| L o = outset | | | \_F_ | L = original link \ \ \__O_ V \ \___I_ o R \____O_ The fill color specifies what to draw inside the ring when the link is followed. The fill area consists of the original link area plus the outset. The inner and outer widths specify the stoke width of the inner and outer rings, respectively. The widths may be specified in fractional pixels. The implementation captures 4 bits of the fraction. The outset specifies the distance from the edge of the original link to the rings' center. Both rings are drawn at the same center location. The radius specifies the curvature of the corners at the center of the rings. ------------- Data lifetime ------------- The selected colors specify the colors of the inner and outer rings when the trackball or D-pad hovers over the link. The pressed colors specify the colors of the rings when the trackball center is pressed or the link is tapped. The CSS data is recorded in the RenderStyle when the DOM is parsed. The widths are scaled up by 16 to preserve the fraction. When the nav cache is built, the CSS style information is recorded in the CachedColor class. Only unique style sets are recorded; many CachedNode instances can share the same CachedColor instance. When the cursor ring is drawn, the CachedColor is retrieved by getting the index from the CachedNode, and looking up the entry in the CachedFrame. The widths are scaled down by 16 since Lengths are stored by the webkit as integers. ---------- File Edits ---------- WebCore/Android.derived.mk - Build the CSS data property tables by concatentating Android specific data and optionally SVG data. WebCore/config.h - Add switch for these rings. This switch is meant as a convenience for finding the code in WebKit that was added to enable this feature. Since the old code in DrawCursor has been removed, it does not revert to the old behavior if the switch is turned off. WebCore/css/AndroidCSSPropertyNames.in - The new ring properties, plus an old one we added before. WebCore/css/CSSComputedStyleDeclaration.cpp WebCore/css/CSSMutableStyleDeclaration.cpp WebCore/css/CSSParser.cpp WebCore/css/CSSStyleSelector.cpp - I can guess what these functions are for as well as anyone, but I really don't know. Do I need all of them? Do I need to modify Mutable at all? WebCore/css/CSSPropertyNames.in - Moved Android addition to AndroidCSSPropertyNames.in WebCore/platform/graphics/Color.h - Added initial color values here. WebCore/platform/graphics/android/android_graphics.* - This draws the cursor ring. The code that draws 'synthetic' links has been discarded. WebCore/rendering/style/RenderStyle.h - Functions to get, set, and initialize the style data. WebCore/rendering/style/StyleRareInheritedData.* - The storage for the style data and an equivalence function. WebKit/Android.mk - Added CachedColor to the build. WebKit/android/nav/CacheBuilder.cpp - Record the color from the DOM into the cache. WebKit/android/nav/CachedColor.* - Store the cached color info. WebKit/android/nav/CachedFrame.* - Where the array of colors is stored. WebKit/android/nav/CachedNode.* - Where the index to the colors is stored. Change-Id: Ia3a931f41d6545e47678e245aafe7c84d4658f94 http://b/2603197
* Enable navigation in scrollable layers.Patrick Scott2010-08-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EventHandler: * Added IgnoreClipping in order to touch nodes that are clipped out. android_graphics: * Remember the absolute bounds of the node for invals. RenderBox: * Fix a compiler warning. RenderLayer: * Do not record the entire layer contents unless the scroll dimensions are larger than the client dimensions. * Change isSelfPaintingLayer to check for an overflow clip instead of the scrollable dimensions since it can be too early to check at this point. RenderLayerCompositor: * Same as RenderLayer for checking the overflow clip. WebViewCore: * Scroll the containing layer to the node bounds and offset the mouse position if scrolled. Once the mouse event is processed, restore the layer to 0,0. CacheBuilder: * The body position is no longer used. * Do not clip out nodes if the layer is scrollable. CachedFrame: * Add unadjustBounds to restore adjusted bounds to their original position (fixed position elements). * Call unadjustBounds when a node has been found. This new set of bounds is passed over to WebViewCore to handle clicks. * Reject empty node bounds. CachedLayer: * Document adjustBounds and add unadjustBounds. Add in the scroll position to the node bounds. CachedRoot: * Unadjust the mouse bounds. WebView: * Unadjust the mouse bounds and use the absolute bounds of the ring during inval. Bug: 1566791 Change-Id: Ia55f2cbb61869087176d3ff61882e40324614c6a
* Revert "Add CSS cursor ring definitions"Cary Clark2010-07-301-0/+3
| | | | This reverts commit 0ed6485271097ecf1b4cf4e790f9cfdbb57d921c.
* Add CSS cursor ring definitionsCary Clark2010-07-301-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows web pages to have fine-grain control over the appearance of the rings drawn around nodes. Generated links (email, addresses, phone numbers) are no longer given unique colors. To preserve this feature, a separate change could add an HTML extension similar to vlink to provide the cursor ring defintions for theses links. The mechanism implemented below isn't appropriate since these links don't necessarily correspond to single DOM nodes or other DOM elements. ------------ CSS examples ------------ The CSS to specify the ring looks like: -webkit-ring-fill-color:rgba(0,0,255,0.4); -webkit-ring-inner-width:2 px; -webkit-ring-outer-width:3.5 px; -webkit-ring-outset: 8 px; -webkit-ring-pressed-inner-color:rgba(0,0,255,0.8); -webkit-ring-pressed-outer-color:rgba(0,0,127,0.3); -webkit-ring-radius: 10 px; -webkit-ring-selected-inner-color:rgba(63,63,255,0.8); -webkit-ring-selected-outer-color:rgba(63,63,127,0.3); and may be alternately defined with a property shortcut: -webkit-ring:rgba(255,0,0,0.4) 5px 7px rgba(255,0,0,0.8) rgba(127,0,0,0.3) 20px rgba(255,63,63,0.8) rgba(127,63,63,0.3); -------------------- Property definitions -------------------- A vertical cross-section of the ring corresponds to these parameters as shown: ______ R / ___O_ R = corner radius / / __I_ o I = inner ring / / / _O_ ^ O = outer ring | | | / F | F = fill |O|I|O| L o = outset | | | \_F_ | L = original link \ \ \__O_ V \ \___I_ o R \____O_ The fill color specifies what to draw inside the ring when the link is followed. The fill area consists of the original link area the outset. The inner and outer widths specify the stoke width of the inner and outer rings, respectively. The widths may be specified in fractional pixels. The implementation captures 4 bits of the fraction. The outset specifies the distance from the edge of the original link to the rings' center. Both rings are drawn at the same center location. The radius specifies the curvature of the corners at the center of the rings. ------------- Data lifetime ------------- The selected colors specify the colors of the inner and outer rings when the trackball or D-pad hovers over the link. The pressed colors specify the colors of the rings when the trackball center is pressed or the link is tapped. The CSS data is recorded in the RenderStyle when the DOM is parsed. The widths are scaled up by 16 to preserve the fraction. When the nav cache is built, the CSS style information is recorded in the CachedColor class. Only unique style sets are recorded; many CachedNode instances can share the same CachedColor instance. When the cursor ring is drawn, the CachedColor is retrieved by getting the index from the CachedNode, and looking up the entry in the CachedFrame. The widths are scaled down by 16 since Lengths are stored by the webkit as integers. ---------- File Edits ---------- WebCore/Android.derived.mk - Build the CSS data property tables by concatentating Android specific data and optionally SVG data. WebCore/config.h - Add switch for these rings. This switch is meant as a convenience for finding the code in WebKit that was added to enable this feature. Since the old code in DrawCursor has been removed, it does not revert to the old behavior if the switch is turned off. WebCore/css/AndroidCSSPropertyNames.in - The new ring properties, plus an old one we added before. WebCore/css/CSSComputedStyleDeclaration.cpp WebCore/css/CSSMutableStyleDeclaration.cpp WebCore/css/CSSParser.cpp WebCore/css/CSSStyleSelector.cpp - I can guess what these functions are for as well as anyone, but I really don't know. Do I need all of them? Do I need to modify Mutable at all? WebCore/css/CSSPropertyNames.in - Moved Android addition to AndroidCSSPropertyNames.in WebCore/platform/graphics/Color.h - Added initial color values here. WebCore/platform/graphics/android/android_graphics.* - This draws the cursor ring. The code that draws 'synthetic' links has been discarded. WebCore/rendering/style/RenderStyle.h - Functions to get, set, and initialize the style data. WebCore/rendering/style/StyleRareInheritedData.* - The storage for the style data and an equivalence function. WebKit/Android.mk - Added CachedColor to the build. WebKit/android/nav/CacheBuilder.cpp - Record the color from the DOM into the cache. WebKit/android/nav/CachedColor.* - Store the cached color info. WebKit/android/nav/CachedFrame.* - Where the array of colors is stored. WebKit/android/nav/CachedNode.* - Where the index to the colors is stored. Change-Id: Ia3a931f41d6545e47678e245aafe7c84d4658f94 http://b/2603197
* refactor drawing to support layersCary Clark2010-02-241-9/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixes license headers for all Android-specific JavaScriptCore and WebCore ↵Steve Block2009-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | files not yet 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. - For most files, I've fixed the names of copyright holders in the license text to 'THE COPYRIGHT HOLDERS' and cleaned up formatting in the existing BSD-style license. - For Makefiles and the following files in WebCore/platform/graphics/android/, I've changed from an Apache 2.0 license to the BSD-style license. - WebCore/platform/graphics/android/BitmapAllocatorAndroid.cpp - WebCore/platform/graphics/android/BitmapAllocatorAndroid.h - WebCore/platform/graphics/android/SharedBufferStream.cpp - WebCore/platform/graphics/android/SharedBufferStream.h - For the following files, I've changed from an LGPL licese to the BSD-style license. - WebCore/platform/graphics/android/FontPlatformData.h - WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp - WebCore/plugins/android/PluginDataAndroid.cpp Change-Id: Ic4c3e5610afc58637b7a9b81b1d0d1f17f4f4cb1
* Remove obsolete notion of invalid node.Leon Scroggins2009-06-091-1/+0
| | | | | | | | | | | In the old navigation model, we set focus to a node, and checked to see if that node was still valid (could have changed since we built the navigation cache). Then we sent a message back to the UI thread to tell it to draw the ring differently. In the new model, we are essentially moving a mouse, so we do not concern ourselves with whether the node is valid. Here I have removed function and jni to call sendMarkNodeInvalid, the notion of an invalid node in WebView.cpp, and the INVALID flavor of CursorRing. Needs a change in frameworks/base to work properly.
* in the browser, make the trackball more like a mouseCary Clark2009-06-011-8/+7
| | | | | | | | | | | | | | Older code treated the trackball as a four way dpad with equivalents to moving up, down, left and right by generating arrow key events. This change makes the trackball solely generate mousemove events. The old arrow keys in turn were mapped to be as close as possible to tab-key events that moved the focus. The new model leaves focus-changes to the DOM. Clicking the dpad is distinguished from pressing the enter key to be more compatible with desktop-authored web pages.
* share xfermode and color routines with chrome portMike Reed2009-04-291-23/+1
| | | | | | Besides sharing those routines in SkiaUtils.cpp, also remove our (now redundant) android_setrect, etc. calls, since the type-conversion extras we added earlier take care of this by using constructors.
* AI 144502: remove unused/obsolete helper functionsMike Reed2009-04-031-1/+0
| | | | Automated import of CL 144502
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+89
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-89/+0
|
* auto import from //branches/cupcake/...@126645The Android Open Source Project2009-01-151-12/+20
|
* Code drop from //branches/cupcake/...@124589The Android Open Source Project2008-12-171-3/+4
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+80