WO2014206124A1 - 一种电子设备上网页缩放的方法和装置 - Google Patents

一种电子设备上网页缩放的方法和装置 Download PDF

Info

Publication number
WO2014206124A1
WO2014206124A1 PCT/CN2014/074454 CN2014074454W WO2014206124A1 WO 2014206124 A1 WO2014206124 A1 WO 2014206124A1 CN 2014074454 W CN2014074454 W CN 2014074454W WO 2014206124 A1 WO2014206124 A1 WO 2014206124A1
Authority
WO
WIPO (PCT)
Prior art keywords
scaling
pixel value
web page
zoom
webpage
Prior art date
Application number
PCT/CN2014/074454
Other languages
English (en)
French (fr)
Inventor
张炅轩
范国峰
Original Assignee
北京奇虎科技有限公司
奇智软件(北京)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN201310268150.6A external-priority patent/CN103345497B/zh
Priority claimed from CN201310267927.7A external-priority patent/CN103336817B/zh
Priority claimed from CN201310269588.6A external-priority patent/CN103324741B/zh
Priority claimed from CN201310269018.7A external-priority patent/CN103336818B/zh
Priority claimed from CN201310269405.0A external-priority patent/CN103324738B/zh
Priority claimed from CN201310269384.2A external-priority patent/CN103336819B/zh
Priority claimed from CN201310270415.6A external-priority patent/CN103324743B/zh
Priority claimed from CN201310267962.9A external-priority patent/CN103324734B/zh
Application filed by 北京奇虎科技有限公司, 奇智软件(北京)有限公司 filed Critical 北京奇虎科技有限公司
Priority to US14/901,512 priority Critical patent/US10061494B2/en
Publication of WO2014206124A1 publication Critical patent/WO2014206124A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04845Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04847Interaction techniques to control parameter settings, e.g. interaction with sliders or dials
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • G06F3/04883Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures for inputting data by handwriting, e.g. gesture or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2203/00Indexing scheme relating to G06F3/00 - G06F3/048
    • G06F2203/048Indexing scheme relating to G06F3/048
    • G06F2203/04806Zoom, i.e. interaction techniques or interactors for controlling the zooming operation

Definitions

  • the present invention relates to a web page display technology, and more particularly to a method for zooming a web page on an electronic device, a device for zooming a web page on an electronic device, a computer program, and a computer readable medium.
  • FIG. 1 is a schematic illustration of a view of a complete web page displayed on an electronic device.
  • the user can see this area more clearly by zooming in on an area of the page.
  • the specific content is as follows: The pictures, characters and other elements in the area will be enlarged in proportion.
  • Fig. 2 which schematically shows a view of an enlarged area displayed on the electronic device, the content outside the area, especially before that in the area, is later removed by magnification The content will not be displayed because it is out of the screen.
  • scaling is accomplished by modifying the browser kernel component (such as the WebKit component of the Android system) and then bundling it into its application installation package.
  • the prior art solution can re-format the text content in the area when the specified area is enlarged, and display it on the electronic device in a "tiling" manner, so as to achieve the effect of reading novels, avoiding The problem of not being able to display part of the content due to enlargement.
  • this prior art solution has a slower scaling speed and a larger application package (usually more It takes up 5MB to 6MB of storage space. It can't take advantage of the new features brought by the new version of the operating system.
  • there are certain risks in modifying the browser kernel components which increases the difficulty of development and adaptation, and may lead to browsing. The device crashed and it was difficult to find out the specific cause.
  • the zoomed webpage is often not aligned as shown in FIG. 3.
  • the left part of the webpage is removed from the screen of the electronic device.
  • the user can move the webpage content by the touch operation on the screen of the electronic device to change the position of the webpage displayed on the screen, but limited by the precision of the manual touch operation, it is often difficult to make the left side border of the webpage content and the electronic device screen.
  • the left side of the border is completely aligned, and the content of the webpage is difficult to be accurately centered on the screen.
  • multiple touch operations are required to achieve a relatively ideal display effect. Summary of the invention
  • the present invention has been made in order to provide a method for zooming a web page on an electronic device that overcomes the above problems or at least partially solves the above problems, and a corresponding device for zooming a web page on an electronic device, a computer program and a computer Readable media.
  • a method for zooming a webpage on an electronic device comprising the steps of: generating an object that inherits a scaling processor class, and passing an original scaling processor object thereto to construct a custom scaling processor object And replacing the original scaling processor object with the custom scaling processor object; inheriting the webpage display control to construct a custom touch event method; detecting the operation on the touch electronic device to release n-1 of the n touch points The operation of the touch point, where n is an integer greater than or equal to 2; determining whether the operating system of the electronic device supports scaling of the processor object; in the case of support, the scaling processor object operates, including a zoom start method, a zoom process a method and a zooming completion method, wherein in the zooming completion method, the webpage text scaling is set to a display scaling ratio of the webpage display control, and the scaling completion method of the original scaling processor object is performed; if not supported, Set the page text scaling to the page display control Show scaling from the scaling manager object reflection set and enable the scaling method to be invoked
  • an apparatus for scaling a web page on an electronic device comprising: a custom scaling processor object building module configured to generate an object that inherits a scaling processor class, and pass the original scaling processor object to Wherein, to construct a custom scale processor object, and to utilize the The custom zoom processor object replaces the original zoom processor object;
  • the custom touch event method building block is configured to inherit the web page display control to construct a custom touch event method;
  • the touch point detection module is configured to detect the operation of the touch electronic device as loose The operation of n-1 touch points in n touch points, where n is an integer greater than or equal to 2;
  • the scaling processor supports a determining module configured to determine whether the operating system of the electronic device supports scaling of the processor object; a module, configured to operate with the scaled processor object, including a zoom start method, a zoom process method, and a zoom completion method, where the zoom method is set to a webpage display control Displaying a zoom ratio, and performing a zoom completion method of the original zoom processor object;
  • a computer program comprising computer readable code, when the computer readable code is run on a server, causes the service to provide a further aspect according to the present invention, A computer readable medium in which the computer program described above is stored.
  • a custom zoom processor object and a custom touch event method may be constructed to detect an operation of the touch electronic device to release n-1 touch points out of n touch points, and determine an operation of the electronic device Whether the system supports scaling the processor object.
  • the webpage text scaling is set to the display scaling of the webpage display control and the scaling completion method of the original scaling processor object is performed
  • the web page text scaling is set to the display zoom ratio of the web page display control, the settings are reflected from the zoom manager object and the zoom ratio method is enabled for invocation, and the touch event method of the inherited web page display control is executed.
  • embodiments of the present invention are also capable of implementing the above-described electronic devices that do not support scaling of processor objects by the operating system.
  • the ability to re-type after scaling allows for support for almost all electronic devices.
  • the new features brought by the new version of the operating system can be fully utilized, for example, the hardware acceleration function of Android 4.0 and the updated version can significantly increase the zoom speed, and can also utilize the Android 4.0 and the updated version.
  • a customized webpage rendering processor object may be constructed, and in a case where the webpage is scaled, a pixel value of a left side border of the webpage content is obtained, and according to a pixel value of a left side border of the webpage content The webpage content is moved, so that the webpage content is automatically moved after the webpage is zoomed, so that the left side border of the webpage content is aligned with the left side border of the electronic device screen, so that the webpage content is spread over the screen, thereby fully utilizing the display space on the screen.
  • the automatic alignment of the webpage after zooming is realized without manual intervention, thereby avoiding the problem that the manual adjustment is not accurate enough to achieve the desired display effect.
  • the embodiment of the present invention can overcome the pixel value of the left side border of some operating system webpage content to be less than zero by using the operation of the pixel value of the left side border of the webpage content, the second pixel value, and the reference pixel value. The problem of the corresponding area of the webpage content could not be found, thus achieving support for almost all operating systems.
  • FIG. 1 schematically shows a view of a complete web page displayed on an electronic device
  • FIG. 2 schematically shows a view of an enlarged area displayed on the electronic device
  • FIG. 3 schematically shows A view of a web page that is not aligned after the web page is zoomed on the electronic device
  • FIG. 4 is a flow chart schematically showing a method for zooming a web page on an electronic device according to an embodiment of the invention
  • FIG. 5 is a flow chart schematically showing a zoom completion method according to an embodiment of the present invention
  • FIG. 6 is a flow chart schematically showing steps involved in alignment after web page scaling, in accordance with an embodiment of the present invention.
  • FIG. 7 is a flow chart schematically showing the steps of acquiring pixel values according to an embodiment of the present invention.
  • Figure 8 is a schematic illustration of a relative position of a zoom midpoint in a web page and a viewable area, in accordance with one embodiment of the present invention.
  • Figure 9 is a view schematically showing a zoom midpoint at the start of a zoom operation and at the end of a zoom operation, in accordance with one embodiment of the present invention.
  • Figure 10 is a flow chart that schematically illustrates an optional step of a method of post-scaling alignment in accordance with one embodiment of the present invention
  • FIG. 11 is a view schematically showing a view of a web page aligned on a web page after zooming on an electronic device according to an embodiment of the present invention
  • FIG. 12 is a view schematically showing an apparatus for zooming a web page on an electronic device according to an embodiment of the present invention
  • Figure 13 is a block diagram schematically showing a server for performing the method according to the present invention.
  • Fig. 14 schematically shows a storage unit for holding or carrying program code implementing the method according to the invention. detailed description
  • FIG. 4 is a flow chart that schematically illustrates a method 400 of web page scaling and alignment on an electronic device in accordance with an embodiment of the present invention.
  • the principles of the present invention are applicable to any electronic device including display components, including but not limited to: a computer based on a desktop operating system such as Windows, Linux, Mac OS, Unix, etc.; based on mobile operating systems such as iOS, Android, Windows Phone, Symbian, etc. mobile phone, Tablets, video players, e-readers, digital photo frames, and more.
  • a computer based on a desktop operating system such as Windows, Linux, Mac OS, Unix, etc.
  • mobile operating systems such as iOS, Android, Windows Phone, Symbian, etc. mobile phone, Tablets, video players, e-readers, digital photo frames, and more.
  • Android device-based electronic device as an example.
  • this is only to describe the present invention in a specific example to help the reader understand the principles of the present invention, and the scope of the present invention is not limited thereto, but can be applied to any electronic device including a display component, based on any operating system.
  • zoom refers to “zoom out or zoom in”.
  • the webpage content may include not only text content, but also other content such as pictures, videos, and the like.
  • the method 400 for zooming and aligning a web page on an electronic device begins in step S401, in which an object that inherits the scaling processor class is generated, and the original scaling processor object is passed. Go there to build a custom scaled processor object and replace the original scaled processor object with a custom scaled processor object.
  • the method 400 may further include a step S401', wherein the original scaling processor object is obtained.
  • the operating system of the electronic device is Android 2.3.x (eg,
  • the zoom detector object can be reflected and retrieved from the web page display control, and the original scale processor object is reflected and retrieved from the zoom detector object.
  • the webpage display control may be, for example, a WebView control of an Android system, and the scope of the present invention is not limited thereto.
  • the webpage display control may be any control capable of realizing a webpage display function, such as an UlWebView control of an iOS system.
  • the scaling processor object may be an mListener object
  • the scaling detector object may be an mScaleDetector object belonging to the ScaleGestureDetector class.
  • these are merely examples for illustrating the principles of the present invention, and the present invention The scope is not limited to this.
  • the scaling processor object is a module that is called when a zoom operation is performed on a certain control
  • the scaling processor object _mListener object of the Android system is an object of a scaling processor class-OnScaleGestureListener class, which includes The zoom start method, the zoom procedure method, and the zoom completion method, for the mListener object, are divided into the onScaleBegin method, the onScale method, and the onScaleEnd method.
  • the zoom processor object is called.
  • the zoom start method during the user zoom process, the zoom process method of the zoom processor object is called; when the user releases at least one of the two fingers, indicating that the zoom completion is completed, the zoom completion method of the zoom processor object is called.
  • Each of the controls that support scaling can implement its own scaling processor object, and the WebView control is one of them.
  • reflection operation you can use the reflection mechanism provided by the Java language, .Net language, etc. to operate, and temporarily change the method or object from the private attribute to the public attribute for direct use and modification.
  • Java language .Net language, etc.
  • program design languages can be used to temporarily change a method or object from a private attribute to a public attribute in a similar manner to achieve the purpose of the reflection operation.
  • the zoom manager object may be reflected and acquired from the webpage display control, reflected from the zoom manager object, and the zoom detection is obtained.
  • Object and reflects from the scale detector object and retrieves the original scale processor object.
  • the zoom manager object may be an mZoomManager object, and the object may be directly or indirectly called by the WebView control, so that the zoom operation may be extracted from the originally complicated WebView control.
  • this Java class is the WebView control class, namely the WebView class; and in Android 3.0 and later, the object is a Java class object directly used by the WebView control, ie The object of the ZoomManager class.
  • step S401 an object inheriting the scaling processor class is generated, the original scaling processor object is passed therein to construct a custom scaling processor object, and the original scaling processor object is used to replace the original There are scaling processor objects.
  • an object may be generated and inherited by a scaling processor class.
  • the scaling processor class is an OnScaleGestureListener class, so that the object can implement its own The zoom start method, the zoom process method, and the zoom completion method, and then the original scale processor object needs to be passed therein to construct a custom scale processor object, so that after using the custom scale processor object, Calls the system's original scaled processor object.
  • the value of the variable "support scaling processor object" may be set to true.
  • step S403 is performed, in which the webpage display control is inherited to construct a custom touch event method.
  • the touch event method may be, for example, an onTouchEvent method and/or a dispatchTouchEvent method of the Android system, and any touch operation of the user on a certain control, the Android system may trigger a touch processing event of the control, the onTouchEvent method and the dispatchTouchEvent method.
  • a parameter it is used to describe the current touch of the user.
  • it is a MotionEvent object, which is used to describe, for example, the number of current touch points of the user, the corresponding coordinates, and the state of the touch, such as "When moving", "Press When ", "released”, etc.
  • an object in the above step S403, may be generated to inherit the web page display control to construct its own custom touch event method, such as the onTouchEvent method and the dispatchTouchEvent method.
  • step S405 is performed, in which the operation of the touch electronic device is detected as an operation of releasing n-1 touch points out of n touch points, where n is an integer greater than or equal to 2.
  • step S405 for the Android system, whether the n-1 touch points of the n touch points are released may be detected by using the ACTION_POINTER_UP object or the ACTION_POINTER_n-UP object. And trigger the touch event method.
  • a subsequent step S407 is performed, wherein it is determined whether the operating system of the electronic device supports the scaling processor object.
  • the scaling processor object may be an mListener object, which is a module that is called when a zoom operation is performed on a certain control
  • the mListener object of the Android system is an object of the zoom processor class AnScaleDestureListener class, including scaling
  • the start method, the zoom procedure method, and the zoom completion method, for the mListener object are divided into the onScaleBegin method, the onScale method, and the onScaleEnd method.
  • the zoom start method of the processor object in the process of user zooming, the zoom process method of the zoom processor object is called; when the user releases the two fingers, indicating that the zoom is completed, the zoom completion method of the zoom processor object is called.
  • Each of the controls that support scaling can implement its own scaling processor object, and the Web View control is one of them.
  • step S409 is performed, wherein the scaling processor object performs operations, including a scaling start method, a scaling process method, and a scaling completion method.
  • the zoom completion method the webpage text scaling is set to the display scaling of the webpage display control, and the scaling completion method of the original scaling processor object is performed.
  • step S409 in the step of setting the webpage text scaling to the display scaling of the webpage display control in step S409, in the case that the operating system of the electronic device is Android 2.3.x or earlier, Transmitting a text scaling object in the webpage display control, and assigning a value of a display scaling of the webpage display control to the text scaling object; and in a case where the operating system of the electronic device is Android 4.0 or a newer version, A reflection text scaling object in the zoom manager object, and assigning a value of a display scaling of the web page display control to the text scaling object.
  • the text scaling object is an mTextWrapScale object.
  • the display scale of the web page display control is given to the text scale object, that is, the value of the text scale of the text scale object is equal to the value of the display scale of the web display control.
  • the text scaling refers to "page width" / "text width”
  • the display scaling refers to "page width” / "screen width”.
  • the value of the text scaling is equal to the value of the display scale
  • the text width is equal to the width of the page, and the text can be displayed full screen.
  • the text scaling is 2, and the display scale of the Web View control is 1, the ratio of the screen to the text is 1/2; and if the display ratio and text scaling of the Web View control are both 1, It means that the proportion of the screen occupied by the text is 1/1, that is, it is displayed in full screen.
  • the text scaling does not change, when the user slides the text back by touch operation
  • the left border of the text is aligned with the left border of the electronic device screen, the text must be full-screen.
  • the method 400 for zooming and aligning a webpage on the electronic device may further include the following steps: in the zoom start method of step S409, prohibiting zooming and dragging Simultaneously, and performing a scaling start method of the original scaling processor object.
  • the operating system of the electronic device is Android 2.3.x or a newer version
  • the mAllowPanAndScale object in the scaling manager object is obtained by reflection, and the value of the mAllowPanAndScale object is set to false.
  • the mAllowPanAndScale object is used to indicate whether to allow the center point of the zoom to be changed. For example, if you drag two fingers during the zooming process, you can move the whole content. Setting the value to false means that this function is disabled, which ensures that the zooming process does not Deflection will occur.
  • the method 400 for scaling and aligning a webpage on the electronic device may further include the following steps: In the scaling process method of step S409, a scaling process method of the original scaling processor object is performed.
  • the method 400 for zooming and aligning a webpage on the electronic device may further include the following steps: In the zoom completion method of step S409, it is determined whether the webpage supports the zoom function.
  • Fig. 5 schematically shows a flow chart of a zooming completion method in accordance with an embodiment of the present invention, which will be described below in connection with Fig. 5 for each of the optional steps in the zooming completion method.
  • the determining step can be implemented by: obtaining a "support scaling" variable in the Web View control setting module (WebSettings object in the Android system), the variable is a Boolean value, if If true, it means support. If it is false, it means that the zoom function is not supported, and the judgment step is ended.
  • the "minimum scale of current page” object and the “maximum scale of current page” object are reflected from the zoom manager object.
  • the get operations are completed, they are the mMinZoomScale object and the mMaxZoomScale object in the Android system.
  • the zoom completion method of the original zoom processor object can be directly executed.
  • the version of the Android system is determined.
  • the "swing when there is an animation" object in the zoom manager object is obtained through the reflection mechanism provided by Java (in In the Android system, the mPinchToZoomAnimating object), the value of the object is a Boolean value. If the value is false, the scaling completion method of the original scaling processor object can be directly executed; if the value is true, the webpage described above is executed.
  • the text scaling is set to the step of displaying the zoom ratio of the web page display control, and the zoom completion method of the original zoom processor object is executed.
  • the "Preview Zoom Effect" object is reflected from the Zoom Manager object to complete the get operation, which is the mPreviewZoomOnly object in the Android system. If the value of the object is true, performing the step of setting the scaling of the webpage text to the display scaling of the webpage display control, and performing the scaling completion method of the original scaling processor object; if the value of the object is If false, the scaling completion method of the original scaling processor object is directly executed.
  • step S411 is performed, wherein the webpage text scaling is set to the display scaling of the webpage display control, from the zoom manager object.
  • the middle reflection sets and enables the scaling method to make the call, and executes the touch event method of the inherited web page display control.
  • step S411 in a case where the operating system of the electronic device is Android 2.3.x or earlier, the text scaling object is reflected from the webpage display control, and the webpage is The value of the display scale of the display control is assigned to the text scale object.
  • the text scaling object may be reflected from the zoom manager object, and the value of the display scaling of the web page display control is given to the text scaling object.
  • step S411 the zoom ratio method is reflected from the zoom manager object and the zoom ratio method is enabled to make a call, and the touch event method of the inherited web page display control is executed. Further, in the case where the operation of the touch electronic device is not detected to release n-1 touch points out of n touch points in step S405, the touch event method of the inherited web page display control can be directly executed.
  • the setting and enabling the scaling method may be a setZoomScale method or a setNewZoomScale method, and in step S411
  • the parameters passed in the call can include: the page text scaling set to the display scale of the web page display control, the allowable text layout (set to true), and the forced text layout (set to true).
  • the touch event method of the inherited web page display control that is, the original touch event method.
  • the inTouchEvent method of the parent class and the dispatchTouchEvent method are called. In this way, it is possible to re-type the page after the page is zoomed and to tile the content to the entire screen.
  • the method 400 of the webpage zooming on the electronic device may further include: before the step of setting the webpage text scaling to the display scaling of the webpage display control in step S409 or step S411, Set the value of whether to enable widescreen browsing objects to false.
  • the widescreen browsing object is enabled is a setUseWideViewPort object whose value exists in the Web View control setting module (WebSettings object in the Android system), by which the user can avoid touching the electronic device after the display ratio is enlarged. The screen to move the webpage.
  • the method 400 for webpage scaling on the electronic device may further include: performing the step of performing the scaling completion method of the original scaling processor object or the step S411 in step S409, according to an embodiment of the present invention.
  • the method 400 for zooming and aligning the webpage on the electronic device may further include the steps of determining whether the number of current touched points is greater than 1 and determining whether the webpage is supported before the step S405.
  • the zoom function in the two steps, if the result of the determination in any of the steps is no, no further processing is performed, and the step of executing the touch event method of the inherited web page display control in step S411 is directly performed.
  • the step of determining whether the webpage supports the zoom function may be implemented by: obtaining a "support zoom" variable in the Web View control setting module (WebSettings object in the Android system), the variable is a boolean value, if True, it means support, if it is false, it means that the zoom function is not supported, and the judgment step is ended; the "minimum zoom ratio of current webpage” object and the “maximum zoom ratio of current webpage” object are reflected from the zoom manager object to complete Get operations, which are the mMinZoomScale object and the mMaxZoomScale object in the Android system.
  • FIG. 6 is a flow chart diagrammatically showing the steps involved in post-scaling alignment in accordance with an embodiment of the present invention. As shown in FIG. 6, first, step S413 is performed, in which an object inheriting the event handler class is generated, and an original webpage rendering processor object of the webpage display control is passed therein to construct a custom webpage rendering processor object, and utilized The custom web page rendering processor object replaces the original web page rendering processor object of the web page display control.
  • the method 400 may further include the step S412, wherein the original webpage rendering processor object of the webpage display control is obtained.
  • the webpage rendering processor object may be an mPrivateHandler object, and the scope of the present invention is not limited thereto, and may also be, for example, WindowMessages in a Windows system or a similar module in other systems.
  • the webpage rendering processor object is a processing module that sends a message from the browser kernel component WebKit to the WebView. In the Android system, it is implemented by the Handler method, and receives the message event. Since WebView is only for displaying and receiving touch events, the actual operations are performed in the WebKit component. When the WebKit component is processed, one or more notifications are sent to the WebView control for timely refresh and processing.
  • the web page rendering processor object has only one method, that is, the receiving message method.
  • the handleMessage method is called by the system, and the condition is that the WebView receives the message from the WebKit.
  • the original webpage rendering processor object may be reflected from the webpage display control to obtain the original webpage rendering processor object.
  • step S413 an object inheriting the event handler class is generated, and the original webpage rendering processor object of the webpage display control is passed therein to construct a custom webpage rendering processor object, and the customized webpage rendering process is utilized Object replaces the page display control The original web page renders the processor object.
  • an object may be generated to inherit an object of the event handler class.
  • the event handler class is a Handler class.
  • the object can implement its own method of receiving messages (for the Android system is the handleMessage method), then, the original web page rendering processor object needs to be passed to it to build a custom web page rendering processor object, so that After rendering the processor object using a custom web page, you can also call the system's original web page rendering processor object. Finally, the original web page rendering processor object of the web page display control is replaced with the custom web page rendering processor object.
  • step S415 is performed, in which the pixel value of the left border of the webpage content is obtained.
  • the horizontal coordinate pixel value of the zoom midpoint in the webpage and the ordinate pixel value in the webpage may be the horizontal coordinate pixel value of the zoom midpoint in the webpage at the end of the webpage zooming operation, respectively.
  • the ordinate pixel value in the webpage, the display scaling ratio may be a zooming display zoom ratio, so that the horizontal coordinate pixel value of the midpoint in the webpage and the ordinate pixel value in the webpage may be zoomed at the end of the webpage zooming operation And zooming and displaying the zoom ratio as a parameter to the pixel value method for obtaining the left border of the webpage content, to obtain the first pixel value of the left border of the webpage content.
  • the first pixel value may be acquired after receiving the refresh page message.
  • step S415 it is determined whether a refresh page message is received.
  • the web view control will receive the refresh as long as the web page has content changes on the screen.
  • Page message usually every 2-3 seconds, or when the user operates on the web page, or the web page itself changes, the refresh page message will be called 1-10 times.
  • the refresh page message is numbered 105, and the message name is "NEW_PICTURE_MSG_ID", and the number of the message is slightly different in other systems.
  • the alignment operation according to the present invention may be started after receiving the refresh page message and the next time the refresh page message is received, in the Android system, that is, using the post method of the Handler. This is because if the alignment message is received when the refresh page message is received, it may affect the efficiency of the previous page zoom operation on the page refresh. Therefore, the next time the refresh page message is received (not more than 10ms), the alignment operation is performed. More ideal.
  • the step of acquiring the pixel value of the left side border of the webpage content includes sub-steps S415a, S415b, S415c, S415d, and S415e.
  • FIG. 7 schematically illustrates a flow diagram of various sub-steps in the step of obtaining pixel values for the left side border of web page content, in accordance with an embodiment of the present invention.
  • a method of scaling a midpoint abscissa pixel value and a method of scaling a midpoint ordinate pixel value are obtained from the zoom manager object to obtain a horizontal and vertical coordinate pixel of a view of the zoom midpoint value.
  • the zoom manager object may be an mZoomManager object, which may be directly or indirectly called by the Web View control, so that the zoom operation can be changed from the originally complicated Web View control. It is extracted and becomes a relatively independent module and is used by Web View controls (and even other controls).
  • this Java class is the Web View control class, that is, the Web View class; and in Android 3.0 and later, the object is a Java class directly used by the Web View control.
  • the zoom midpoint abscissa pixel value method may be the mZoomCenterX method
  • the zoom midpoint ordinate pixel value method may be the mZoomCenterY method.
  • Figure 8 is a schematic illustration of a relative position of a zoom midpoint in a web page and a viewable area, in accordance with an embodiment of the present invention.
  • sub-step S415a the horizontal and vertical coordinate pixel values of the view in which the midpoint of the zoom is located are obtained.
  • the obtained horizontal and vertical coordinate pixel values (xl, which are the zoom midpoints with respect to the lower left corner vertex 01 of the display area are obtained.
  • Yl the obtained horizontal and vertical coordinate pixel values
  • Fig. 9 is a view schematically showing a zoom midpoint at the start of a zoom operation and at the end of a zoom operation, according to an embodiment of the present invention.
  • the coordinates of the position where the zoom midpoint is at the beginning of the zoom operation are (x0, y0), and the coordinates of the position where the zoom midpoint is at the end of the zoom operation are (xl, yl).
  • the zoom midpoint may be the zoom midpoint at the end of the zoom operation, that is, (xl, yl) in Fig. 9.
  • the method for acquiring the visible area abscissa pixel value of the webpage display control and the method of obtaining the visible area ordinate pixel value are called to obtain the left lower vertex of the visible area in the webpage.
  • the horizontal and vertical coordinate pixel values may be a getScrollX method
  • the method for acquiring a visible region ordinate pixel value may be a getScrollY method.
  • what is to be acquired in sub-step S415b is the horizontal of the lower left vertex 01 of the visible area relative to the lower left vertex 02 of the webpage.
  • the ordinate pixel value ( x2, y2 ).
  • the method for acquiring the abscissa pixel value of the content and the method for obtaining the ordinate pixel value of the content are reflected from the webpage display control, and the view of the zoomed midpoint is And the horizontal and vertical coordinate pixel values of the left and right vertices of the visible region are respectively added to the horizontal coordinate pixel value method of the acquired content and the ordinate pixel value of the acquired content
  • the method is to obtain the abscissa pixel value of the zoom midpoint in the webpage and the ordinate pixel value of the zoom midpoint in the webpage.
  • the method for acquiring the abscissa pixel value of the content may be a viewToContentX method, and the method for obtaining the ordinate pixel value of the content may be a viewToContentY method.
  • sub-step S415c adding the horizontal and vertical coordinate pixel values of the view of the zoomed midpoint to the horizontal and vertical coordinate pixel values of the lower left vertex of the visible area in the webpage, respectively, to obtain the horizontal and vertical coordinate pixel values ( Xl+x2, yl+y2), that is, the horizontal and vertical coordinate pixel values of the zoom midpoint relative to the bottom left vertex 02 of the webpage, that is, the abscissa pixel value of the zoom midpoint in the webpage and the ordinate of the zoom midpoint in the webpage Pixel values.
  • the method of transferring (xl+x2, yl+y2) as a parameter to the abscissa pixel value method of the acquired content and the method of obtaining the ordinate pixel value of the content is to remove some pixels such as a border, a scroll bar, etc., thereby obtaining a more Accurate position representation.
  • a sub-step S415d is executed, in which the method for obtaining the display zoom ratio of the webpage display control is called to obtain the display zoom ratio (eg, the zoom scale is displayed after zooming).
  • the method of acquiring a display scaling is a getScale method.
  • what is to be acquired may be the display scaling after the end of the scaling.
  • a sub-step S415 e is performed, where the zooming midpoint pixel value in the webpage, the zooming midpoint pixel value in the webpage, and the zoomed display zoom
  • the scale is passed as a parameter to the method of obtaining the pixel value of the left border of the webpage content to obtain the pixel value of the left border of the webpage content.
  • the abscissa pixel value in the webpage at the zoom point and the ordinate pixel value in the webpage are the abscissa pixel values of the zoom midpoint in the webpage at the end of the webpage zooming operation, respectively, and in the webpage.
  • the ordinate pixel value and the display zoom ratio are zoomed display zoom ratios, and the first pixel value of the left border of the webpage content is acquired at this time.
  • the obtaining the left side of the webpage content The pixel value method of the box is the getBlockLeftEdge method or the nativeGetBlockLeftEdge method.
  • the pixel value method of the box is the getBlockLeftEdge method or the nativeGetBlockLeftEdge method.
  • the horizontal and vertical coordinate pixel values (xl+x2, yl+y2) and the scaled display scaling may be passed as parameters to the getBlockLeftEdge method or the nativeGetBlockLeftEdge method, and the pixels of the left border of the returned webpage content may be If the value is negative, it indicates that the pixel value of the left border of the web content is not obtained, and the alignment operation cannot be performed. The pixel value can be discarded at this time. In the case where the pixel value of the left border of the returned webpage content is a positive number or zero, it indicates that the pixel value of the left border of the webpage content has been obtained.
  • step S417 is performed, in which the webpage content is moved according to the pixel value of the left border of the webpage content, and the original webpage rendering processor object is called to perform processing.
  • the pixel value of the left border of the saved webpage content for example, the first pixel value
  • the rear display zoom ratio for example, the zoomed display scale
  • the lower left vertex of the visible area may be used.
  • the ordinate pixel value (i.e., y2 above) in the web page is passed as a parameter to the mobile visual area method, thereby moving the web content in the horizontal direction. That is, the position of the visible area is adjusted only in the horizontal direction, but does not change in the vertical direction.
  • the mobile visual area method is the scrollTo method or the pinScrollTo method.
  • the pixel value of the left border of the saved webpage content may be subtracted from the pre-defined pixel value to obtain a corrected pixel value of the left side border of the webpage content, and the Correcting the pixel value, the scaled display scale, and the ordinate pixel value of the lower left vertex of the visible area as a parameter to the mobile viewable area method, thereby moving the webpage content in the horizontal direction.
  • the purpose of the step of subtracting the pixel value of the left side border of the saved webpage content from the pre-defined pixel value is to ensure normal alignment.
  • the pre-defined pixel value can be selected according to actual needs, for example, 5 pixels, which will be saved.
  • the pixel value of the left border of the webpage content is subtracted by 5 pixels to obtain the corrected pixel value of the left border of the webpage content.
  • the corrected pixel value is made zero.
  • the modified pixel value, the scaled display zoom ratio, and the ordinate pixel value of the left lower vertex of the visible area in the webpage may be transmitted as parameters to the mobile visual area method, thereby Move web content horizontally.
  • the original web page rendering processor object is called to perform processing.
  • Figure 10 schematically illustrates a flow chart including optional steps in accordance with an embodiment of the present invention. As shown in FIG.
  • the step S415 of acquiring the pixel value of the left side border of the webpage content may include step S1001d, step S1002, and step S1005, that is, acquiring the left side border of the webpage content according to an embodiment of the present invention.
  • the step of moving the webpage content according to the pixel value of the left side border of the webpage content in the above step S417 may include step S1003, step S1006, or step S1007, that is, according to the first pixel value and the second pixel of the left side border of the webpage content. Value, or reference pixel value, moves web content.
  • the method may further include optional steps S1001a, S1001b, S1001c, and S1004 in addition to the above S1001d, S1002, S1005, S1003, S1006, and S1007.
  • the method may further include the step S1001.
  • the reference pixel value of the left side frame of the webpage content of the webpage may be acquired; then, in the sub-step SlOOlb, it is determined whether the reference pixel value is a positive number or zero.
  • a default value of a reference pixel value of a left side border of the webpage content of the webpage is a negative predetermined value. For example, if the obtained reference pixel value is a negative number, it indicates that the webpage content is not successfully obtained. The pixel value of the side border.
  • sub-step S10Old is performed, wherein the abscissa pixel value and the ordinate pixel value of the zoom midpoint are started based on the zoom operation start (for example, (x0, y0) as shown in FIG. 9) And displaying the zoom ratio before zooming, obtaining the pixel value of the left border of the webpage content, and using the pixel value as the reference pixel value of the left border of the webpage content if the obtained pixel value is positive or zero.
  • the operations of the sub-steps in step S415 described above may be utilized to acquire the abscissa pixel value and the ordinate pixel value of the zoom midpoint at the start of the zoom operation and the zoom ratio before zooming, and thereby obtain the webpage
  • the reference pixel value of the left border of the content That is, in the sub-step S10Old, the zoom operation can be started
  • the horizontal and vertical ordinate pixel values of the zoom midpoint and the zoomed scale before zooming are passed as parameters to the pixel value of the left border of the webpage content to obtain the pixel value of the left border of the webpage content.
  • the method for obtaining the pixel value of the left border of the webpage content may be the getBlockLeftEdge method or the nativeGetBlockLeftEdge method as described above.
  • step S1002 is performed, wherein the horizontal and vertical coordinate pixel values in the webpage in the zooming point are respectively the zooming midpoint at the end of the webpage zooming operation
  • the display zoom ratio is the scale after the zoom display
  • the operations of the sub-steps in step S415 described above may be utilized to obtain the abscissa pixel value and the ordinate pixel value of the zoom midpoint at the end of the webpage zooming operation, and the zoomed display zoom ratio, and thereby obtain The first pixel value of the left border of the page content.
  • steps S1003 and S1004, or steps S1005 and S1006 may be performed.
  • step S1003 may be performed, wherein the webpage content is moved according to the first pixel value.
  • step S1004 the first pixel value is recorded as a reference pixel value of the left side border of the webpage content of the webpage.
  • the first pixel value of the left side border of the webpage content, the zoomed display zoom ratio, and the ordinate pixel value of the left lower vertex of the visible area in the webpage may be (ie, the above y2) is passed as a parameter to the mobile visual area method, thereby moving the web content in the horizontal direction. That is, the position of the visible area is adjusted only in the horizontal direction, but does not change in the vertical direction.
  • the mobile visual area method is a scrollTo method or a pinScrollTo method.
  • step S1005 is performed, wherein the abscissa pixel value and the ordinate pixel value of the midpoint are zoomed based on the zoom operation start (for example, (x0, as shown in FIG. 9) Y0 ) ) and display the zoom ratio before zooming to get the second pixel value of the left border of the web content.
  • the operations of the sub-steps in step S415 described above may be utilized to obtain the abscissa pixel value and the ordinate pixel value of the zoom midpoint at the start of the zoom operation and the display zoom ratio before zooming, and thereby obtain The second pixel value of the left border of the page content.
  • step S1006 is performed, wherein the webpage content is moved according to the second pixel value, and the second pixel value is recorded as The reference pixel value of the left border of the page content of the page.
  • the abscissa pixel value and the ordinate pixel value of the zoom midpoint at the start of the zoom operation and the pre-zoom display zoom ratio may be transmitted to the pixel of the left border of the webpage content.
  • the value method to get the second pixel value of the left border of the web content may be transmitted to the pixel of the left border of the web content.
  • the method for obtaining the pixel value of the left border of the webpage content may be the getBlockLeftEdge method or the nativeGetBlockLeftEdge method as described above.
  • the second pixel value, the zoomed display scaling ratio, and the ordinate pixel value of the left lower vertex of the visible area in the webpage may be transmitted as parameters to the mobile visual area method. , thereby moving the web content in a horizontal direction. That is, the position of the visible area is adjusted only in the horizontal direction, but does not change in the vertical direction.
  • the mobile visual area method may be the scrollTo method or the pinScrollTo method as described above.
  • step S1007 is performed, wherein the webpage content may be moved according to the reference pixel value.
  • the reference pixel value, the scaled display scale, the ordinate pixel value of the left lower vertex of the visible area in the webpage ie, the above y2
  • the mobile viewable area method may be transmitted as a parameter to the mobile viewable area method, thereby being horizontally Mobile web content.
  • the position of the visible area is adjusted only in the horizontal direction, and is unchanged in the vertical direction, and the moving visible area method may be the scrollTo method or the pinScrollTo method as described above.
  • the reference pixel value of the left side border of the webpage content can be obtained therefrom. Then, in a case where the first pixel value of the left side of the webpage content is a positive number or a zero, in step S1004, the first pixel value may be recorded as a reference pixel value of the left side border of the webpage content of the webpage, Substituting the reference pixel value obtained in step S1001; and if the first pixel value is a negative number, if the second pixel value of the left side border of the webpage content is a positive number or zero, then in step S1006, the second The pixel value is recorded as a reference pixel value of the left side border of the web page content of the web page to replace the reference pixel value obtained in step S1001.
  • the reference pixel value obtained in step S1001 may be used as the reference pixel value of the left side border of the webpage content.
  • the first pixel value is a negative number
  • the zoom ratio is displayed before zooming, and whether the display zoom ratio before zooming is greater than zero, and only if the result of the two determinations is "Yes", the subsequent steps S1005 and the like are executed.
  • the screen width does not change, once the webpage is zoomed, the webpage width changes, and the display zoom ratio of the webpage display control also changes.
  • Fig. 12 schematically shows a view of the webpage aligned after the webpage is scaled on the electronic device.
  • the present invention provides a method of zooming and aligning web pages on an electronic device.
  • a custom zoom processor object and a custom touch event method may be constructed to detect an operation of the touch electronic device to release n-1 touch points out of n touch points, and determine an operation of the electronic device Whether the system supports scaling the processor object.
  • the webpage text scaling is set to the display scaling of the webpage display control and the scaling completion method of the original scaling processor object is performed
  • the web page text scaling is set to the display zoom ratio of the web page display control, the settings are reflected from the zoom manager object and the zoom ratio method is enabled for invocation, and the touch event method of the inherited web page display control is executed.
  • the embodiment of the present invention can also implement the above-mentioned function of scaling and re-typesetting for an electronic device whose operating system does not support scaling of a processor object, thus realizing support for almost all electronic devices.
  • the new features brought by the new version of the operating system can be fully utilized, for example, the hardware acceleration function of Android 4.0 and the updated version can significantly increase the zoom speed, and can also utilize the Android 4.0 and the updated version.
  • New features such as advanced web browsing features.
  • the storage space of the electronic device is saved, and the risk of modifying the browser kernel components is also avoided.
  • a customized webpage rendering processor object may be constructed, and in a case where the webpage is scaled, a pixel value of a left side border of the webpage content is obtained, and according to a pixel value of a left side border of the webpage content
  • the webpage content is moved, so that the webpage content is automatically moved after the webpage is zoomed, so that the left side border of the webpage content is aligned with the left side border of the electronic device screen, so that the webpage content is spread over the screen, thereby fully utilizing the display space on the screen.
  • the automatic alignment of the webpage after zooming is realized without manual intervention, thereby avoiding the problem that the manual adjustment is not accurate enough to achieve the desired display effect.
  • the embodiment of the present invention can overcome the pixel value of the left side border of some operating system webpage content to be less than zero by using the operation of the pixel value of the left side border of the webpage content, the second pixel value, and the reference pixel value.
  • the problem of the corresponding area of the webpage content could not be found, thus achieving support for almost all operating systems.
  • the present invention also provides an apparatus 1200 for zooming and aligning web pages on an electronic device.
  • Figure 12 schematically illustrates a block diagram of an apparatus 1200 for zooming and aligning web pages on an electronic device in accordance with an embodiment of the present invention.
  • the apparatus 1200 for web page scaling and alignment on the electronic device mainly includes a custom zoom processor object construction module 1202, a customized touch event method construction module 1204, a touch point detection module 1206, a zoom processor support determination module 1208, and a zoom.
  • the custom scaling processor object construction module 1202 is configured to generate an object that inherits the scaling processor class, to which the original scaling processor object is passed, to construct a custom scaling processor object, and to utilize the customization
  • the scaling processor object replaces the original scaling processor object
  • the custom touch event method building module 1204 is configured to inherit the web page display control to construct a custom touch event method
  • the touch point detection module 1206 is configured to detect that the operation of the touch electronic device is released Operation of n-1 touch points of n touch points, where n is an integer greater than or equal to 2
  • scaling processor support determination module 1208 is configured to determine whether the operating system of the electronic device supports scaling of the processor object
  • scaling operation module The 1210 is configured to perform operations by using the scaling processor object, including a zoom start method, a zoom process method, and a zoom completion method, where the zooming method of the webpage is set to a webpage display control.
  • the touch event method execution module 1212 is configured to set the webpage text scaling to the display zoom ratio of the webpage display control, if not supported, from the zoom manager object
  • the middle reflection sets and enables the scaling method to make the call, and executes the touch event method of the inherited web page display control.
  • the custom scaling processor object building block 1202 generates an object that inherits the scaling processor class, passes the original scaling processor object into it, builds a custom scaling processor object, and replaces the original scaling process with a custom scaling processor object.
  • the apparatus 1200 may further include an original scaling processor object obtaining module 1201 configured to acquire an original scaling processor object.
  • the original scaling processor object obtaining module 1201 may reflect from the webpage display control. And acquiring a scale detector object, and reflecting from the scale detector object and acquiring the original scale processor object.
  • the webpage display control may be, for example, a WebView control of an Android system, and the scope of the present invention is not limited thereto.
  • the webpage display control may be any control capable of realizing a webpage display function, such as an UlWebView control of an iOS system. .
  • the scaling processor object may be an mListener object
  • the scaling detector object may be an mScaleDetector object, which belongs to the ScaleGestureDetector class.
  • the scaling processor object is a module that is called when a zoom operation is performed on a certain control
  • the scaling processor object _mListener object of the Android system is an object of a scaling processor class-OnScaleGestureListener class, which includes The zoom start method, the zoom procedure method, and the zoom completion method, for the mListener object, are divided into the onScaleBegin method, the onScale method, and the onScaleEnd method.
  • the zoom start method of the zoom processor object is called.
  • the scaling process method of the scaling processor object is called; when the user releases at least one of the two fingers, indicating that the scaling completion is completed, the scaling completion method of the scaling processor object is called.
  • Each of the controls that support scaling can implement its own scaling processor object, and the WebView control is one of them.
  • reflection operation you can use the reflection mechanism provided by the Java language, .Net language, etc. to operate, and temporarily change the method or object from the private attribute to the public attribute for direct use and modification.
  • Java language .Net language, etc.
  • program design languages can be used to temporarily change a method or object from a private attribute to a public attribute in a similar manner to achieve the purpose of the reflection operation.
  • the original scaling processor object obtaining module 1201 can obtain the version number of the Android system by obtaining the Build. VERSION. SDK_INT object.
  • the operating system of the electronic device is Android 4.0 or newer
  • the original scaling processor object obtaining module 1201 can reflect from the web page display control and acquire the zoom manager object, reflect and acquire the zoom detector object from the zoom manager object, and detect from the zoom Reflects in the object and gets the original scaled processor object.
  • the zoom manager object may be an mZoomManager object, which may be directly or indirectly called by the Web View control, so that the zoom operation can be extracted from the originally complicated Web View control. Become a more independent module and be used by Web View controls (and even other controls).
  • this Java class is the Web View control class, that is, the Web View class; and in Android 3.0 and later, the object is a Java class directly used by the Web View control.
  • the custom scaling processor object construction module 1202 generates an object that inherits the scaling processor class, passes the original scaling processor object into it, builds a custom scaling processor object, and utilizes a custom scaling processor object. Replace the original scale processor object.
  • the custom scaling processor object construction module 1202 may generate an object that inherits the scaling processor class.
  • the scaling processor class is an OnScaleGestureListener class, so that the object can implement itself. a zoom start method, a zoom process method, and a zoom completion method, and then the custom zoom processor object construction module 1202 needs to pass the original scale processor object thereto to construct a custom scale processor object, thus, in use After custom scaling the processor object, you can also call the system's original scaled processor object.
  • the custom scaling processor object building block 1202 can set the value of the variable "Support scaling processor object" to true after replacing the original scaling processor object with the custom scaling processor object.
  • the custom touch event method building module 1204 inherits the web page display controls to construct a custom touch event method.
  • the touch event method may be, for example, an onTouchEvent method and/or a dispatchTouchEvent method of the Android system, and any touch operation of the user on a certain control, the Android system may trigger a touch processing event of the control, the onTouchEvent method and the dispatchTouchEvent method.
  • a parameter to describe the current touch of the user in the Android system is a MotionEvent object, which is used to describe, for example, the number of the user's current touch points, the corresponding coordinates, and the state of the touch, such as "when moving", "press When ", "released”, etc.
  • the custom touch event method building module 1204 can generate an object that inherits the web page display control to construct its own custom touch event methods, such as the onTouchEvent method and the dispatchTouchEvent method.
  • the touch point detection module 1206 detects an operation of the touch electronic device to release n-1 touch points out of n touch points, where n is an integer greater than or equal to 2.
  • the touch point detection module 1206 can detect whether the n-1 touch points of the n touch points are released by using the ACTION_POINTER_UP object or the ACTION_POINTER_n-UP object. And trigger the touch event method.
  • the scaling processor support determination module 1208 determines whether the operating system of the electronic device supports the scaling process. Object.
  • the scaling processor object may be an mListener object, which is a module that is called when a zoom operation is performed on a certain control
  • the mListener object of the Android system is an object of the zoom processor class AnScaleDestureListener class, including scaling
  • the start method, the zoom procedure method, and the zoom completion method, for the mListener object are divided into the onScaleBegin method, the onScale method, and the onScaleEnd method.
  • the zoom start method of the zoom processor object is called.
  • the scaling process method of the scaling processor object is called; when the user releases the two fingers, indicating that the scaling is completed, the scaling completion method of the scaling processor object is called.
  • Each of the controls that support scaling can implement its own scaling processor object, and the Web View control is one of them.
  • the scaling operation module 1210 operates using the scaling processor object, including a zooming start method, a scaling process method, and scaling.
  • the method is completed, wherein in the zoom completion method, the webpage text scaling is set to a display scaling ratio of the webpage display control, and the scaling completion method of the original scaling processor object is performed.
  • the operating system of the electronic device is In the case of Android 2.3.x or earlier, the text scaling object is reflected from the webpage display control, and the value of the display scaling of the webpage display control is given to the text scaling object; and in the operation of the electronic device Where the system is Android 4.0 or newer, the text scaling object is reflected from the zoom manager object, and the value of the display scaling of the web page display control is assigned to the text scaling object.
  • the text scaling object is an mTextWrapScale object.
  • the display scale of the web page display control is given to the text scale object, that is, the value of the text scale of the text scale object is equal to the value of the display scale of the web display control.
  • the text scaling refers to "page width" / "text width”
  • the display scaling refers to "page width” / "screen width”.
  • the value of the text scaling is equal to the value of the display scale
  • the text width is equal to the width of the page, and the text can be displayed full screen.
  • the text scaling is 2, and the display scale of the Web View control is 1, the ratio of the screen to the text is 1/2; and if the display ratio and text scaling of the Web View control are both 1, It means that the proportion of the screen occupied by the text is 1/1, that is, it is displayed in full screen.
  • the text scaling does not change, when the user slides the text back by touch operation
  • the left border of the text is aligned with the left border of the electronic device screen, the text must be full-screen.
  • the zoom operation module 1210 also prohibits zooming and dragging from being performed simultaneously in the zoom start method, and performs a zoom start method of the original zoom processor object.
  • the operating system of the electronic device is Android 2.3.x or a newer version
  • the mAllowPanAndScale object in the scaling manager object is obtained by reflection, and the value of the mAllowPanAndScale object is set to false.
  • the mAllowPanAndScale object is used to indicate whether to allow the center point of the zoom to be changed. For example, if you drag two fingers during the zooming process, you can move the whole content. Setting the value to false means that this function is disabled, which ensures that the zooming process does not Deflection will occur.
  • the scaling operation module 1210 also performs a scaling process method of the original scaling processor object in the scaling process method.
  • the zoom operation module 1210 also determines whether the webpage supports the zoom function in the zoom completion method.
  • the optional operation of the various modules of apparatus 1210 in accordance with an embodiment of the present invention can be understood with reference to FIG.
  • the foregoing determining operation of the scaling operation module 1210 can be implemented as follows:
  • the "support scaling" variable in the Web View control setting module (WebSettings object in the Android system) can be obtained, and the variable is a Boolean value. If true, it means support. If it is false, it means that the zoom function is not supported, and the judgment operation is ended.
  • the "minimum scale of current page" object and the "maximum scale of current page” object are reflected from the zoom manager object.
  • the get operation they are the mMinZoomScale object and the mMaxZoomScale object in the Android system.
  • the scale range of the webpage which is usually not disclosed, so it needs to be obtained by reflection; then, it can be compared"
  • the minimum scale of the current webpage "The value of the object is equal to the value of the "Maximum scaling of the current webpage” object. If they are equal, it directly returns false, indicating that the webpage does not support the zoom function. If it is not equal, it returns true, indicating The value of the "Do you support zoom function" variable is true, and the page supports zooming.
  • the zoom operation module 1210 can directly execute the zoom completion method of the original scale processor object.
  • the zoom operation module 1210 determines the version of the Android system.
  • the reflection mechanism provided by Java obtains the "when there is an animation when zooming" object in the zoom manager object (mPinchToZoomAnimating object in the Android system), and the value of the object is a boolean value. If the value is false, the scaling operation module 1210 may directly perform the scaling completion method of the original scaling processor object; if the value is true, the scaling operation module 1210 performs the scaling of the webpage text described above. An operation of displaying a zoom ratio of the web page display control, and performing a zoom completion method of the original zoom processor object.
  • the "Preview Zoom Effect" object is reflected from the zoom operation module 1210 Zoom Manager object to complete the get operation, which is an mPreviewZoomOnly object in the Android system. If the value of the object is true, the scaling operation module 1210 performs the above operation of setting the webpage text scaling to the display scaling of the webpage display control, and executing the scaling completion method of the original scaling processor object. If the value of the object is false, the scaling operation module 1210 directly performs the scaling completion method of the original scaling processor object.
  • the touch event method execution module 1212 sets the webpage text scaling to the display scaling of the webpage display control, reflects the setting from the scaling manager object, and enables the scaling method to make the call, and Executes the touch event method of the inherited web page display control.
  • the operating system of the electronic device is Android
  • the touch event method execution module 1212 reflects the text scaling object from the web page display control and assigns a value of the display scaling of the web page display control to the text scaling object.
  • the touch event method execution module 1212 can obtain the version number of the Android system by obtaining the Build. VERSION. SDK_INT object.
  • the touch event method execution module 1212 may reflect the text scaling object from the zoom manager object and assign the value of the display scaling of the web page display control to the The text scaling object.
  • the touch event method execution module 1212 reflects the settings from the zoom manager object and enables the scaling method to make the call, and executes the touch event method of the inherited web page display control.
  • the touch event method execution module 1212 may directly perform the inherited The touch event method of the web page display control.
  • the setting and enabling the scaling method may be a setZoomScale method or a setNewZoomScale method
  • the parameters passed when the touch event method execution module 1212 is invoked may include: being set as a webpage display control Shows the scale of the page text scale, allows text layout (set to true), and allows forced text layout (set to true).
  • Touch event method execution module after calling the settings and enabling the scaling method
  • the 1212 can execute the touch event method of the inherited web page display control, that is, the original touch event method.
  • the onTouchEvent method and the dispatchTouchEvent method of the parent class are called. In this way, it is possible to re-type the page after the page is zoomed and to tile the content to the entire screen.
  • the zoom operation module 1210 or the touch event method execution module 1212 sets the webpage text scaling to a display zoom ratio of the webpage display control. Before you can, you can also set the value of whether to enable widescreen browsing objects to false.
  • the widescreen browsing object is enabled is a setUseWide ViewPort object, and its value exists in the Web View control setting module (WebSettings object in the Android system), by which the user can avoid touching the electronic after zooming in the display ratio. The device's screen to move the web page.
  • the zoom operation module 1210 before the zoom operation module 1210 performs the zoom completion method of the original zoom processor object or the touch event method execution module 1212 executes the touch event method of the inherited web page display control, Whether to enable the value of the widescreen browsing object is set to true. With this operation, the function of moving a web page by touch operation can be resumed after the text is reformatted.
  • the touch point detecting module 1206 may further determine whether the number of the current touch points is greater than 1, and determine whether the web page supports the zoom function. In the two determinations, if If the result of any of the determinations is no, no further processing is performed, and the touch event method execution module 1212 directly executes the touch event method of the inherited web page display control.
  • the operation of the touch point detection module 1206 to determine whether the webpage supports the zoom function can be implemented as follows:
  • the "support zoom” variable in the Web View control setting module (WebSettings object in the Android system) can be obtained, and the variable is Boolean value, if true, it means support. If it is false, it means that the zoom function is not supported, and the judgment is ended.
  • the "minimum zoom ratio of current page” object and the maximum zoom ratio of the current web page are reflected from the zoom manager object. "Objects to complete the get operations, they are the mMinZoomScale object and the mMaxZoomScale object in the Android system.
  • the apparatus 1200 may further include a customized webpage rendering processor object building block 1214 for implementing a post-scaling alignment function, a pixel value obtaining module 1216, and a webpage content moving module. 1218.
  • the customized webpage rendering processor object building module 1214 Generating an object that inherits the event handler class, passing the original web page rendering processor object of the web page display control to construct a custom web page rendering processor object, and replacing the original web page display control with the custom web page rendering processor object There are web page rendering processor objects.
  • the apparatus 1200 may further include an original webpage rendering processor object obtaining module, which may acquire an original webpage rendering processor object of the webpage display control.
  • the webpage rendering processor object may be an mPrivateHandler object, and the scope of the present invention is not limited thereto, and may also be, for example, WindowMessages in a Windows system or a similar module in other systems.
  • the webpage rendering processor object is a processing module that sends a message from the browser kernel component WebKit to the WebView. In the Android system, it is implemented by the Handler method, and receives the message event. Since WebView is only for displaying and receiving touch events, the actual operations are performed in the WebKit component. When the WebKit component is processed, one or more notifications are sent to the WebView control for timely refresh and processing.
  • the web page rendering processor object has only one method, that is, the receiving message method.
  • the handleMessage method is called by the system, and the condition is that the WebView receives the message from the WebKit.
  • the original web page rendering processor object acquisition module may reflect the original web page rendering processor object from the web page display control to obtain the original web page rendering processor object.
  • the custom web page rendering processor object building module 1214 generates an object that inherits the event handler class, passes the original web page rendering processor object of the web page display control thereto, to construct a custom web page rendering processor object, and utilizes the The custom web page rendering processor object replaces the original web page rendering processor object of the web page display control.
  • the custom web page rendering processor object building module 1214 can generate an object that inherits the objects of the event handler class.
  • the event handler class is a Handler class.
  • the object can implement its own method of receiving messages (for the Android system is the handleMessage method), then, the custom web page rendering processor object building module 1214 needs to pass the original web page rendering processor object to build The custom web page renders the processor object so that after the processor object is rendered using a custom web page, the system's original web page render processor object can also be called.
  • the custom web page rendering processor object building module 1214 utilizes the custom web page rendering processor pair Like replacing the original web page rendering processor object of the web page display control.
  • the pixel value obtaining module 1216 acquires the pixel value of the left border of the webpage content, and the webpage content moving module 1218 moves the webpage content according to the pixel value of the left border of the webpage content, and invokes the original webpage rendering processor object to perform processing. .
  • the horizontal coordinate pixel value of the zoom midpoint in the webpage and the ordinate pixel value in the webpage may be the horizontal coordinate pixel value of the zoom midpoint in the webpage at the end of the webpage zooming operation, respectively.
  • the ordinate pixel value in the webpage, the display zoom ratio may be a zoomed display zoom ratio, wherein the pixel value acquisition module zooms the midpoint pixel value in the webpage and the ordinate in the webpage when the webpage zooming operation ends
  • the pixel value and the zoomed display scale are passed as parameters to the pixel value method for obtaining the left border of the webpage content to obtain the first pixel value of the left border of the webpage content.
  • the pixel value obtaining module 1216 may acquire the first pixel value after receiving the refresh page message.
  • the pixel value acquisition module 1216 determines whether a refresh page message is received. In general, every time a web page changes, whether the change is from the user's operation, or the animation of the web page, or the script of the web page, the web view control will receive the refresh as long as the web page has content changes on the screen. Page message. Usually every 2-3 seconds, or when the user operates on the web page, or the web page itself changes, the refresh page message will be called 1-10 times. In the Android system, the refresh page message is numbered 105 and the message name is "NEW_PICTURE_MSG_ID".
  • the alignment operation according to the present invention can be started after receiving the refresh page message and the next time the refresh page message is received, in the Android system, that is, using the post method of the Handler. This is because if the alignment message is received when the refresh page message is received, it may affect the efficiency of the previous page zoom operation on the page refresh. Therefore, the next time the refresh page message is received (not more than 10ms), the alignment operation is performed. More ideal.
  • the process of acquiring the pixel value of the left border of the webpage content by the pixel value obtaining module 1216 includes the following operations.
  • the operation of the pixel value acquisition module 1216 can be understood with reference to FIG. 7 described above.
  • the pixel value acquisition module 1216 reflects the zoom midpoint abscissa pixel value method and the zoom midpoint ordinate pixel value method from the zoom manager object to obtain the horizontal and vertical coordinate pixel values of the view in which the zoom midpoint is located.
  • the zoom manager object may be an mZoomManager object, which may be directly or indirectly called by the Web View control, so that the zoom operation can be changed from the originally complicated Web View control. It is extracted and becomes a relatively independent module and is used by Web View controls (and even other controls).
  • this Java class is the Web View control class, that is, the Web View class; and in Android 3.0 and later, the object is a Java class directly used by the Web View control.
  • the zoom midpoint abscissa pixel value method may be the mZoomCenterX method
  • the zoom midpoint ordinate pixel value method may be the mZoomCenterY method.
  • Figure 8 is a schematic illustration of a relative position of a zoom midpoint in a web page and a viewable area, in accordance with an embodiment of the present invention.
  • the pixel value acquisition module 1216 obtains the horizontal and vertical coordinate pixel values of the view in which the zoom midpoint is located. As shown in FIG. 8 , the pixel value acquisition module 1216 acquires the horizontal and vertical coordinate pixels of the zoom midpoint relative to the lower left corner vertex 01 of the display area. Value (xl, yl ).
  • Fig. 9 is a view schematically showing a zoom midpoint at the start of a zoom operation and at the end of a zoom operation, according to an embodiment of the present invention.
  • the coordinates of the position where the zoom midpoint is at the start of the zoom operation are (x0, y0), and the coordinates of the position where the zoom midpoint is at the end of the zoom operation are (xl, yl).
  • the zoom midpoint may be the zoom midpoint at the end of the zoom operation, that is, (xl, yl) in Fig. 9.
  • the pixel value obtaining module 1216 invokes the method of acquiring the visible area horizontal coordinate pixel value of the webpage display control and the method of acquiring the visible area ordinate pixel value to obtain the horizontal and vertical coordinate pixel values of the lower left vertex of the visible area in the webpage.
  • the method for acquiring a visible region abscissa pixel value may be a getScrollX method
  • the method for obtaining a visible region ordinate pixel value may be a getScrollY method.
  • the pixel value acquisition module 1216 is to obtain the horizontal and vertical coordinate pixel values (x2, y2) of the lower left vertex 01 of the visible area relative to the lower left vertex 02 of the webpage.
  • the pixel value obtaining module 1216 reflects the abscissa pixel value method of acquiring the content and the ordinate pixel value method of acquiring the content from the webpage display control, and the horizontal and vertical coordinate pixel values of the view of the zoomed midpoint are The horizontal and vertical coordinate pixel values of the left lower vertex of the visible area are respectively added in the webpage and are passed as parameters to the abscissa pixel value method of the acquired content and the ordinate pixel value method of the acquired content, to obtain the zoom midpoint The abscissa pixel value in the web page and the ordinate pixel value of the zoom midpoint in the web page.
  • the method for acquiring the horizontal coordinate pixel value of the content may be a viewToContentX method
  • the method for obtaining the ordinate pixel value of the content may be a viewToContentY method.
  • the pixel value obtaining module 1216 adds the horizontal and vertical coordinate pixel values of the view of the zoomed midpoint to the horizontal and vertical coordinate pixel values of the lower left vertex of the visible region, respectively, to obtain the horizontal and vertical coordinate pixel values (xl +x2, yl+y2 ) , that is, the horizontal and vertical coordinate pixel values of the zoom midpoint relative to the bottom left vertex 02 of the webpage, that is, the horizontal coordinate pixel value of the zoom midpoint in the webpage and the ordinate pixel of the zoom midpoint in the webpage value.
  • the method of transferring (xl+x2, yl+y2) as a parameter to the abscissa pixel value method of the acquired content and the method of obtaining the ordinate pixel value of the content is to remove some pixels such as a border, a scroll bar, etc., thereby obtaining a more Accurate position representation.
  • the pixel value acquisition module 1216 invokes the acquisition display scaling method of the webpage display control to obtain the display scaling.
  • the method of acquiring a display scaling is a getScale method. What the pixel value acquisition module 1216 wants to obtain may be the display scaling ratio after the end of the scaling.
  • the pixel value obtaining module 1216 transmits the abscissa pixel value of the zoom midpoint in the webpage, the ordinate pixel value of the zoom midpoint in the webpage, and the display zoom ratio as parameters to the left side of the webpage content.
  • the pixel value method of the border to get the pixel value of the left border of the web content.
  • the pixel value obtaining module 1216 may adjust the abscissa pixel value of the midpoint in the webpage at the end of the webpage zooming operation, the ordinate pixel value in the webpage, and the zoomed display scale as a parameter to the left side of the obtained webpage content.
  • the pixel value method of the border to get the first pixel value of the left border of the web content.
  • the method for obtaining the pixel value of the left border of the webpage content is the getBlockLeftEdge method or the nativeGetBlockLeftEdge method.
  • the getBlockLeftEdge method For Android 4.1.x and later, you can use the getBlockLeftEdge method, and for Android 4.1.x versions, you can use the nativeGetBlockLeftEdge method.
  • the version of the Android system can be obtained by obtaining the Build.VERSION.SDK_INT object.
  • the pixel value acquisition module 1216 can use the horizontal and vertical coordinate pixel values (xl+x2, yl+y2) and the scaled display scale as The parameter is passed to the getBlockLeftEdge method or the nativeGetBlockLeftEdge method. If the pixel value of the left border of the returned webpage content is negative, it indicates that the pixel value of the left border of the webpage content is not obtained, and the pair cannot be executed. In order to operate, the pixel value can be discarded at this time. In the case where the pixel value of the left border of the returned webpage content is a positive number or zero, it indicates that the pixel value of the left border of the webpage content has been obtained.
  • the webpage content moving module 1218 moves the webpage content according to the pixel value of the left side border of the webpage content.
  • the pixel value of the left border of the saved webpage content for example, the first pixel value described above
  • the display scaling ratio for example, the zoomed display scale
  • the lower left vertex of the visible region may be
  • the ordinate pixel value (i.e., y2 above) in the web page is passed as a parameter to the mobile visual area method to move the web content in the horizontal direction. That is, the position of the visible area is adjusted only in the horizontal direction, and does not change in the vertical direction.
  • the mobile visual area method is the scrollTo method or the pinScrollTo method.
  • the pixel value obtaining module 1216 may subtract the pixel value of the left side border of the saved webpage content by a predefined pixel value to obtain a corrected pixel value of the left side border of the webpage content, and the webpage content moving module 1218
  • the corrected pixel value, the scaled display scale, and the ordinate pixel value of the lower left vertex of the viewable area are transmitted as parameters to the mobile viewable area method, thereby moving the webpage content in the horizontal direction.
  • the purpose of subtracting the pixel value of the left border of the saved webpage content from the pre-defined pixel value is to ensure normal alignment.
  • the pre-defined pixel value can be selected according to actual needs, for example, 5 pixels, the content of the saved webpage is about to be saved.
  • the pixel value of the left border is subtracted by 5 pixels to obtain the corrected pixel value of the left border of the web content.
  • the corrected pixel value is made zero.
  • the webpage content moving module 1218 can transmit the modified pixel value, the scaled display zoom ratio, and the ordinate pixel value of the left lower vertex of the visible area in the webpage (ie, the above y2) as a parameter to the mobile
  • the area method is used to move the web content in the horizontal direction.
  • the zoom midpoint used in the above operation can be the zoom midpoint at the end of the zoom operation.
  • the webpage content moving module 1218 invokes the original webpage rendering processor object execution processing.
  • the touch point detection module 1206 detects that the operation of the touch electronic device is an operation of releasing n-1 touch points out of n touch points, according to an embodiment of the present invention
  • the zoom operation module 1210 or the touch event method 1212 performs the operation of the module to set the webpage text scaling to the display zoom ratio of the webpage display control
  • the reference pixel of the left border of the webpage content of the webpage may also be obtained.
  • the pixel value obtaining module 1216 determines whether the reference pixel value is a positive number or zero. If it is a positive number or zero, the reference pixel value is made unchanged.
  • a default value of a reference pixel value of a left side border of the webpage content of the webpage is a negative predetermined value. For example, if the obtained reference pixel value is a negative number, it indicates that the webpage content is not successfully obtained. The pixel value of the side border.
  • the pixel value acquisition module 1216 scales the abscissa pixel value and the ordinate pixel value of the midpoint based on the zoom operation (eg, (x0, y0) as shown in FIG. 9) And displaying the zoom ratio before zooming, obtaining the pixel value of the left border of the webpage content, and using the pixel value as the reference pixel value of the left border of the webpage content if the obtained pixel value is positive or zero.
  • the pixel value obtaining module 1216 may acquire the abscissa pixel value and the ordinate pixel value of the zoom midpoint at the start of the zoom operation and the display zoom ratio before zooming, in the same manner as the above-described operation.
  • the reference pixel value can be obtained in the same manner as described above, that is, the pixel value acquisition module 1216 can zoom the horizontal and vertical ordinate pixel values of the midpoint of the zoom operation and the zoom display before zooming.
  • the scale is passed as a parameter to the method of obtaining the pixel value of the left border of the webpage content to obtain the pixel value of the left border of the webpage content.
  • the method for obtaining the pixel value of the left border of the webpage content may be the getBlockLeftEdge method or the nativeGetBlockLeftEdge method as described above, according to an embodiment of the present invention.
  • the first pixel value of the left side border of the webpage content is a positive number or In the case of zero, the webpage content moving module 1218 moves the webpage content according to the first pixel value. Then, the webpage content moving module 1218 records the first pixel value as a reference pixel value of the left side border of the webpage content of the webpage.
  • the webpage content moving module 1218 may set a pixel value (for example, the first pixel value) of the left side border of the webpage content, and the display zoom ratio (for example, a zoom ratio after zooming) , the ordinate of the lower left vertex of the visible area in the webpage
  • the pixel value i.e., y2 above
  • y2 the display zoom ratio
  • the mobile visual area method is a scrollTo method or a pinScrollTo method.
  • the pixel value acquisition module 1216 is based on the horizontal coordinate pixel value and the ordinate pixel value of the zoom midpoint at the start of the scaling operation (for example, as shown in FIG. 8 (x0) , y0 ) ) and display the zoom ratio before zooming to get the second pixel value of the left border of the web content.
  • the pixel value acquisition module 1216 may acquire the abscissa pixel value and the ordinate pixel value of the zoom midpoint at the start of the zoom operation and the display zoom ratio before zooming, in the same manner as the operation described above.
  • the second pixel value can be acquired in the same manner as the operation described above.
  • the webpage content moving module 1218 moves the webpage content according to the second pixel value, and records the second pixel value.
  • the webpage content moving module 1218 may transmit the abscissa pixel value and the ordinate pixel value of the zooming midpoint of the zooming operation and the pre-scaling display scaling ratio to the left border of the webpage content. The pixel value method to obtain the second pixel value of the left border of the webpage content.
  • the method for obtaining the pixel value of the left border of the webpage content may be the getBlockLeftEdge method or the nativeGetBlockLeftEdge method as described above.
  • the webpage content moving module 1218 may use the second pixel value, the scaled display scale, and the ordinate pixel value of the left lower vertex of the visible area in the webpage (ie, the above y2) as parameters. Pass to the mobile visual area method to move the web content horizontally. That is, the position of the visible area is adjusted only in the horizontal direction, but is not changed in the vertical direction.
  • the mobile visual area method may be the scrollTo method or the pinScrollTo method as described above.
  • the webpage content moving module 1218 may move the webpage content according to the reference pixel value.
  • the webpage content moving module 1218 may transmit the reference pixel value, the scaled display scale, and the ordinate pixel value of the left lower vertex of the visible area in the webpage (ie, the above y2) as a parameter to the mobile visible area.
  • Method to move web content in a horizontal direction Similarly, the position of the visible area is adjusted only in the horizontal direction, but is not changed in the vertical direction, and the moving visible area method may be as described above.
  • the scrollTo method or the pinScrollTo method may be as described above.
  • the webpage content moving module 1218 when the first pixel value of the left side border of the webpage content is a positive number or zero, the webpage content moving module 1218 The first pixel value may be recorded as a reference pixel value of a left side border of the webpage content of the webpage to replace a reference pixel value obtained in a previous operation; and if the first pixel value is a negative number, if the webpage content is The second pixel value of the left side frame is a positive number or zero, and the webpage content moving module 1218 records the second pixel value as a reference pixel value of the left side border of the webpage content of the webpage to replace the obtained in the previous operation.
  • Reference pixel value If the above conditions are not satisfied, that is, the first pixel value is a negative number, and the second pixel value is also a negative number, the reference pixel value obtained in the previous operation may be used as the reference pixel value of the left side frame of the webpage content.
  • the pixel value obtaining module 1216 obtains the second pixel value, it is also required to determine whether the display scaling ratio at the end of the zoom is It is larger than the display zoom ratio before zooming, and whether the display zoom ratio before zooming is greater than zero. Only when the result of these two judgments is "Yes", the subsequent operations such as acquiring the second pixel value are performed. In the case where the screen width does not change, once the web page is zoomed, the web page width changes, and the display scale of the web page display control also changes.
  • FIG. 1 A view of a web page aligned on a web page after zooming on the electronic device is schematically illustrated.
  • the invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
  • a program implementing the present invention can be stored On a computer readable medium, or in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
  • Server such as an application server.
  • the server conventionally includes a processor 1310 and a computer program product or computer readable medium in the form of a memory 1320.
  • the memory 1320 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read Only Memory), an EPROM, a hard disk, or a ROM.
  • Memory 1320 has a storage space 1330 for program code 1331 for performing any of the method steps described above.
  • storage space 1330 for program code may include various program codes 1331 for implementing various steps in the above methods, respectively.
  • the program code can be read from or written to one or more computer program products.
  • These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. Such a computer program product is typically a portable or fixed storage unit as described with reference to FIG.
  • the storage unit may have a storage section, a storage space, and the like arranged similarly to the storage 1320 in the server of FIG.
  • the program code can be compressed, for example, in an appropriate form.
  • the storage unit includes computer readable code 133 ⁇ , i.e., code readable by a processor, such as 1310, that when executed by the server causes the server to perform various steps in the methods described above.
  • One embodiment or “an embodiment,” or “one or more embodiments” as used herein means that the particular features, structures, or characteristics described in connection with the embodiments are included in at least one embodiment of the invention.
  • the phrase “in one embodiment” herein does not necessarily refer to the same embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • User Interface Of Digital Computer (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

本发明公开了一种电子设备上网页缩放的方法和装置,方法包括:构建定制缩放处理器对象,利用其替换原有缩放处理器对象;继承网页显示控件,以构建定制触摸事件方法;检测对触摸电子设备的操作为松开n个触摸点中的n-1个触摸点的操作,n为≥2的整数;判断是否支持缩放处理器对象;在支持时,缩放处理器对象操作,包括缩放开始、过程和完成方法,在完成方法中,将网页文字缩放比例设置为网页显示控件的显示缩放比例,并执行原有缩放处理器对象的缩放完成方法;在不支持时,将网页文字缩放比例设置为网页显示控件的显示缩放比例,从缩放管理器对象中反射设置并启用缩放比例方法以进行调用,并执行被继承的网页显示控件的触摸事件方法。

Description

一种电子设备上网页缩放的方法和装置
技术领域
本发明涉及网页显示技术, 尤其涉及一种电子设备上网页缩放的方法、 一种电子设备上网页缩放的装置、 一种计算机程序及一种计算机可读介质。 背景技术
随着电子设备智能化的不断发展, 越来越多的用户使用电子设备上 的浏览器浏览网页或其它内容, 而在浏览网页的操作中, 对内容的缩小 或放大(以下筒称"缩放") 的使用场景较为普遍。
在一种现有技术的方案中, 釆用电子设备操作***自带的显示控件, 以 Android***为例, 开启其自带的 Web View控件的缩放功能, 即可实 现缩放。图 1示意性地示出了电子设备上所显示的一个完整网页页面的视 图, 釆用这种现有技术方案, 用户可通过放大页面中的某一区域以更清 楚地看到这一区域的具体内容, 具体表现为: 该区域内的图片、 文字等 元素都会等比例的放大。 然而, 如示意性地示出电子设备上所显示的放 大后的某一区域的视图的图 2所示,该区域外的内容,尤其是之前还在该 区域内、 后来因放大而移出该区域的内容, 会因超出屏幕范围而不能显 示。 与之相对, 通过缩小操作, 能更清楚地看到网页的全貌, 具体表现 为: 区域内的图片、 文字等元素会等比例缩小, 因缩小而空余出来的区 域则会填充上之前没有显示完全的内容, 但与此同时也会导致文字变得 较小, 可读性较差。
在另一种现有技术的方案中, 通过修改浏览器内核组件(如 Android ***的 WebKit组件) , 然后将其捆绑到其应用程序安装包中来实现缩放 功能。 这种现有技术方案可以做到在放大指定区域时, 将该区域内的文 字内容进行重新排版, 并将其 "平铺 "地显示到电子设备上, 以达到类似阅 读小说的效果, 避免了因放大而无法显示部分内容的问题。 然而, 这种 现有技术方案存在着缩放速度较慢、 应用程序安装包较大(通常需要多 占用 5MB到 6MB的存储空间) 、 无法利用新版本的操作***带来的新 特性等缺陷, 同时, 修改浏览器内核组件存在一定的风险, 加大了开发 和适配的难度, 有可能导致浏览器崩溃而难以查出具体原因。
而且, 在网页缩放之后, 经常会出现如图 3 所示的缩放后网页未对 齐情况, 如图 3所示, 网页中左侧的部分内容被移出电子设备的屏幕。 此 时, 用户可以通过在电子设备屏幕上的触摸操作移动网页内容, 改变其 在屏幕上显示的位置, 但受限于手动触摸操作的精度, 往往难以使网页 内容的左侧边框与电子设备屏幕的左侧边框完全对齐, 网页内容难以处 于屏幕上精确居中的位置, 通常需要多次触摸操作调整, 才能达到相对 理想的显示效果。 发明内容
鉴于上述问题, 提出了本发明, 以便提供一种克服上述问题或者至少部 分地解决上述问题的电子设备上网页缩放的方法和相应的电子设备上网页 缩放的装置、 一种计算机程序及一种计算机可读介质。
依据本发明的一个方面, 提供了一种电子设备上网页缩放的方法, 包括 以下步骤: 生成继承缩放处理器类的对象, 将原有缩放处理器对象传递到其 中, 以构建定制缩放处理器对象, 并且利用所述定制缩放处理器对象替换原 有缩放处理器对象; 继承网页显示控件, 以构建定制触摸事件方法; 检测对 触摸电子设备的操作为松开 n个触摸点中的 n-1个触摸点的操作, 其中 n为 大于或等于 2的整数; 判断电子设备的操作***是否支持缩放处理器对象; 在支持的情况下, 所述缩放处理器对象进行操作, 包括缩放开始方法、 缩放 过程方法和缩放完成方法, 其中在缩放完成方法中, 将网页文字缩放比例设 置为网页显示控件的显示缩放比例, 并且执行所述原有缩放处理器对象的缩 放完成方法; 在不支持的情况下, 将网页文字缩放比例设置为网页显示控件 的显示缩放比例, 从缩放管理器对象中反射设置并启用缩放比例方法以进行 调用, 并且执行被继承的网页显示控件的触摸事件方法。 依据本发明的另一方面,提供了一种电子设备上网页缩放的装置,包括: 定制缩放处理器对象构建模块, 配置为生成继承缩放处理器类的对象, 将原 有缩放处理器对象传递到其中, 以构建定制缩放处理器对象, 并且利用所述 定制缩放处理器对象替换原有缩放处理器对象; 定制触摸事件方法构建模 块, 配置为继承网页显示控件, 以构建定制触摸事件方法; 触摸点检测模块, 配置为检测对触摸电子设备的操作为松开 n个触摸点中的 n-1个触摸点的操 作, 其中 n为大于或等于 2的整数; 缩放处理器支持判断模块, 配置为判断 电子设备的操作***是否支持缩放处理器对象; 缩放操作模块, 配置为在支 持的情况下, 利用所述缩放处理器对象进行操作, 包括缩放开始方法、 缩放 过程方法和缩放完成方法, 其中在缩放完成方法中, 将网页文字缩放比例设 置为网页显示控件的显示缩放比例, 并且执行所述原有缩放处理器对象的缩 放完成方法; 触摸事件方法执行模块, 配置为在不支持的情况下, 将网页文 字缩放比例设置为网页显示控件的显示缩放比例, 从缩放管理器对象中反射 设置并启用缩放比例方法以进行调用, 并且执行被继承的网页显示控件的触 摸事件方法。 根据本发明的又一个方面, 提供了一种计算机程序, 其包括计算 机可读代码, 当所述计算机可读代码在服务器上运行时, 导致所述服 根据本发明的再一个方面, 提供了一种计算机可读介质, 其中存 储了以上所述的计算机程序。
本发明的有益效果为:
本发明提供了上述电子设备上网页缩放的方法和装置。根据本发明的实 施例, 可以构建定制缩放处理器对象和定制触摸事件方法, 检测对触摸电子 设备的操作为松开 n个触摸点中的 n-1个触摸点的操作, 判断电子设备的操 作***是否支持缩放处理器对象, 在支持的情况下, 在缩放完成方法中将网 页文字缩放比例设置为网页显示控件的显示缩放比例并且执行所述原有缩 放处理器对象的缩放完成方法, 在不支持的情况下, 将网页文字缩放比例设 置为网页显示控件的显示缩放比例, 从缩放管理器对象中反射设置并启用缩 放比例方法以进行调用, 并且执行被继承的网页显示控件的触摸事件方法。 从而, 可以在不修改浏览器或其它页面显示程序的内核组件(如 Android系 统的 WebKit组件) 的前提下, 实现页面缩放后重新排版、 使内容平铺至整 个屏幕的功能, 解决了因放大而无法显示部分内容的问题。 而且, 本发明的 实施例对于操作***不支持缩放处理器对象的电子设备, 同样能够实现上述 缩放后重新排版的功能,这样就实现了对于几乎所有电子设备的支持。同时, 根据本发明的实施例, 可以充分利用新版本的操作***带来的新特性, 例如 利用 Android 4.0及更新版本的硬件加速功能,可以显著提高缩放速度,还可 以利用 Android 4.0及更新版本的高级网页浏览特征等新特性。另夕卜, 由于不 需要修改浏览器或其它页面显示程序的内核组件, 节省了电子设备的存储空 间, 同时也避免了修改浏览器内核组件带来的风险。 另外, 根据本发明的 实施例, 可以构建定制网页渲染处理器对象, 并且在网页进行了缩放的 情况下, 获取网页内容左侧边框的像素值, 并且根据所述网页内容左侧 边框的像素值移动网页内容, 由此可以在网页缩放之后, 自动移动网页 内容, 使得网页内容的左侧边框与电子设备屏幕的左侧边框对齐, 使得 网页内容铺满屏幕, 从而充分利用屏幕上的显示空间, 达到理想的显示 效果。 根据本发明, 无需人工干预, 即可实现网页缩放后自动对齐, 避 免了手动调整不够精确、 无法达到理想的显示效果的问题。 而且, 本发 明的实施例通过利用网页内容左侧边框的像素值、 第二像素值、 以及参 考像素值的操作, 可以最大程度地克服对于某些操作***网页内容左侧 边框的像素值小于零、 找不到网页内容对应区域的问题, 从而实现了对 于几乎所有操作***的支持。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技 术手段, 而可依照说明书的内容予以实施, 并且为了让本发明的上述和其它 目的、 特征和优点能够更明显易懂, 以下特举本发明的具体实施方式。 附图说明
通过阅读下文优选实施方式的详细描述, 各种其他的优点和益处对于本 领域普通技术人员将变得清楚明了。 附图仅用于示出优选实施方式的目的, 而并不认为是对本发明的限制。 而且在整个附图中, 用相同的参考符号表示 相同的部件。 在附图中:
图 1示意性地示出了电子设备上所显示的一个完整网页页面的视图; 图 2示意性地示出了电子设备上所显示的放大后的某一区域的视图; 图 3示意性地示出了电子设备上网页缩放后未对齐的网页的视图; 图 4示意性地示出了根据本发明一个实施例实施例的电子设备上网页缩 放的方法的流程图; 图 5示意性地示出了才艮据本发明一个实施例实施例的缩放完成方法的流 程图;
图 6示意性地示出了根据本发明一个实施例实施例的涉及网页缩放后对 齐的步骤的流程图;
图 7示意性地示出了根据本发明一个实施例的获取像素值的步骤的流程 图;
图 8示意性地示出了根据本发明一个实施例的缩放中点在网页和可视区 域中的相对位置的视图;
图 9示意性地示出了根据本发明一个实施例的缩放操作开始时和缩放操 作结束时的缩放中点的视图;
图 10示意性地示出了根据本发明一个实施例的缩放后对齐的方法的可 选步骤的流程图;
图 11 示意性地示出了根据本发明一个实施例的电子设备上网页缩放后 对齐的网页的视图; 图 12示意性地示出了根据本发明一个实施例的电子设 备上网页缩放的装置的框图;
图 13 示意性地示出了用于执行根据本发明的方法的服务器的框 图; 以及
图 14示意性地示出了用于保持或者携带实现根据本发明的方法的 程序代码的存储单元。 具体实施方式
下面将参照附图更详细地描述本公开的示例性实施例。 虽然附图中 显示了本公开的示例性实施例, 然而应当理解, 可以以各种形式实现本 公开而不应被这里阐述的实施例所限制。 相反, 提供这些实施例是为了 能够更透彻地理解本公开, 并且能够将本公开的范围完整的传达给本领 域的技术人员。
图 4 示意性地图示了根据本发明的实施例的电子设备上网页缩放和 对齐的方法 400的流程图。
本发明的原理适用于任何包含显示部件的电子设备, 包括、 但不限 于: 基于 Windows, Linux、 Mac OS、 Unix等桌面操作***的计算机; 基 于 iOS、 Android, Windows Phone、 Symbian等移动操作***的移动电话、 平板电脑、 视频播放器、 电子阅读器、 数码相框等等。 在下文中, 将以 基于 Android***的电子设备为例, 对本发明的原理进行示例性地描述。 然而, 这只是为了以具体的示例描述本发明, 以帮助读者理解本发明的 原理, 本发明的范围不限于此, 而是可以适用于任何包含显示部件、 基 于任何操作***的电子设备。
在下面的描述中, "缩放 "均指 "缩小或放大"。
根据本发明的实施例, 网页内容不仅可以包括文字内容, 也可以包 括图片、 视频等其它内容。
如图 4 所示, 根据本发明的实施例的电子设备上网页缩放和对齐的 方法 400始于步骤 S401 ,在步骤 S401中,生成继承缩放处理器类的对象, 将原有缩放处理器对象传递到其中, 以构建定制缩放处理器对象, 并且 利用定制缩放处理器对象替换原有缩放处理器对象。
可选地, 才艮据本发明的实施例, 在步骤 S401之前, 方法 400还可以 包括步骤 S401 ' , 其中, 获取原有缩放处理器对象。
根据本发明的实施例,在电子设备的操作***为 Android 2.3.x(例如,
Android 2.3.7 )或更早版本的情况下, 可以从网页显示控件中反射并获取 缩放检测器对象, 并且从所述缩放检测器对象中反射并获取原有缩放处 理器对象。 根据本发明的实施例, 所述网页显示控件例如可以是 Android ***的 WebView控件, 本发明的范围不限于此, 网页显示控件可以是任 何能够实现网页显示功能的控件, 例如 iOS***的 UlWebView控件等。 可选地, 对于 Android***, 所述缩放处理器对象可以是 mListener对象, 所述缩放检测器对象可以是 mScaleDetector 对象, 其属于 ScaleGestureDetector类, 当然, 这些只是用于例示本发明原理的例子, 本 发明的范围并不局限于此。
根据本发明的实施例, 所述缩放处理器对象是在针对某一控件进行 缩放操作时调用的模块, Android***的缩放处理器对象 _ mListener对 象是缩放处理器类 一 OnScaleGestureListener类的对象, 其包括缩放开始 方法、 缩放过程方法、 以及缩放完成方法, 对于 mListener对象, 它们分 另 ll为 onScaleBegin方法、 onScale方法、 以及 onScaleEnd方法。 以用户在 电子设备的触摸屏幕上利用两个手指进行缩放的场景为例, 当用户准备 双指缩放时, 也即当用户放下双指并开始拖动时, 调用缩放处理器对象 的缩放开始方法; 在用户缩放的过程中, 调用缩放处理器对象的缩放过 程方法; 在用户松开双指中的至少一指, 预示缩放完成时, 调用缩放处 理器对象的缩放完成方法。 每个支持缩放的控件都可以实现属于自己的 缩放处理器对象, WebView控件即是其一。
另外, 对于反射操作, 可以釆用 Java语言、 .Net语言等提供的反射 机制来进行操作, 将方法或对象从私有属性临时变为公有属性, 以供直 接使用和修改。 本领域技术人员能够理解, 同样可以釆用其它的程序设 计语言, 以相似的方式将方法或对象从私有属性临时变为公有属性, 以 达到反射操作的目的。
对于 Android***, 可以通过获取 Build. VERSION. SDK INT对象来 得到 Android***的版本号。
根据本发明的实施例 , 在电子设备的操作***为 Android 4.0或更新 版本的情况下, 可以从网页显示控件中反射并获取缩放管理器对象, 从 所述缩放管理器对象中反射并获取缩放检测器对象, 并且从所述缩放检 测器对象中反射并获取原有缩放处理器对象。 其中, 对于 Android***, 所述缩放管理器对象可以是 mZoomManager对象, 该对象可以直接或间 接地被 WebView控件调用, 这样就可以将缩放操作从原本就很复杂的 WebView控件中抽离出来,成为较为独立的模块,并被 WebView控件(甚 至其它的控件) 所用。 其中, 在 Android 2.3. X或更早版本中, 这个 Java 类就是 WebView控件类, 即 WebView类; 而在 Android 3.0及以后的版 本, 该对象为 WebView 控件所直接使用的一个 Java 类的对象, 即 ZoomManager类的对象。
根据本发明的实施例, 在上述步骤 S401中, 生成继承缩放处理器类 的对象, 将原有缩放处理器对象传递到其中, 以构建定制缩放处理器对 象, 并且利用定制缩放处理器对象替换原有缩放处理器对象。
才艮据本发明的实施例, 在步骤 S401中, 可以生成一个对象, 将其继 承缩放处理器类 , 在 Android 系 统 中 , 缩放处理器类是 OnScaleGestureListener类, 这样, 该对象就可以实现其自己的缩放开始方 法、 缩放过程方法、 以及缩放完成方法, 然后, 需要将所述原有缩放处 理器对象传递到其中, 以构建定制缩放处理器对象, 这样, 在使用定制 缩放处理器对象之后, 还可以调用***的原有缩放处理器对象。 在步骤 S401中,在利用所述定制缩放处理器对象替换原有缩放处理器对象之后, 可以将变量"是否支持缩放处理器对象"的值设置为 true。
如图 4所示, 在步骤 S401之后, 执行步骤 S403 , 其中, 继承网页显 示控件, 以构建定制触摸事件方法。 根据本发明的实施例, 触摸事件方 法例如可以是 Android***的 onTouchEvent方法和 /或 dispatchTouchEvent 方法, 用户对某一控件的任何触摸操作, Android***都会触发该控件的 触摸处理事件, onTouchEvent方法和 dispatchTouchEvent方法带一个参 数, 用来描述用户当前触摸的情况, 在 Android***中是 MotionEvent对 象, 其用来描述例如用户当前触摸点的数量、 相应的坐标、 以及触摸的 状态, 如"移动时"、 "按下时"、 "松开时"等。
才艮据本发明的实施例, 在上述步骤 S403中, 可以生成一个对象, 让 其继承网页显示控件, 以构建其自 己的定制触摸事件方法, 例如 onTouchEvent方法和 dispatchTouchEvent方法。
如图 4所示, 接下来, 执行步骤 S405 , 其中, 检测对触摸电子设备 的操作为松开 n个触摸点中的 n-1个触摸点的操作,其中 n为大于或等于 2的整数。
以 n=2 的情况为例, 即, 假设用户用两根手指触摸电子设备的触摸 屏幕, 在其中一根手指松开时, 就会触发触摸处理事件方法。
根据本发明的实施例, 在步骤 S405中, 对于 Android*** , 可以利 用 ACTION— POINTER— UP对象或者 ACTION— POINTER— n— UP对象检测 是否为松开 n个触摸点中的 n-1个触摸点而触发触摸事件方法。
在检测到对触摸电子设备的操作为松开 n个触摸点中的 n-1个触摸点 的操作时, 执行后续步骤 S407, 其中, 判断电子设备的操作***是否支 持缩放处理器对象。
对于 Android***, 所述缩放处理器对象可以是 mListener对象, 该 对象是在针对某一控件进行缩放操作时调用的模块, Android ***的 mListener对象是缩放处理器类 一 OnScaleGestureListener类的对象,其包 括缩放开始方法、 缩放过程方法、 以及缩放完成方法, 对于 mListener对 象, 它 ^门分另 ll为 onScaleBegin方法、 onScale方法、 以及 onScaleEnd方法。 以用户在电子设备的触摸屏幕上利用两个手指进行缩放的场景为例, 当 用户准备双指缩放时, 也即当用户放下双指并开始拖动时, 调用缩放处 理器对象的缩放开始方法; 在用户缩放的过程中, 调用缩放处理器对象 的缩放过程方法; 在用户松开双指, 预示缩放完成时, 调用缩放处理器 对象的缩放完成方法。 每个支持缩放的控件都可以实现属于自己的缩放 处理器对象, Web View控件即是其一。
当在步骤 S407中判断的结果为电子设备的操作***支持缩放处理器 对象的情况下, 执行步骤 S409, 其中, 所述缩放处理器对象进行操作, 包括缩放开始方法、 缩放过程方法和缩放完成方法, 其中在缩放完成方 法中, 将网页文字缩放比例设置为网页显示控件的显示缩放比例, 并且 执行所述原有缩放处理器对象的缩放完成方法。
根据本发明的实施例, 在步骤 S409中的将网页文字缩放比例设置为 网页显示控件的显示缩放比例的步骤中, 在电子设备的操作***为 Android 2.3.x或更早版本的情况下,从所述网页显示控件中反射文字缩放 比例对象, 并且将网页显示控件的显示缩放比例的值赋予所述文字缩放 比例对象; 而在电子设备的操作***为 Android 4.0或更新版本的情况下, 从所述缩放管理器对象中反射文字缩放比例对象, 并且将网页显示控件 的显示缩放比例的值赋予所述文字缩放比例对象。
根据本发明的实施例, 在 Android***中, 所述文字缩放比例对象是 mTextWrapScale 对象。 将网页显示控件的显示缩放比例赋予所述文字缩 放比例对象, 即, 使文字缩放比例对象的文字缩放比例的值等于网页显 示控件的显示缩放比例的值。 其中, 文字缩放比例是指"网页宽度" /"文本 宽度", 显示缩放比例是指"网页宽度" /"屏幕宽度"。 当文字缩放比例的值 等于显示缩放比例的值时, 文本宽度就等于网页宽度, 该文本便可以全 屏显示。 举例来说, 如果文字缩放比例为 2, 而 Web View控件的显示缩 放比例为 1 , 表示文字所占屏幕的比例为 1/2; 而如果 Web View控件的显 示比例和文字缩放比例均为 1 , 则表示文字所占屏幕比例为 1/1 , 也即全 屏显示。 另外, 即使用户在使用过程中通过触摸操作滑动屏幕将文字部 分移出屏幕(例如滑动到最右侧, 直到文字全部移出屏幕) , 由于文字 缩放比例没有变化, 故当用户通过触摸操作将文字滑动回来时, 一旦文 字的左边框与电子设备屏幕的左边框对齐时, 则文字一定是铺满全屏的。
根据本发明的实施例, 所述电子设备上网页缩放和对齐的方法 400 还可以包括以下步骤: 在步骤 S409的缩放开始方法中, 禁止缩放和拖动 同时进行, 并且执行所述原有缩放处理器对象的缩放开始方法。 其中, 在电子设备的操作***为 Android 2.3.x或更新版本的情况下, 通过反射 获取所述缩放管理器对象中的 mAllowPanAndScale 对象, 并且将所述 mAllowPanAndScale对象的值设置为 false。 mAllowPanAndScale对象用来 表示是否允许改变缩放的中心点, 例如在双指缩放的过程中拖动双指, 则可以移动整个内容, 将其值设为 false表示禁止这一功能, 可以确保缩 放过程中不会发生偏转。
根据本发明的实施例, 所述电子设备上网页缩放和对齐的方法 400 还可以包括以下步骤: 在步骤 S409的缩放过程方法中, 执行所述原有缩 放处理器对象的缩放过程方法。
根据本发明的实施例, 所述电子设备上网页缩放和对齐的方法 400 还可以包括以下步骤: 在步骤 S409的缩放完成方法中, 判断网页是否支 持缩放功能。图 5示意性地示出了根据本发明的实施例的缩放完成方法的 流程图, 下面将结合图 5对于缩放完成方法中的各个可选步骤进行描述。
如图 5 所示, 可选地, 该判断步骤可以通过如下方式实现: 可以获 取 Web View控件设置模块( Android***中的 WebSettings对象)中的 "是 否支持缩放"变量, 该变量为布尔值, 若为 true, 则表示支持, 若为 false, 则表示不支持缩放功能, 结束该判断步骤; 从缩放管理器对象中反射"当 前网页的最小缩放比例"对象和"当前网页的最大缩放比例"对象以完成获 取操作, 它们在 Android ***中分别为 mMinZoomScale 对象和 mMaxZoomScale对象。 通常情况下, 在网页的源代码 (对用户不可见) 中, 会有一部分用来告知该网页的缩放比例范围, 该值通常情况下不公 开, 故需要通过反射来获取; 然后, 可以比较"当前网页的最小缩放比例" 对象的值与"当前网页的最大缩放比例"对象的值是否相等, 若相等, 则直 接返回 false, 表示该网页不支持缩放功能, 若不相等, 则返回 true, 表示 "是否支持缩放功能 "变量的值为 true, 该网页支持缩放功能。
在网页不支持缩放功能的情况下, 可以直接执行原有缩放处理器对 象的缩放完成方法。
在网页支持缩放功能的情况下, 确定 Android***的版本。
如图 5所示, 在 Android***为 4.0或更新版本的情况下, 通过 Java 提供的反射机制获取缩放管理器对象中的 "缩放时是否有动画 "对象(在 Android***中为 mPinchToZoomAnimating对象),该对象的值为布尔值, 若其值为 false, 则可以直接执行原有缩放处理器对象的缩放完成方法; 若其值为 true,则执行上面描述的将网页文字缩放比例设置为网页显示控 件的显示缩放比例的步骤, 并且执行所述原有缩放处理器对象的缩放完 成方法。
如图 5所示, 在 Android***为 2.3.x或更早版本的情况下, 从缩放 管理器对象中反射"是否预览缩放效果"对象以完成获取操作, 该对象在 Android***中为 mPreviewZoomOnly对象。 若该对象的值为 true, 则执 行上面描述的将网页文字缩放比例设置为网页显示控件的显示缩放比例 的步骤, 并且执行所述原有缩放处理器对象的缩放完成方法; 若该对象 的值为 false, 则直接执行原有缩放处理器对象的缩放完成方法。
当在步骤 S407中判断的结果为电子设备的操作***不支持缩放处理 器对象的情况下, 执行步骤 S411 , 其中, 将网页文字缩放比例设置为网 页显示控件的显示缩放比例, 从缩放管理器对象中反射设置并启用缩放 比例方法以进行调用, 并且执行被继承的网页显示控件的触摸事件方法。
类似地, 根据本发明的实施例, 在步骤 S411中, 在电子设备的操作 ***为 Android 2.3.x或更早版本的情况下, 从所述网页显示控件中反射 文字缩放比例对象, 并且将网页显示控件的显示缩放比例的值赋予所述 文字缩放比例对象。
另外, 对于 Android***, 可以通过获取 Build. VERSION.SDK—INT 对象来得到 Android***的版本号。
在电子设备的操作***为 Android 4.0或更新版本的情况下, 可以从 所述缩放管理器对象中反射文字缩放比例对象, 并且将网页显示控件的 显示缩放比例的值赋予所述文字缩放比例对象。
之后, 在步骤 S411中, 从缩放管理器对象中反射设置并启用缩放比 例方法以进行调用, 并且执行被继承的网页显示控件的触摸事件方法。 另外, 在步骤 S405中未检测到对触摸电子设备的操作为松开 n个触摸点 中的 n-1个触摸点的操作的情况下,可以直接执行被继承的网页显示控件 的触摸事件方法。
根据本发明的实施例, 对于 Android***, 所述设置并启用缩放比例 方法可以是 setZoomScale方法或 setNewZoomScale方法, 而在步骤 S411 中调用时传递的参数可以包括: 被设置为网页显示控件的显示缩放比例 的网页文字缩放比例、 允许文字排版(设置为 true ) 、 以及允许强制文字 排版(设置为 true ) 。
在调用了设置并启用缩放比例方法之后, 就可以执行被继承的网页 显示控件的触摸事件方法, 即原来的触摸事件方法, 对于 Android***, 也就是调用其父类的 onTouchEvent方法以及 dispatchTouchEvent方法。 这样, 就可以实现页面缩放后重新排版、 使内容平铺至整个屏幕的功能。
可选地, 根据本发明的实施例, 所述电子设备上网页缩放的方法 400 还可以包括: 在步骤 S409或步骤 S411 中将网页文字缩放比例设置为网 页显示控件的显示缩放比例的步骤之前, 将是否启用宽屏浏览对象的值 设置为 false。 对于 Android ***, 所述是否启用宽屏浏览对象是 setUseWideViewPort对象, 其值存在于 Web View控件设置模块( Android ***中的 WebSettings对象) 中, 通过该操作, 可以避免在放大显示比例 后用户通过触摸电子设备的屏幕来移动网页。
可选地, 根据本发明的实施例, 所述电子设备上网页缩放的方法 400 还可以包括: 在步骤 S409中的执行所述原有缩放处理器对象的缩放完成 方法的步骤或者步骤 S411中的执行被继承的网页显示控件的触摸事件方 法的步骤之前, 将是否启用宽屏浏览对象的值设置为 true。 通过该操作, 可以在文字重新排版之后恢复通过触摸操作移动网页的功能。
如图 5 所示, 另外, 可选地, 所述电子设备上网页缩放和对齐的方 法 400在上述步骤 S405之前, 还可以包括判断当前触摸点的数量是否大 于 1的步骤、 以及判断网页是否支持缩放功能, 在这两个步骤中, 如果其 中任一步骤的判断结果为否, 就不做进一步的处理, 直接执行步骤 S411 中的执行所述被继承的网页显示控件的触摸事件方法的步骤。
可选地, 判断网页是否支持缩放功能的步骤可以通过如下方式实现: 可以获取 Web View控件设置模块( Android***中的 WebSettings对象 ) 中的"是否支持缩放"变量, 该变量为布尔值, 若为 true, 则表示支持, 若 为 false, 则表示不支持缩放功能, 结束该判断步骤; 从缩放管理器对象 中反射"当前网页的最小缩放比例"对象和"当前网页的最大缩放比例"对 象以完成获取操作, 它们在 Android***中分别为 mMinZoomScale对象 和 mMaxZoomScale对象。通常情况下 , 在网页的源代码(对用户不可见) 中, 会有一部分用来告知该网页的缩放比例范围, 该值通常情况下不公 开, 故需要通过反射来获取; 然后, 可以比较"当前网页的最小缩放比例" 对象的值与"当前网页的最大缩放比例"对象的值是否相等, 若相等, 则直 接返回 false, 表示该网页不支持缩放功能, 若不相等, 则返回 true, 表示 "是否支持缩放功能 "变量的值为 true, 该网页支持缩放功能。
在执行了步骤 S409或步骤 S411之后, 即可实现根据本发明的网页 缩放的功能。 另外, 可选地, 本发明还可以包括网页缩放后对齐的步骤。 图 6 示意性地示出了根据本发明的实施例的涉及网页缩放后对齐的步骤 的流程图。 如图 6所示, 首先, 执行步骤 S413 , 其中, 生成继承事件处 理器类的对象, 将网页显示控件的原有网页渲染处理器对象传递到其中, 以构建定制网页渲染处理器对象, 并且利用所述定制网页渲染处理器对 象替换网页显示控件的原有网页渲染处理器对象。
可选地, 才艮据本发明的实施例, 在步骤 S413之前, 所述方法 400还 可以包括步骤 S412, 其中, 获取网页显示控件的原有网页渲染处理器对 象。
根据本发明的实施例, 对于 Android, 网页渲染处理器对象可以是 mPrivateHandler对象 ,本发明的范围不限于此,其还可以例如是 Windows ***中的 WindowMessages或其它***中的类似模块。对于 Android*** , 网页渲染处理器对象是一种从浏览器内核组件 WebKit向 WebView发送 消息的处理模块, 在 Android***中, 其是用 Handler的方式实现的, 起 到接收消息事件的作用。由于 WebView仅仅是为了显示和接收触摸事件, 而真正的操作均在 WebKit组件中进行, 因此在 WebKit组件处理完毕时, 会发送一条或者多条通知到 WebView控件, 以实现及时的刷新和处理。 网页渲染处理器对象仅有一个方法, 即接收消息方法, 对于 Android*** 为 handleMessage 方法, 由***调用, 发生条件为 WebView 收到来自 WebKit的消息。 根据本发明的实施例, 在上述步骤 S405中, 可以从网页 显示控件中反射原有网页渲染处理器对象, 以获取所述原有网页渲染处 理器对象。
接下来, 在步骤 S413中, 生成继承事件处理器类的对象, 将网页显 示控件的原有网页渲染处理器对象传递到其中, 以构建定制网页渲染处 理器对象, 并且利用所述定制网页渲染处理器对象替换网页显示控件的 原有网页渲染处理器对象。
根据本发明的实施例, 在步骤 S413中, 可以生成一个对象, 使其继 承事件处理器类的对象。 例如, 对于 Android***, 所述事件处理器类是 Handler类。这样,该对象就可以实现其自己的接收消息方法(对于 Android ***是 handleMessage方法) , 然后, 需要将所述原有网页渲染处理器对 象传递到其中, 以构建定制网页渲染处理器对象, 这样, 在使用定制网 页渲染处理器对象之后, 还可以调用***的原有网页渲染处理器对象。 最后, 利用所述定制网页渲染处理器对象替换所述网页显示控件的原有 网页渲染处理器对象。
在步骤 S413之后, 执行步骤 S415, 其中, 获取网页内容左侧边框的 像素值。
根据本发明的实施例, 所述缩放中点在网页中的横坐标像素值和在 网页中的纵坐标像素值可以分别是网页缩放操作结束时缩放中点在网页 中的横坐标像素值和在网页中的纵坐标像素值, 所述显示缩放比例可以 是缩放后显示缩放比例, 从而, 可以将网页缩放操作结束时缩放中点在 网页中的横坐标像素值和在网页中的纵坐标像素值以及缩放后显示缩放 比例作为参数传递到获取网页内容左侧边框的像素值方法, 以获取网页 内容左侧边框的第一像素值。 根据本发明的实施例, 可以在接收到刷新 页面消息之后,再获取该第一像素值。根据本发明的实施例,在步骤 S415 中, 要判断是否接收到刷新页面消息。 一般情况下, 每发生一次网页的 变化, 不管这种变化是来自于用户的操作、 还是网页的动画、 或是网页 的脚本, 只要网页在屏幕上有内容改变, Web View控件就都会收到刷新 页面消息。 通常每隔 2-3秒、 或者用户对网页进行操作、 或者网页自身发 生了变化, 刷新页面消息都会被调用 1-10次不等。 在 Android***中, 该刷新页面消息的编号为 105, 消息名称为" NEW— PICTURE— MSG— ID", 该消息在其它***中的编号略有不同。 根据本发明的实施例, 可以在接 收到刷新页面消息之后、 下一次再接收到刷新页面消息时开始执行根据 本发明的对齐操作, 在 Android***中, 也即使用 Handler的 post方法。 这是因为若在当次接收到刷新页面消息就进行对齐操作 , 可能会影响之 前的网页缩放操作对页面刷新的效率, 因此在下一次接收到刷新页面消 息 (不超过 10ms ) 时再进行对齐操作是比较理想的。 根据本发明的实施例, 在上述步骤 S415中, 所述获取网页内容左侧 边框的像素值的步骤包括子步骤 S415a、S415b、S415c、S415d、以及 S415e。 图 7 示意性地示出了根据本发明的实施例的获取网页内容左侧边框的像 素值的步骤中的各子步骤的流程图。
如图 7所示, 在子步骤 S415a中, 从缩放管理器对象中反射缩放中 点横坐标像素值方法以及缩放中点纵坐标像素值方法 , 以获取缩放中点 的所在视图的横纵坐标像素值。
根据本发明的实施例,对于 Android***, 所述缩放管理器对象可以 是 mZoomManager对象,该对象可以直接或间接地被 Web View控件调用 , 这样就可以将缩放操作从原本就很复杂的 Web View控件中抽离出来, 成 为较为独立的模块, 并被 Web View控件(甚至其它的控件)所用。 其中, 在 Android 2.3.x或更早版本中 , 这个 Java类就是 Web View控件类, 即 Web View类; 而在 Android 3.0及以后的版本, 该对象为 Web View控件 所直接使用的一个 Java类的对象, 即 ZoomManager类的对象。 而对于 Android*** , 所述缩放中点横坐标像素值方法可以是 mZoomCenterX方 法, 所述缩放中点纵坐标像素值方法可以是 mZoomCenterY方法。
图 8 示意性地示出了根据本发明的实施例的缩放中点在网页和可视 区域中的相对位置的视图。在子步骤 S415a中,获取缩放中点的所在视图 的横纵坐标像素值,如图 8所示,所获取的是缩放中点相对于显示区域左 下角顶点 01的横纵坐标像素值 ( xl, yl ) 。
图 9示意性地示出了根据本发明的实施例的缩放操作开始时和缩放 操作结束时的缩放中点的视图。如图 9所示,缩放操作开始时缩放中点所 在位置的坐标为 (x0, y0 ) , 而缩放操作结束时缩放中点所在位置的坐标 为 (xl, yl ) 。 在步骤 S415中, 缩放中点可以为缩放操作结束时的缩放 中点, 即图 9中的 (xl, yl ) 。
如图 7所示, 接下来, 在子步骤 S415b中, 调用网页显示控件的获 取可视区域横坐标像素值方法和获取可视区域纵坐标像素值方法 , 以获 取可视区域左下顶点在网页中的横纵坐标像素值。 根据本发明的实施例 , 所述获取可视区域横坐标像素值方法可以是 getScrollX方法,所述获取可 视区域纵坐标像素值方法可以是 getScrollY方法。 如图 8所示, 在子步骤 S415b中要获取的是可视区域左下顶点 01相对于网页左下顶点 02的横 纵坐标像素值( x2, y2 ) 。
如图 7所示, 之后, 执行子步骤 S415c, 其中, 从网页显示控件中反 射获取内容的横坐标像素值方法和获取内容的纵坐标像素值方法, 并且 将所述缩放中点的所在视图的横纵坐标像素值与所述可视区域左下顶点 在网页中的横纵坐标像素值分别相加并作为参数传递到所述获取内容的 横坐标像素值方法和所述获取内容的纵坐标像素值方法, 以获取缩放中 点在网页中的横坐标像素值以及缩放中点在网页中的纵坐标像素值。
根据本发明的实施例, 对于 Android***, 所述获取内容的横坐标像 素值方法可以是 viewToContentX方法, 所述获取内容的纵坐标像素值方 法可以是 viewToContentY方法。 在子步骤 S415c中, 将所述缩放中点的 所在视图的横纵坐标像素值与所述可视区域左下顶点在网页中的横纵坐 标像素值分别相加, 可以得到横纵坐标像素值(xl+x2, yl+y2 ) , 即, 缩 放中点相对于网页左下顶点 02的横纵坐标像素值, 也就是缩放中点在网 页中的横坐标像素值以及缩放中点在网页中的纵坐标像素值。 将(xl+x2, yl+y2 )作为参数传递到所述获取内容的横坐标像素值方法和所述获取内 容的纵坐标像素值方法的目的是去除一些边框、 滚动条等像素, 从而得 到更准确的位置表示。
如图 7所示, 然后, 执行子步骤 S415d, 其中, 调用网页显示控件的 获取显示缩放比例方法, 以获取显示缩放比例 (例: ^缩放后显示缩放比 例)。 根据本发明的实施例, 对于 Android***, 所述获取显示缩放比例 方法是 getScale方法。在子步骤 S415d中, 所要获取的可以是缩放结束后 的显示缩放比例。
如图 7所示, 接着, 执行子步骤 S415e, 其中, 将所述缩放中点在网 页中的横坐标像素值、 所述缩放中点在网页中的纵坐标像素值、 所述缩 放后显示缩放比例作为参数传递到获取网页内容左侧边框的像素值方法, 以获取网页内容左侧边框的像素值。 如上所述, 在所述缩放中点在网页 中的横坐标像素值和在网页中的纵坐标像素值分别是网页缩放操作结束 时缩放中点在网页中的横坐标像素值和在网页中的纵坐标像素值、 所述 显示缩放比例是缩放后显示缩放比例的情况下, 此时所获取的是网页内 容左侧边框的第一像素值。
根据本发明的实施例 , 对于 Android***, 所述获取网页内容左侧边 框的像素值方法是 getBlockLeftEdge方法或 nativeGetBlockLeftEdge方法。 对于 Android 4.1.x版本及之后的版本 , 可以使用 getBlockLeftEdge方法 , 而对于 Android 4.1.x之前的版本,可以使用 nativeGetBlockLeftEdge方法。 对于 Android***, 可以通过获取 Build. VERSION. SDK INT对象来得到 Android***的版本号。
在子步骤 S415e中 , 可以将上述横纵坐标像素值( xl+x2, yl+y2 )以 及缩放后显示缩放比例作为参数传递到 getBlockLeftEdge 方法或 nativeGetBlockLeftEdge方法, 在所返回的网页内容左侧边框的像素值为 负数的情况下, 表明没有获得网页内容左侧边框的像素值, 无法执行对 齐操作, 此时可以丟弃该像素值。 而在所返回的网页内容左侧边框的像 素值为正数或零的情况下, 表明已经获得了网页内容左侧边框的像素值。
在步骤 S415之后,执行步骤 S417, 其中根据所述网页内容左侧边框 的像素值移动网页内容, 并且调用所述原有网页渲染处理器对象执行处 理。 根据本发明的实施例 , 可以将所保存的网页内容左侧边框的像素值 (例如上述第一像素值) 、 所述后显示缩放比例 (例如上述缩放后显示 缩放比例)、 可视区域左下顶点在网页中的纵坐标像素值(即, 上述 y2 ) 作为参数传递到移动可视区域方法 , 从而在水平方向上移动网页内容。 即, 仅在水平方向上调整可视区域的位置, 而在垂直方向上不变。 对于 Android***,所述移动可视区域方法是 scrollTo方法或 pinScrollTo方法。
才艮据本发明的实施例 , 在步骤 S417中, 可以将所保存的网页内容左 侧边框的像素值减去预先定义的像素值以获得网页内容左侧边框的修正 像素值, 并将所述修正像素值、 所述缩放后显示缩放比例、 以及可视区 域左下顶点在网页中的纵坐标像素值作为参数传递到移动可视区域方法, 从而在水平方向上移动网页内容。 将所保存的网页内容左侧边框的像素 值减去预先定义的像素值这一步骤的目的是能够确保正常对齐, 该预先 定义的像素值可以根据实际需要进行选取,例如 5像素, 即将所保存的网 页内容左侧边框的像素值减去 5像素,以获得网页内容左侧边框的修正像 素值。 根据本发明的实施例, 当所述修正像素值小于零时, 令所述修正 像素值为零。 然后, 就可以将所述修正像素值、 所述缩放后显示缩放比 例、 以及可视区域左下顶点在网页中的纵坐标像素值(即, 上述 y2 )作 为参数传递到移动可视区域方法, 从而在水平方向上移动网页内容。 在步骤 S417中,接着,调用所述原有网页渲染处理器对象执行处理。 图 10 示意性地示出了包括根据本发明的实施例的可选步骤的流程 图。 如图 10所示, 可选地, 根据本发明的实施例, 上述获取网页内容左 侧边框的像素值的步骤 S415 可以包括步骤 S1001d、 步骤 S1002、 步骤 S1005 , 即, 获取网页内容左侧边框的参考像素值、 第一像素值、 第二像 素值。 而上述步骤 S417中的根据网页内容左侧边框的像素值移动网页内 容的步骤可以包括步骤 S1003、 步骤 S1006、 或步骤 S1007, 即才艮据网页 内容左侧边框的第一像素值、 第二像素值、 或参考像素值移动网页内容。 下面结合图 10详细描述根据本发明的实施例的上述步骤以及其它可选步 骤。如图 10所示,该方法除了上述 S1001d、 S1002、 S1005、 S1003、 S1006、 S1007之外, 还可以包括可选步骤 S1001a、 S1001b、 S1001c、 S1004。
如图 10所示, 可选地, 根据本发明的实施例, 在步骤 S405 中检测 到对触摸电子设备的操作为松开 n个触摸点中的 n- 1个触摸点的操作的情 况下、 在所述步骤 S409或步骤 S411 中将网页文字缩放比例设置为网页 显示控件的显示缩放比例的步骤之前, 该方法还可以包括步骤 S1001。 首 先, 在步骤 S1001的第一个子步骤 SlOOla中, 可以获取该网页的网页内 容左侧边框的参考像素值; 接着, 在子步骤 SlOOlb中, 判断所述参考像 素值是否为正数或零。 如果其为正数或零, 则执行子步骤 SlOOlc, 该参 考像素值不变。 即, 如果所述参考像素值为正数或零, 则表明已经成功 获取了网页内容左侧边框的参考像素值。 根据本发明的实施例, 所述网 页的网页内容左侧边框的参考像素值的默认值为一负的预定值, 例如 若所获取的参考像素值为负数, 则表明没有成功地获取网页内容左 侧边框的像素值。
如果所述参考像素值为负数, 则执行子步骤 SlOOld, 其中, 基于缩 放操作开始时缩放中点的横坐标像素值和纵坐标像素值(例如, 如图 9 所示的 (x0, y0 ) ) 以及缩放前显示缩放比例, 获取网页内容左侧边框的 像素值, 并且在该获取的像素值为正数或零的情况下将其作为网页内容 左侧边框的参考像素值。 根据本发明的实施例, 可以利用上面描述的步 骤 S415中各子步骤的操作来获取缩放操作开始时缩放中点的横坐标像素 值和纵坐标像素值以及缩放前显示缩放比例 , 并且从而获取网页内容左 侧边框的参考像素值。 即, 在子步骤 SlOOld中, 可以将缩放操作开始时 缩放中点的横坐标像素值和纵坐标像素值以及缩放前显示缩放比例作为 参数传递到获取网页内容左侧边框的像素值方法, 以获取网页内容左侧 边框的像素值。 根据本发明的实施例, 对于 Android***, 根据本发明的 实施例, 对于 Android***, 所述获取网页内容左侧边框的像素值方法可 以是如上所述的 getBlockLeftEdge方法或 nativeGetBlockLeftEdge方法。
如图 10所示, 根据本发明的实施例, 在步骤 S413之后, 执行步骤 S1002, 其中, 在所述缩放中点在网页中的横纵坐标像素值分别是网页缩 放操作结束时缩放中点在网页中的横纵坐标像素值、 并且所述显示缩放 比例是缩放后显示缩放比例的情况下, 获取网页内容左侧边框的第一像 素值。 根据本发明的实施例, 可以利用上面描述的步骤 S415中各子步骤 的操作来获取网页缩放操作结束时缩放中点的横坐标像素值和纵坐标像 素值以及缩放后显示缩放比例 , 并且从而获取网页内容左侧边框的第一 像素值。
如图 10所示, 可选地, 根据本发明的实施例, 在步骤 S1002之后, 可以执行步骤 S1003和 S1004、 或者步骤 S1005和 S1006 (或 S1007 ) 。 在所述网页内容左侧边框的第一像素值为正数或零的情况下, 可以执行 步骤 S1003 ,其中,根据该第一像素值移动网页内容。然后,在步骤 S1004 中, 将该第一像素值记录为该网页的网页内容左侧边框的参考像素值。 才艮据本发明的实施例, 在步骤 S1004 中, 可以将所述网页内容左侧边框 的第一像素值、 所述缩放后显示缩放比例、 可视区域左下顶点在网页中 的纵坐标像素值(即, 上述 y2 )作为参数传递到移动可视区域方法, 从 而在水平方向上移动网页内容。 即, 仅在水平方向上调整可视区域的位 置, 而在垂直方向上不变。 对于 Android***, 所述移动可视区域方法是 scrollTo方法或 pinScrollTo方法。
而在所述第一像素值为负数的情况下, 执行步骤 S1005 , 其中, 基于 缩放操作开始时缩放中点的横坐标像素值和纵坐标像素值(例如, 如图 9 所示的 (x0, y0 ) ) 以及缩放前显示缩放比例, 获取网页内容左侧边框的 第二像素值。 根据本发明的实施例, 可以利用上面描述的步骤 S415中各 子步骤的操作, 来获取缩放操作开始时缩放中点的横坐标像素值和纵坐 标像素值以及缩放前显示缩放比例, 并且从而获取网页内容左侧边框的 第二像素值。 然后, 在所述网页内容左侧边框的第二像素值为正数或零的情况下, 执行步骤 S1006, 其中, 根据所述第二像素值移动网页内容, 并将该第二 像素值记录为该网页的网页内容左侧边框的参考像素值。 根据本发明的 实施例, 在上述步骤 S1005 中, 可以将所述缩放操作开始时缩放中点的 横坐标像素值和纵坐标像素值以及缩放前显示缩放比例传递到获取网页 内容左侧边框的像素值方法, 以获取网页内容左侧边框的第二像素值。 对于 Android***,所述获取网页内容左侧边框的像素值方法可以是如上 所述的 getBlockLeftEdge方法或 nativeGetBlockLeftEdge方法。 而在上述 步骤 S1006 中, 可以将所述第二像素值、 缩放后显示缩放比例、 可视区 域左下顶点在网页中的纵坐标像素值(即, 上述 y2 )作为参数传递到移 动可视区域方法, 从而在水平方向上移动网页内容。 即, 仅在水平方向 上调整可视区域的位置, 而在垂直方向上不变。 对于 Android***, 所述 移动可视区域方法可以是如上所述的 scrollTo方法或 pinScrollTo方法。
而当所述第二像素值为负数时, 执行步骤 S1007, 其中, 可以根据所 述参考像素值移动网页内容。 其中, 可以将所述参考像素值、 缩放后显 示缩放比例、 可视区域左下顶点在网页中的纵坐标像素值(即, 上述 y2 ) 作为参数传递到移动可视区域方法 , 从而在水平方向上移动网页内容。 同样, 仅在水平方向上调整可视区域的位置, 而在垂直方向上不变, 所 述移动可视区域方法可以是如上所述的 scrollTo方法或 pinScrollTo方法。
根据本发明的实施例, 在执行可选的步骤 S1001 的情况下, 可以从 中获得网页内容左侧边框的参考像素值。 随后, 在网页内容左侧边框的 第一像素值为正数或零的情况下, 在步骤 S1004 中, 可以将该第一像素 值记录为该网页的网页内容左侧边框的参考像素值,以替换在步骤 S1001 中获得的参考像素值; 而在第一像素值为负数的情况下, 如果网页内容 左侧边框的第二像素值为正数或零, 则在步骤 S1006 中, 将该第二像素 值记录为该网页的网页内容左侧边框的参考像素值,以替换在步骤 S1001 中获得的参考像素值。 而如果上述条件均不满足, 即第一像素值为负数, 且第二像素值也为负数, 则可以将在步骤 S1001 中获得的参考像素值作 为网页内容左侧边框的参考像素值。
可选地, 根据本发明的实施例, 在所述第一像素值为负数的情况下, 在执行步骤 S1005 之前, 还需要判断缩放结束时的显示缩放比例是否大 于缩放前的显示缩放比例, 并且缩放前的显示缩放比例是否大于零, 只 有在这两次判断的结果均为 "是"的情况下,才执行后续的步骤 S1005等步 骤。 在屏幕宽度不发生变化的情况下, 一旦网页进行缩放, 网页宽度发 生变化, 网页显示控件的显示缩放比例也会发生变化。
400中的上述各步骤之后,就可以实现在网页缩放后与屏幕的左侧边框对 齐的效果, 如图 12所示, 其中示意性地示出了电子设备上网页缩放后对齐 的网页的视图。
本发明提供了一种电子设备上网页缩放和对齐的方法。根据本发明的 实施例, 可以构建定制缩放处理器对象和定制触摸事件方法, 检测对触摸电 子设备的操作为松开 n个触摸点中的 n-1个触摸点的操作, 判断电子设备的 操作***是否支持缩放处理器对象, 在支持的情况下, 在缩放完成方法中将 网页文字缩放比例设置为网页显示控件的显示缩放比例并且执行所述原有 缩放处理器对象的缩放完成方法, 在不支持的情况下, 将网页文字缩放比例 设置为网页显示控件的显示缩放比例, 从缩放管理器对象中反射设置并启用 缩放比例方法以进行调用, 并且执行被继承的网页显示控件的触摸事件方 法。从而,可以在不修改浏览器或其它页面显示程序的内核组件(如 Android ***的 WebKit组件) 的前提下, 实现页面缩放后重新排版、 使内容平铺至 整个屏幕的功能, 解决了因放大而无法显示部分内容的问题。 而且, 本发明 的实施例对于操作***不支持缩放处理器对象的电子设备, 同样能够实现上 述缩放后重新排版的功能, 这样就实现了对于几乎所有电子设备的支持。 同 时, 根据本发明的实施例, 可以充分利用新版本的操作***带来的新特性, 例如利用 Android 4.0及更新版本的硬件加速功能, 可以显著提高缩放速度, 还可以利用 Android 4.0及更新版本的高级网页浏览特征等新特性。另外, 由 于不需要修改浏览器或其它页面显示程序的内核组件, 节省了电子设备的存 储空间, 同时也避免了修改浏览器内核组件带来的风险。 另外, 根据本发明 的实施例, 可以构建定制网页渲染处理器对象, 并且在网页进行了缩放 的情况下, 获取网页内容左侧边框的像素值, 并且根据所述网页内容左 侧边框的像素值移动网页内容, 由此可以在网页缩放之后, 自动移动网 页内容, 使得网页内容的左侧边框与电子设备屏幕的左侧边框对齐, 使 得网页内容铺满屏幕, 从而充分利用屏幕上的显示空间, 达到理想的显 示效果。 根据本发明, 无需人工干预, 即可实现网页缩放后自动对齐, 避免了手动调整不够精确、 无法达到理想的显示效果的问题。 而且, 本 发明的实施例通过利用网页内容左侧边框的像素值、 第二像素值、 以及 参考像素值的操作, 可以最大程度地克服对于某些操作***网页内容左 侧边框的像素值小于零、 找不到网页内容对应区域的问题, 从而实现了 对于几乎所有操作***的支持。
与上述的方法 400相对应, 本发明还提供了一种电子设备上网页缩 放和对齐的装置 1200。 图 12示意性地图示了根据本发明的实施例的电子 设备上网页缩放和对齐的装置 1200的框图。
参见图 12,所述电子设备上网页缩放和对齐的装置 1200主要包括定 制缩放处理器对象构建模块 1202、 定制触摸事件方法构建模块 1204、 触 摸点检测模块 1206、缩放处理器支持判断模块 1208、缩放操作模块 1210、 触摸事件方法执行模块 1212。
根据本发明的实施例, 定制缩放处理器对象构建模块 1202配置为生 成继承缩放处理器类的对象, 将原有缩放处理器对象传递到其中, 以构 建定制缩放处理器对象, 并且利用所述定制缩放处理器对象替换原有缩 放处理器对象; 定制触摸事件方法构建模块 1204配置为继承网页显示控 件, 以构建定制触摸事件方法; 触摸点检测模块 1206配置为检测对触摸 电子设备的操作为松开 n个触摸点中的 n-1个触摸点的操作,其中 n为大 于或等于 2的整数; 缩放处理器支持判断模块 1208配置为判断电子设备 的操作***是否支持缩放处理器对象; 缩放操作模块 1210配置为在支持 的情况下, 利用所述缩放处理器对象进行操作, 包括缩放开始方法、 缩 放过程方法和缩放完成方法, 其中在缩放完成方法中, 将网页文字缩放 比例设置为网页显示控件的显示缩放比例, 并且执行所述原有缩放处理 器对象的缩放完成方法; 触摸事件方法执行模块 1212配置为在不支持的 情况下, 将网页文字缩放比例设置为网页显示控件的显示缩放比例, 从 缩放管理器对象中反射设置并启用缩放比例方法以进行调用 , 并且执行 被继承的网页显示控件的触摸事件方法。
首先, 定制缩放处理器对象构建模块 1202生成继承缩放处理器类的 对象, 将原有缩放处理器对象传递到其中, 以构建定制缩放处理器对象, 并且利用定制缩放处理器对象替换原有缩放处理器对象。 可选地, 根据本发明的实施例, 所述装置 1200还可以包括原有缩放 处理器对象获取模块 1201 , 其配置为获取原有缩放处理器对象。
根据本发明的实施例,在电子设备的操作***为 Android 2.3.x(例如, Android 2.3.7 )或更早版本的情况下, 原有缩放处理器对象获取模块 1201 可以从网页显示控件中反射并获取缩放检测器对象, 并且从所述缩放检 测器对象中反射并获取原有缩放处理器对象。 根据本发明的实施例, 所 述网页显示控件例如可以是 Android***的 WebView控件, 本发明的范 围不限于此, 网页显示控件可以是任何能够实现网页显示功能的控件, 例如 iOS***的 UlWebView控件等。 可选地, 对于 Android***, 所述 缩放处理器对象可以是 mListener 对象, 所述缩放检测器对象可以是 mScaleDetector对象, 其属于 ScaleGestureDetector类, 当然, 这些只是用 于例示本发明原理的例子 , 本发明的范围并不局限于此。
根据本发明的实施例 , 所述缩放处理器对象是在针对某一控件进行 缩放操作时调用的模块, Android***的缩放处理器对象 _ mListener对 象是缩放处理器类 一 OnScaleGestureListener类的对象, 其包括缩放开始 方法、 缩放过程方法、 以及缩放完成方法, 对于 mListener对象, 它们分 另 ll为 onScaleBegin方法、 onScale方法、 以及 onScaleEnd方法。 以用户在 电子设备的触摸屏幕上利用两个手指进行缩放的场景为例 , 当用户准备 双指缩放时, 也即当用户放下双指并开始拖动时, 调用缩放处理器对象 的缩放开始方法; 在用户缩放的过程中, 调用缩放处理器对象的缩放过 程方法; 在用户松开双指中的至少一指, 预示缩放完成时, 调用缩放处 理器对象的缩放完成方法。 每个支持缩放的控件都可以实现属于自己的 缩放处理器对象, WebView控件即是其一。
另外, 对于反射操作, 可以釆用 Java语言、 .Net语言等提供的反射 机制来进行操作, 将方法或对象从私有属性临时变为公有属性, 以供直 接使用和修改。 本领域技术人员能够理解, 同样可以釆用其它的程序设 计语言, 以相似的方式将方法或对象从私有属性临时变为公有属性, 以 达到反射操作的目的。
对于 Android***, 原有缩放处理器对象获取模块 1201可以通过获 取 Build. VERSION. SDK— INT对象来得到 Android***的版本号。
根据本发明的实施例 , 在电子设备的操作***为 Android 4.0或更新 版本的情况下, 原有缩放处理器对象获取模块 1201可以从网页显示控件 中反射并获取缩放管理器对象, 从所述缩放管理器对象中反射并获取缩 放检测器对象, 并且从所述缩放检测器对象中反射并获取原有缩放处理 器对象。 其中, 对于 Android ***, 所述缩放管理器对象可以是 mZoomManager对象, 该对象可以直接或间接地被 Web View控件调用 , 这样就可以将缩放操作从原本就很复杂的 Web View控件中抽离出来, 成 为较为独立的模块, 并被 Web View控件(甚至其它的控件)所用。 其中, 在 Android 2.3.x或更早版本中 , 这个 Java类就是 Web View控件类, 即 Web View类; 而在 Android 3.0及以后的版本, 该对象为 Web View控件 所直接使用的一个 Java类的对象, 即 ZoomManager类的对象。
根据本发明的实施例 , 定制缩放处理器对象构建模块 1202生成继承 缩放处理器类的对象, 将原有缩放处理器对象传递到其中, 以构建定制 缩放处理器对象, 并且利用定制缩放处理器对象替换原有缩放处理器对 象。
根据本发明的实施例 , 定制缩放处理器对象构建模块 1202可以生成 一个对象, 将其继承缩放处理器类, 在 Android***中, 缩放处理器类是 OnScaleGestureListener类, 这样, 该对象就可以实现其自己的缩放开始方 法、 缩放过程方法、 以及缩放完成方法, 然后, 定制缩放处理器对象构 建模块 1202需要将所述原有缩放处理器对象传递到其中, 以构建定制缩 放处理器对象, 这样, 在使用定制缩放处理器对象之后, 还可以调用系 统的原有缩放处理器对象。 定制缩放处理器对象构建模块 1202在利用所 述定制缩放处理器对象替换原有缩放处理器对象之后, 可以将变量"是否 支持缩放处理器对象 "的值设置为 true。
之后, 定制触摸事件方法构建模块 1204继承网页显示控件, 以构建 定制触摸事件方法。 根据本发明的实施例, 触摸事件方法例如可以是 Android***的 onTouchEvent方法和 /或 dispatchTouchEvent方法,用户对 某一控件的任何触摸操作, Android***都会触发该控件的触摸处理事件, onTouchEvent方法和 dispatchTouchEvent方法带一个参数,用来描述用户 当前触摸的情况, 在 Android***中是 MotionEvent对象, 其用来描述例 如用户当前触摸点的数量、 相应的坐标、 以及触摸的状态, 如"移动时"、 "按下时"、 "松开时"等。 根据本发明的实施例 , 定制触摸事件方法构建模块 1204可以生成一 个对象, 让其继承网页显示控件, 以构建其自己的定制触摸事件方法, 例如 onTouchEvent方法和 dispatchTouchEvent方法。
接下来, 触摸点检测模块 1206检测对触摸电子设备的操作为松开 n 个触摸点中的 n-1个触摸点的操作, 其中 n为大于或等于 2的整数。
以 n=2 的情况为例, 即, 假设用户用两根手指触摸电子设备的触摸 屏幕, 在其中一根手指松开时, 就会触发触摸处理事件方法。
根据本发明的实施例, 对于 Android***, 触摸点检测模块 1206可 以利用 ACTION— POINTER— UP对象或者 ACTION— POINTER— n— UP对象 检测是否为松开 n个触摸点中的 n-1个触摸点而触发触摸事件方法。
在触摸点检测模块 1206检测到对触摸电子设备的操作为松开 n个触 摸点中的 n-1个触摸点的操作时, 缩放处理器支持判断模块 1208判断电 子设备的操作***是否支持缩放处理器对象。
对于 Android***, 所述缩放处理器对象可以是 mListener对象, 该 对象是在针对某一控件进行缩放操作时调用的模块, Android ***的 mListener对象是缩放处理器类 一 OnScaleGestureListener类的对象,其包 括缩放开始方法、 缩放过程方法、 以及缩放完成方法, 对于 mListener对 象, 它 ^门分另 ll为 onScaleBegin方法、 onScale方法、 以及 onScaleEnd方法。 以用户在电子设备的触摸屏幕上利用两个手指进行缩放的场景为例, 当 用户准备双指缩放时, 也即当用户放下双指并开始拖动时, 调用缩放处 理器对象的缩放开始方法; 在用户缩放的过程中, 调用缩放处理器对象 的缩放过程方法; 在用户松开双指, 预示缩放完成时, 调用缩放处理器 对象的缩放完成方法。 每个支持缩放的控件都可以实现属于自己的缩放 处理器对象, Web View控件即是其一。
当缩放处理器支持判断模块 1208判断的结果为电子设备的操作*** 支持缩放处理器对象的情况下, 缩放操作模块 1210利用所述缩放处理器 对象进行操作, 包括缩放开始方法、 缩放过程方法和缩放完成方法, 其 中在缩放完成方法中, 将网页文字缩放比例设置为网页显示控件的显示 缩放比例 , 并且执行所述原有缩放处理器对象的缩放完成方法。
根据本发明的实施例 , 在缩放操作模块 1210将网页文字缩放比例设 置为网页显示控件的显示缩放比例的操作中, 在电子设备的操作***为 Android 2.3.x或更早版本的情况下,从所述网页显示控件中反射文字缩放 比例对象, 并且将网页显示控件的显示缩放比例的值赋予所述文字缩放 比例对象;而在电子设备的操作***为 Android 4.0或更新版本的情况下, 从所述缩放管理器对象中反射文字缩放比例对象, 并且将网页显示控件 的显示缩放比例的值赋予所述文字缩放比例对象。
根据本发明的实施例,在 Android***中, 所述文字缩放比例对象是 mTextWrapScale对象。 将网页显示控件的显示缩放比例赋予所述文字缩 放比例对象, 即, 使文字缩放比例对象的文字缩放比例的值等于网页显 示控件的显示缩放比例的值。 其中, 文字缩放比例是指"网页宽度" /"文本 宽度", 显示缩放比例是指"网页宽度" /"屏幕宽度"。 当文字缩放比例的值 等于显示缩放比例的值时, 文本宽度就等于网页宽度, 该文本便可以全 屏显示。 举例来说, 如果文字缩放比例为 2, 而 Web View控件的显示缩 放比例为 1 , 表示文字所占屏幕的比例为 1/2; 而如果 Web View控件的显 示比例和文字缩放比例均为 1 , 则表示文字所占屏幕比例为 1/1 , 也即全 屏显示。 另外, 即使用户在使用过程中通过触摸操作滑动屏幕将文字部 分移出屏幕(例如滑动到最右侧, 直到文字全部移出屏幕) , 由于文字 缩放比例没有变化, 故当用户通过触摸操作将文字滑动回来时, 一旦文 字的左边框与电子设备屏幕的左边框对齐时, 则文字一定是铺满全屏的。
根据本发明的实施例 ,所述缩放操作模块 1210还在缩放开始方法中 , 禁止缩放和拖动同时进行, 并且执行所述原有缩放处理器对象的缩放开 始方法。 其中, 在电子设备的操作***为 Android 2.3.x或更新版本的情 况下, 通过反射获取所述缩放管理器对象中的 mAllowPanAndScale对象, 并且将所述 mAllowPanAndScale 对 象 的 值设置 为 false 。 mAllowPanAndScale对象用来表示是否允许改变缩放的中心点 ,例如在双 指缩放的过程中拖动双指, 则可以移动整个内容, 将其值设为 false表示 禁止这一功能, 可以确保缩放过程中不会发生偏转。
根据本发明的实施例,所述缩放操作模块 1210还在缩放过程方法中, 执行所述原有缩放处理器对象的缩放过程方法。
根据本发明的实施例 ,所述缩放操作模块 1210还在缩放完成方法中 , 判断网页是否支持缩放功能。可以参照图 5来理解根据本发明实施例的装 置 1210的各模块的可选操作。 可选地, 所述缩放操作模块 1210的上述判断操作可以通过如下方式 实现: 可以获取 Web View控件设置模块( Android***中的 WebSettings 对象) 中的"是否支持缩放"变量, 该变量为布尔值, 若为 true, 则表示支 持, 若为 false, 则表示不支持缩放功能, 结束该判断操作; 从缩放管理 器对象中反射"当前网页的最小缩放比例 "对象和"当前网页的最大缩放比 例"对象以完成获取操作, 它们在 Android***中分别为 mMinZoomScale 对象和 mMaxZoomScale对象。 通常情况下, 在网页的源代码(对用户不 可见) 中, 会有一部分用来告知该网页的缩放比例范围, 该值通常情况 下不公开, 故需要通过反射来获取; 然后, 可以比较"当前网页的最小缩 放比例"对象的值与"当前网页的最大缩放比例"对象的值是否相等, 若相 等, 则直接返回 false, 表示该网页不支持缩放功能, 若不相等, 则返回 true, 表示"是否支持缩放功能"变量的值为 true, 该网页支持缩放功能。
在网页不支持缩放功能的情况下, 所述缩放操作模块 1210可以直接 执行原有缩放处理器对象的缩放完成方法。
在网页支持缩放功能的情况下,所述缩放操作模块 1210确定 Android ***的版本。
在 Android***为 4.0或更新版本的情况下,通过 Java提供的反射机 制获取缩放管理器对象中的 "缩放时是否有动画 "对象(在 Android***中 为 mPinchToZoomAnimating对象),该对象的值为布尔值,若其值为 false, 则所述缩放操作模块 1210可以直接执行原有缩放处理器对象的缩放完成 方法; 若其值为 true, 则所述缩放操作模块 1210执行上面描述的将网页 文字缩放比例设置为网页显示控件的显示缩放比例的操作, 并且执行所 述原有缩放处理器对象的缩放完成方法。
在 Android***为 2.3.x或更早版本的情况下, 从所述缩放操作模块 1210 缩放管理器对象中反射"是否预览缩放效果"对象以完成获取操作, 该对象在 Android ***中为 mPreviewZoomOnly对象。 若该对象的值为 true, 则所述缩放操作模块 1210执行上面描述的将网页文字缩放比例设 置为网页显示控件的显示缩放比例的操作, 并且执行所述原有缩放处理 器对象的缩放完成方法;若该对象的值为 false,则所述缩放操作模块 1210 直接执行原有缩放处理器对象的缩放完成方法。
当缩放处理器支持判断模块 1208判断的结果指示电子设备的操作系 统不支持缩放处理器对象的情况下, 触摸事件方法执行模块 1212将网页 文字缩放比例设置为网页显示控件的显示缩放比例, 从缩放管理器对象 中反射设置并启用缩放比例方法以进行调用 , 并且执行被继承的网页显 示控件的触摸事件方法。
类似地, 根据本发明的实施例, 在电子设备的操作***为 Android
2.3.x或更早版本的情况下,触摸事件方法执行模块 1212从所述网页显示 控件中反射文字缩放比例对象, 并且将网页显示控件的显示缩放比例的 值赋予所述文字缩放比例对象。
另外, 对于 Android***, 触摸事件方法执行模块 1212可以通过获 取 Build. VERSION. SDK— INT对象来得到 Android***的版本号。
在电子设备的操作***为 Android 4.0或更新版本的情况下, 触摸事 件方法执行模块 1212可以从所述缩放管理器对象中反射文字缩放比例对 象, 并且将网页显示控件的显示缩放比例的值赋予所述文字缩放比例对 象。
之后, 触摸事件方法执行模块 1212从缩放管理器对象中反射设置并 启用缩放比例方法以进行调用, 并且执行被继承的网页显示控件的触摸 事件方法。 另外, 在触摸点检测模块 1206未检测到对触摸电子设备的操 作为松开 n个触摸点中的 n-1个触摸点的操作的情况下,触摸事件方法执 行模块 1212可以直接执行被继承的网页显示控件的触摸事件方法。
根据本发明的实施例, 对于 Android***, 所述设置并启用缩放比例 方法可以是 setZoomScale方法或 setNewZoomScale方法, 而在触摸事件 方法执行模块 1212调用时传递的参数可以包括: 被设置为网页显示控件 的显示缩放比例的网页文字缩放比例、 允许文字排版(设置为 true ) 、 以 及允许强制文字排版(设置为 true ) 。
在调用了设置并启用缩放比例方法之后, 触摸事件方法执行模块
1212 就可以执行被继承的网页显示控件的触摸事件方法, 即原来的触摸 事件方法, 对于 Android***, 也就是调用其父类的 onTouchEvent方法 以及 dispatchTouchEvent方法。 这样, 就可以实现页面缩放后重新排版、 使内容平铺至整个屏幕的功能。
可选地, 根据本发明的实施例, 在缩放操作模块 1210或触摸事件方 法执行模块 1212将网页文字缩放比例设置为网页显示控件的显示缩放比 例之前, 还可以将是否启用宽屏浏览对象的值设置为 false。 对于 Android ***, 所述是否启用宽屏浏览对象是 setUseWide ViewPort对象, 其值存 在于 Web View控件设置模块( Android***中的 WebSettings对象) 中, 通过该操作, 可以避免在放大显示比例后用户通过触摸电子设备的屏幕 来移动网页。
可选地, 根据本发明的实施例, 在缩放操作模块 1210执行所述原有 缩放处理器对象的缩放完成方法或者触摸事件方法执行模块 1212执行被 继承的网页显示控件的触摸事件方法之前, 将是否启用宽屏浏览对象的 值设置为 true。 通过该操作, 可以在文字重新排版之后恢复通过触摸操作 移动网页的功能。
另外, 可选地, 在触摸点检测模块 1206执行检测操作之前, 触摸点 检测模块 1206还可以判断当前触摸点的数量是否大于 1、 以及判断网页 是否支持缩放功能, 在这两个判断中, 如果其中任一判断结果为否, 就 不做进一步的处理, 触摸事件方法执行模块 1212直接执行所述被继承的 网页显示控件的触摸事件方法。
可选地, 触摸点检测模块 1206判断网页是否支持缩放功能的操作可 以通过如下方式实现: 可以获取 Web View控件设置模块(Android*** 中的 WebSettings对象) 中的"是否支持缩放"变量, 该变量为布尔值, 若 为 true, 则表示支持, 若为 false, 则表示不支持缩放功能, 结束该判断; 从缩放管理器对象中反射"当前网页的最小缩放比例 "对象和"当前网页的 最大缩放比例 "对象以完成获取操作, 它们在 Android ***中分别为 mMinZoomScale对象和 mMaxZoomScale对象。通常情况下 , 在网页的源 代码(对用户不可见) 中, 会有一部分用来告知该网页的缩放比例范围, 该值通常情况下不公开, 故需要通过反射来获取; 然后, 可以比较"当前 网页的最小缩放比例 "对象的值与 "当前网页的最大缩放比例 "对象的值是 否相等, 若相等, 则直接返回 false, 表示该网页不支持缩放功能, 若不 相等, 则返回 true, 表示"是否支持缩放功能"变量的值为 true, 该网页支 持缩放功能。 如图 12 所示, 可选地, 根据本发明的实施例的装置 1200 还可以包括用于实现缩放后对齐功能的定制网页渲染处理器对象构建模 块 1214、 像素值获取模块 1216、 网页内容移动模块 1218。
根据本发明的实施例, 所述定制网页渲染处理器对象构建模块 1214 生成继承事件处理器类的对象, 将网页显示控件的原有网页渲染处理器 对象传递到其中, 以构建定制网页渲染处理器对象, 并且利用所述定制 网页渲染处理器对象替换网页显示控件的原有网页渲染处理器对象。
如图 12所示, 可选地, 才艮据本发明的实施例, 装置 1200还可以包 括原有网页渲染处理器对象获取模块, 其可以获取网页显示控件的原有 网页渲染处理器对象。
根据本发明的实施例, 对于 Android, 网页渲染处理器对象可以是 mPrivateHandler对象 ,本发明的范围不限于此,其还可以例如是 Windows ***中的 WindowMessages或其它***中的类似模块。对于 Android*** , 网页渲染处理器对象是一种从浏览器内核组件 WebKit向 WebView发送 消息的处理模块, 在 Android***中, 其是用 Handler的方式实现的, 起 到接收消息事件的作用。由于 WebView仅仅是为了显示和接收触摸事件, 而真正的操作均在 WebKit组件中进行, 因此在 WebKit组件处理完毕时, 会发送一条或者多条通知到 WebView控件, 以实现及时的刷新和处理。 网页渲染处理器对象仅有一个方法, 即接收消息方法, 对于 Android*** 为 handleMessage 方法, 由***调用, 发生条件为 WebView 收到来自 WebKit的消息。 根据本发明的实施例, 原有网页渲染处理器对象获取模 块可以从网页显示控件中反射原有网页渲染处理器对象, 以获取所述原 有网页渲染处理器对象。
接下来, 定制网页渲染处理器对象构建模块 1214生成继承事件处理 器类的对象, 将网页显示控件的原有网页渲染处理器对象传递到其中, 以构建定制网页渲染处理器对象, 并且利用所述定制网页渲染处理器对 象替换网页显示控件的原有网页渲染处理器对象。
根据本发明的实施例, 定制网页渲染处理器对象构建模块 1214可以 生成一个对象,使其继承事件处理器类的对象。例如,对于 Android***, 所述事件处理器类是 Handler类。 这样, 该对象就可以实现其自己的接收 消息方法 (对于 Android***是 handleMessage方法) , 然后 , 定制网页 渲染处理器对象构建模块 1214需要将所述原有网页渲染处理器对象传递 到其中, 以构建定制网页渲染处理器对象, 这样, 在使用定制网页渲染 处理器对象之后, 还可以调用***的原有网页渲染处理器对象。 最后, 定制网页渲染处理器对象构建模块 1214利用所述定制网页渲染处理器对 象替换所述网页显示控件的原有网页渲染处理器对象。
随后, 像素值获取模块 1216获取网页内容左侧边框的像素值, 网页 内容移动模块 1218根据所述网页内容左侧边框的像素值移动网页内容, 并且调用所述原有网页渲染处理器对象执行处理。
根据本发明的实施例, 所述缩放中点在网页中的横坐标像素值和在 网页中的纵坐标像素值可以分别是网页缩放操作结束时缩放中点在网页 中的横坐标像素值和在网页中的纵坐标像素值, 所述显示缩放比例可以 是缩放后显示缩放比例, 其中像素值获取模块将网页缩放操作结束时缩 放中点在网页中的横坐标像素值和在网页中的纵坐标像素值以及缩放后 显示缩放比例作为参数传递到获取网页内容左侧边框的像素值方法, 以 获取网页内容左侧边框的第一像素值。 根据本发明的实施例, 像素值获 取模块 1216可以在接收到刷新页面消息之后, 再获取该第一像素值。 根 据本发明的实施例, 像素值获取模块 1216要判断是否接收到刷新页面消 息。 一般情况下, 每发生一次网页的变化, 不管这种变化是来自于用户 的操作、 还是网页的动画、 或是网页的脚本, 只要网页在屏幕上有内容 改变, Web View控件就都会收到刷新页面消息。 通常每隔 2-3秒、 或者 用户对网页进行操作、 或者网页自身发生了变化, 刷新页面消息都会被 调用 1-10次不等。 在 Android***中, 该刷新页面消息的编号为 105 , 消 息名称为 "NEW— PICTURE— MSG— ID" , 该消息在其它***中的编号略有 不同。 根据本发明的实施例, 可以在接收到刷新页面消息之后、 下一次 再接收到刷新页面消息时开始执行根据本发明的对齐操作,在 Android系 统中, 也即使用 Handler的 post方法。 这是因为若在当次接收到刷新页面 消息就进行对齐操作, 可能会影响之前的网页缩放操作对页面刷新的效 率, 因此在下一次接收到刷新页面消息 (不超过 10ms ) 时再进行对齐操 作是比较理想的。
根据本发明的实施例 , 像素值获取模块 1216获取网页内容左侧边框 的像素值的过程包括以下操作。可以参照上述图 7来理解像素值获取模块 1216的操作。
首先, 像素值获取模块 1216从缩放管理器对象中反射缩放中点横坐 标像素值方法以及缩放中点纵坐标像素值方法, 以获取缩放中点的所在 视图的横纵坐标像素值。 根据本发明的实施例,对于 Android***, 所述缩放管理器对象可以 是 mZoomManager对象,该对象可以直接或间接地被 Web View控件调用 , 这样就可以将缩放操作从原本就很复杂的 Web View控件中抽离出来, 成 为较为独立的模块, 并被 Web View控件(甚至其它的控件)所用。 其中, 在 Android 2.3.x或更早版本中, 这个 Java类就是 Web View控件类, 即 Web View类; 而在 Android 3.0及以后的版本, 该对象为 Web View控件 所直接使用的一个 Java类的对象, 即 ZoomManager类的对象。 而对于 Android*** , 所述缩放中点横坐标像素值方法可以是 mZoomCenterX方 法, 所述缩放中点纵坐标像素值方法可以是 mZoomCenterY方法。
图 8 示意性地示出了根据本发明的实施例的缩放中点在网页和可视 区域中的相对位置的视图。 像素值获取模块 1216获取缩放中点的所在视 图的横纵坐标像素值, 如图 8所示, 像素值获取模块 1216所获取的是缩 放中点相对于显示区域左下角顶点 01的横纵坐标像素值(xl, yl ) 。
图 9示意性地示出了根据本发明的实施例的缩放操作开始时和缩放 操作结束时的缩放中点的视图。如图 9所示,缩放操作开始时缩放中点所 在位置的坐标为 (x0, y0 ) , 而缩放操作结束时缩放中点所在位置的坐标 为(xl, yl )。 在像素值获取模块 1216的操作中, 缩放中点可以为缩放操 作结束时的缩放中点, 即图 9中的 (xl, yl ) 。
接下来, 像素值获取模块 1216调用网页显示控件的获取可视区域横 坐标像素值方法和获取可视区域纵坐标像素值方法, 以获取可视区域左 下顶点在网页中的横纵坐标像素值。 根据本发明的实施例, 所述获取可 视区域横坐标像素值方法可以是 getScrollX方法,所述获取可视区域纵坐 标像素值方法可以是 getScrollY方法。如图 8所示,像素值获取模块 1216 要获取的是可视区域左下顶点 01相对于网页左下顶点 02的横纵坐标像 素值( x2, y2 ) 。
之后, 像素值获取模块 1216从网页显示控件中反射获取内容的横坐 标像素值方法和获取内容的纵坐标像素值方法, 并且将所述缩放中点的 所在视图的横纵坐标像素值与所述可视区域左下顶点在网页中的横纵坐 标像素值分别相加并作为参数传递到所述获取内容的横坐标像素值方法 和所述获取内容的纵坐标像素值方法, 以获取缩放中点在网页中的横坐 标像素值以及缩放中点在网页中的纵坐标像素值。 根据本发明的实施例, 对于 Android***, 所述获取内容的横坐标像 素值方法可以是 viewToContentX方法, 所述获取内容的纵坐标像素值方 法可以是 viewToContentY方法。像素值获取模块 1216将所述缩放中点的 所在视图的横纵坐标像素值与所述可视区域左下顶点在网页中的横纵坐 标像素值分别相加, 可以得到横纵坐标像素值(xl+x2, yl+y2 ) , 即, 缩 放中点相对于网页左下顶点 02的横纵坐标像素值, 也就是缩放中点在网 页中的横坐标像素值以及缩放中点在网页中的纵坐标像素值。 将(xl+x2, yl+y2 )作为参数传递到所述获取内容的横坐标像素值方法和所述获取内 容的纵坐标像素值方法的目的是去除一些边框、 滚动条等像素, 从而得 到更准确的位置表示。
然后, 像素值获取模块 1216调用网页显示控件的获取显示缩放比例 方法, 以获取显示缩放比例。 才艮据本发明的实施例, 对于 Android***, 所述获取显示缩放比例方法是 getScale方法。 像素值获取模块 1216所要 获取的可以是缩放结束后的显示缩放比例。
接着, 像素值获取模块 1216将所述缩放中点在网页中的横坐标像素 值、 所述缩放中点在网页中的纵坐标像素值、 所述显示缩放比例作为参 数传递到获取网页内容左侧边框的像素值方法, 以获取网页内容左侧边 框的像素值。 例如, 像素值获取模块 1216可以将网页缩放操作结束时缩 放中点在网页中的横坐标像素值和在网页中的纵坐标像素值以及缩放后 显示缩放比例, 作为参数传递到获取网页内容左侧边框的像素值方法, 以获取网页内容左侧边框的第一像素值。 根据本发明的实施例, 对于 Android ***, 所述获取网 页 内容左侧边框的像素值方法是 getBlockLeftEdge方法或 nativeGetBlockLeftEdge方法。对于 Android 4.1.x 版本及之后的版本,可以使用 getBlockLeftEdge方法,而对于 Android 4.1.x 之前的版本, 可以使用 nativeGetBlockLeftEdge方法。 对于 Android***, 可以通过获取 Build.VERSION.SDK— INT对象来得到 Android***的版本 像素值获取模块 1216可以将上述横纵坐标像素值(xl+x2, yl+y2 ) 以及缩放后显示缩放比例作为参数传递到 getBlockLeftEdge 方法或 nativeGetBlockLeftEdge 方法, 在所返回的网页内容左侧边框的像素值为 负数的情况下, 表明没有获得网页内容左侧边框的像素值, 无法执行对 齐操作, 此时可以丟弃该像素值。 而在所返回的网页内容左侧边框的像 素值为正数或零的情况下, 表明已经获得了网页内容左侧边框的像素值。
接下来, 网页内容移动模块 1218根据所述网页内容左侧边框的像素 值移动网页内容。 根据本发明的实施例, 可以将所保存的网页内容左侧 边框的像素值(例如上述第一像素值) 、 所述显示缩放比例 (例如上述 缩放后显示缩放比例)、可视区域左下顶点在网页中的纵坐标像素值(即, 上述 y2 )作为参数传递到移动可视区域方法, 从而在水平方向上移动网 页内容。 即, 仅在水平方向上调整可视区域的位置, 而在垂直方向上不 变。 对于 Android ***, 所述移动可视区域方法是 scrollTo 方法或 pinScrollTo方法。
根据本发明的实施例 , 像素值获取模块 1216可以将所保存的网页内 容左侧边框的像素值减去预先定义的像素值以获得网页内容左侧边框的 修正像素值, 并且网页内容移动模块 1218将所述修正像素值、 所述缩放 后显示缩放比例、 以及可视区域左下顶点在网页中的纵坐标像素值作为 参数传递到移动可视区域方法, 从而在水平方向上移动网页内容。 将所 保存的网页内容左侧边框的像素值减去预先定义的像素值的目的是能够 确保正常对齐, 该预先定义的像素值可以根据实际需要进行选取, 例如 5 像素, 即将所保存的网页内容左侧边框的像素值减去 5像素, 以获得网页 内容左侧边框的修正像素值。 根据本发明的实施例, 当所述修正像素值 小于零时, 令所述修正像素值为零。 然后, 网页内容移动模块 1218就可 以将所述修正像素值、 所述缩放后显示缩放比例、 以及可视区域左下顶 点在网页中的纵坐标像素值(即, 上述 y2 )作为参数传递到移动可视区 域方法, 从而在水平方向上移动网页内容。
再次重申, 在以上操作中所使用的缩放中点可以是缩放操作结束时 的缩放中点。
接着, 网页内容移动模块 1218调用所述原有网页渲染处理器对象执 行处理。
下面, 描述根据本发明的实施例的一些可选的操作, 可以参照图 10 来理解这些操作。
可选地, 根据本发明的实施例, 在所述触摸点检测模块 1206检测到 对触摸电子设备的操作为松开 n个触摸点中的 n-1个触摸点的操作的情况 下、在所述缩放操作模块 1210或者所述触摸事件方法 1212执行模块将网 页文字缩放比例设置为网页显示控件的显示缩放比例的操作之前, 还可 以获取该网页的网页内容左侧边框的参考像素值; 接着, 所述像素值获 取模块 1216判断所述参考像素值是否为正数或零。 如果其为正数或零, 则使该参考像素值不变。 即, 如果所述参考像素值为正数或零, 则表明 所述像素值获取模块 1216已经成功获取了网页内容左侧边框的参考像素 值。 根据本发明的实施例, 所述网页的网页内容左侧边框的参考像素值 的默认值为一负的预定值, 例如 若所获取的参考像素值为负数, 则 表明没有成功地获取网页内容左侧边框的像素值。
如果所述参考像素值为负数, 则所述像素值获取模块 1216基于缩放 操作开始时缩放中点的横坐标像素值和纵坐标像素值(例如,如图 9所示 的 (x0, y0 ) ) 以及缩放前显示缩放比例, 获取网页内容左侧边框的像素 值, 并且在该获取的像素值为正数或零的情况下将其作为网页内容左侧 边框的参考像素值。 其中, 根据本发明的实施例, 像素值获取模块 1216 可以利用与上面描述的操作相同的方式来获取缩放操作开始时缩放中点 的横坐标像素值和纵坐标像素值以及缩放前显示缩放比例, 并且可以利 用与上面描述的操作相同的方式来获取参考像素值, 即, 所述像素值获 取模块 1216可以将缩放操作开始时缩放中点的横坐标像素值和纵坐标像 素值以及缩放前显示缩放比例作为参数传递到获取网页内容左侧边框的 像素值方法, 以获取网页内容左侧边框的像素值。 根据本发明的实施例, 对于 Android*** , 根据本发明的实施例 , 对于 Android*** , 所述获取 网页内容左侧边框的像素值方法可以是如上所述的 getBlockLeftEdge 方 法或 nativeGetBlockLeftEdge方法。
可选地, 根据本发明的实施例, 在在所述像素值获取模块 1216获取 网页内容左侧边框的第一像素值之后, 在所述网页内容左侧边框的第一 像素值为正数或零的情况下, 所述网页内容移动模块 1218根据该第一像 素值移动网页内容。 然后, 所述网页内容移动模块 1218将该第一像素值 记录为该网页的网页内容左侧边框的参考像素值。
根据本发明的实施例 , 所述网页内容移动模块 1218可以将所述网页 内容左侧边框的像素值(例如, 上述第一像素值) 、 所述显示缩放比例 (例如, 缩放后显示缩放比例) 、 可视区域左下顶点在网页中的纵坐标 像素值(即, 上述 y2 )作为参数传递到移动可视区域方法, 从而在水平 方向上移动网页内容。 即, 仅在水平方向上调整可视区域的位置, 而在 垂直方向上不变。 对于 Android***, 所述移动可视区域方法是 scrollTo 方法或 pinScrollTo方法。
而在所述第一像素值为负数的情况下, 所述像素值获取模块 1216基 于缩放操作开始时缩放中点的横坐标像素值和纵坐标像素值 (例如, 如 图 8所示的 (x0, y0 ) ) 以及缩放前显示缩放比例, 获取网页内容左侧边 框的第二像素值。 其中, 根据本发明的实施例, 像素值获取模块 1216可 以利用与上面描述的操作相同的方式来获取缩放操作开始时缩放中点的 横坐标像素值和纵坐标像素值以及缩放前显示缩放比例 , 并且可以利用 与上面描述的操作相同的方式来获取第二像素值。
然后, 在所述网页内容左侧边框的第二像素值为正数或零的情况下, 所述网页内容移动模块 1218根据所述第二像素值移动网页内容, 并将该 第二像素值记录为该网页的网页内容左侧边框的参考像素值。 根据本发 明的实施例, 所述网页内容移动模块 1218可以将所述缩放操作开始时缩 放中点的横坐标像素值和纵坐标像素值以及缩放前显示缩放比例传递到 获取网页内容左侧边框的像素值方法, 以获取网页内容左侧边框的第二 像素值。 对于 Android***, 所述获取网页内容左侧边框的像素值方法可 以是如上所述的 getBlockLeftEdge方法或 nativeGetBlockLeftEdge方法。 根据本发明的实施例 , 所述网页内容移动模块 1218可以将所述第二像素 值、 缩放后显示缩放比例、 可视区域左下顶点在网页中的纵坐标像素值 (即, 上述 y2 )作为参数传递到移动可视区域方法, 从而在水平方向上 移动网页内容。 即, 仅在水平方向上调整可视区域的位置, 而在垂直方 向上不变。 对于 Android***, 所述移动可视区域方法可以是如上所述的 scrollTo方法或 pinScrollTo方法。
而当所述第二像素值为负数时, 所述网页内容移动模块 1218可以根 据所述参考像素值移动网页内容。 其中, 所述网页内容移动模块 1218可 以将所述参考像素值、 缩放后显示缩放比例、 可视区域左下顶点在网页 中的纵坐标像素值(即, 上述 y2 )作为参数传递到移动可视区域方法, 从而在水平方向上移动网页内容。 同样, 仅在水平方向上调整可视区域 的位置, 而在垂直方向上不变, 所述移动可视区域方法可以是如上所述 的 scrollTo方法或 pinScrollTo方法。
根据本发明的实施例 , 在所述像素值获取模块 1216执行上述涉及参 考像素值的操作的情况下, 在网页内容左侧边框的第一像素值为正数或 零时, 网页内容移动模块 1218可以将该第一像素值记录为该网页的网页 内容左侧边框的参考像素值, 以替换在之前的操作中获得的参考像素值; 而在第一像素值为负数的情况下, 如果网页内容左侧边框的第二像素值 为正数或零, 则网页内容移动模块 1218将该第二像素值记录为该网页的 网页内容左侧边框的参考像素值, 以替换在之前的操作中获得的参考像 素值。 而如果上述条件均不满足, 即第一像素值为负数, 且第二像素值 也为负数, 则可以将在之前的操作中获得的参考像素值作为网页内容左 侧边框的参考像素值。
可选地, 根据本发明的实施例, 在所述第一像素值为负数的情况下, 在所述像素值获取模块 1216获取第二像素值之前, 还需要判断缩放结束 时的显示缩放比例是否大于缩放前的显示缩放比例 , 以及缩放前的显示 缩放比例是否大于零, 只有在这两次判断的结果均为"是"的情况下, 才执 行获取第二像素值等后续操作。 在屏幕宽度不发生变化的情况下, 一旦 网页进行缩放, 网页宽度发生变化, 网页显示控件的显示缩放比例也会 发生变化。
在根据本发明的实施例的电子设备上网页缩放和对齐的装置 1200执 行了上述各操作之后, 就可以实现在网页缩放后与屏幕的左侧边框对齐 的效果, 如图 1 1所示, 其中示意性地示出了电子设备上网页缩放后对齐的 网页的视图。
由于上述各设备(装置) 实施例与前述各方法实施例相对应, 因此 不再对各装置实施例进行详细描述。
本发明的各个部件实施例可以以硬件实现, 或者以在一个或者多 个处理器上运行的软件模块实现, 或者以它们的组合实现。 本领域的
一些或者全部部件的一些或者全部功能。 本发明还可以实现为用于执 行这里所描述的方法的一部分或者全部的设备或者装置程序 (例如, 计算机程序和计算机程序产品) 。 这样的实现本发明的程序可以存储 在计算机可读介质上, 或者可以具有一个或者多个信号的形式。 这样 的信号可以从因特网网站上下载得到, 或者在载体信号上提供, 或者 以任何其他形式提供。 服务器, 例如应用服务器。 该服务器传统上包括处理器 1310和以存储 器 1320形式的计算机程序产品或者计算机可读介质。 存储器 1320可 以是诸如闪存、 EEPROM (电可擦除可编程只读存储器) 、 EPROM、 硬盘或者 ROM之类的电子存储器。 存储器 1320具有用于执行上述方 法中的任何方法步骤的程序代码 1331的存储空间 1330。例如, 用于程 序代码的存储空间 1330可以包括分别用于实现上面的方法中的各种步 骤的各个程序代码 1331。 这些程序代码可以从一个或者多个计算机程 序产品中读出或者写入到这一个或者多个计算机程序产品中。 这些计 算机程序产品包括诸如硬盘, 紧致盘(CD ) 、 存储卡或者软盘之类的 程序代码载体。这样的计算机程序产品通常为如参考图 14所述的便携 式或者固定存储单元。该存储单元可以具有与图 13的服务器中的存储 器 1320类似布置的存储段、 存储空间等。 程序代码可以例如以适当形 式进行压缩。 通常, 存储单元包括计算机可读代码 133 Γ , 即可以由例 如诸如 1310之类的处理器读取的代码, 这些代码当由服务器运行时, 导致该服务器执行上面所描述的方法中的各个步骤。
本文中所称的 "一个实施例"、 "实施例"或者"一个或者多个实施例" 意味着, 结合实施例描述的特定特征、 结构或者特性包括在本发明的 至少一个实施例中。 此外, 请注意, 这里"在一个实施例中"的词语例 子不一定全指同一个实施例。
在此处所提供的说明书中, 说明了大量具体细节。 然而, 能够理 解, 本发明的实施例可以在没有这些具体细节的情况下被实践。 在一 些实例中, 并未详细示出公知的方法、 结构和技术, 以便不模糊对本 说明书的理解。
应该注意的是上述实施例对本发明进行说明而不是对本发明进行 限制, 并且本领域技术人员在不脱离所附权利要求的范围的情况下可 设计出替换实施例。 在权利要求中, 不应将位于括号之间的任何参考 符号构造成对权利要求的限制。 单词"包含"不排除存在未列在权利要 求中的元件或步骤。 位于元件之前的单词 "一"或"一个"不排除存在多 个这样的元件。 本发明可以借助于包括有若干不同元件的硬件以及借 助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中, 这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、 第二、 以及第三等的使用不表示任何顺序。 可将这些单词解释为名称。
此外, 还应当注意, 本说明书中使用的语言主要是为了可读性和 教导的目的而选择的, 而不是为了解释或者限定本发明的主题而选择 的。 因此, 在不偏离所附权利要求书的范围和精神的情况下, 对于本 技术领域的普通技术人员来说许多修改和变更都是显而易见的。 对于 本发明的范围, 对本发明所做的公开是说明性的, 而非限制性的, 本 发明的范围由所附权利要求书限定。

Claims

1. 一种电子设备上网页缩放的方法, 包括以下步骤:
生成继承缩放处理器类的对象, 将原有缩放处理器对象传递到其中, 以构建定制缩放处理器对象,并且利用所述定制缩放处理器对象替换原有 缩放处理器对象;
继承网页显示控件, 以构建定制触摸事件方法;
检测对触摸电子设备的操作为松开 n个触摸点中的 n-1个触摸点的操 作, 其中 n为大于或等于 2的整数;
判断电子设备的操作***是否支持缩放处理器对象;
在支持的情况下,所述缩放处理器对象进行操作,包括缩放开始方法、 缩放过程方法和缩放完成方法, 其中在缩放完成方法中, 将网页文字缩放 比例设置为网页显示控件的显示缩放比例 ,并且执行所述原有缩放处理器 对象的缩放完成方法;
在不支持的情况下,将网页文字缩放比例设置为网页显示控件的显示 缩放比例 , 从缩放管理器对象中反射设置并启用缩放比例方法以进行调 用 , 并且执行被继承的网页显示控件的触摸事件方法。
2. 如权利要求 1 所述的方法, 还包括步骤: 在所述生成继承缩放处 理器类的对象并且将原有缩放处理器对象传递到其中以构建定制缩放处 理器对象的步骤之前, 获取原有缩放处理器对象, 包括:
在电子设备的操作***为 Android 2.3.x或更早版本的情况下, 从网 页显示控件中反射并获取缩放检测器对象,并且从所述缩放检测器对象中 反射并获取原有缩放处理器对象; 或者
在电子设备的操作***为 Android 4.0或更新版本的情况下, 从网页 显示控件中反射并获取缩放管理器对象,从所述缩放管理器对象中反射并 获取缩放检测器对象 ,并且从所述缩放检测器对象中反射并获取原有缩放 处理器对象。
3. 如权利要求 1 所述的方法, 其中所述将网页文字缩放比例设置为 网页显示控件的显示缩放比例的步骤包括:
在电子设备的操作***为 Android 2.3.x或更早版本的情况下, 从所 述网页显示控件中反射文字缩放比例对象,并且将网页显示控件的显示缩 放比例的值赋予所述文字缩放比例对象; 或者
在电子设备的操作***为 Android 4.0或更新版本的情况下, 从所述 缩放管理器对象中反射文字缩放比例对象,并且将网页显示控件的显示缩 放比例的值赋予所述文字缩放比例对象。
4. 如权利要求 1 所述的方法, 其中在所述从缩放管理器对象中反射 设置并启用缩放比例方法以进行调用的步骤中 ,调用时传递的参数包括被 设置为网页显示控件的显示缩放比例的网页文字缩放比例、 允许文字排 版、 以及允许强制文字排版。
5. 如权利要求 1 所述的方法, 还包括步骤: 在缩放过程方法中, 执 行所述原有缩放处理器对象的缩放过程方法。
6. 如权利要求 1 所述的方法, 还包括步骤: 在缩放开始方法中, 禁 止缩放和拖动同时进行,并且执行所述原有缩放处理器对象的缩放开始方 法。
7. 如权利要求 1 所述的方法, 其中在所述检测对触摸电子设备的操 作为松开 n 个触摸点中的 n-1 个触摸点的操作的步骤中, 利用 ACTION POINTER UP对象或者 ACTION— POINTER— n— UP对象检测是 否为松开 n个触摸点中的 n-1个触摸点而触发触摸事件方法。
8. 如权利要求 1至 7中的任一项所述的方法, 还包括步骤: 在所述将网页文字缩放比例设置为网页显示控件的显示缩放比例的 步骤之前, 将是否启用宽屏浏览对象的值设置为 false; 并且
在所述从缩放管理器对象中反射设置并启用缩放比例方法以进行调 用的步骤之后, 将是否启用宽屏浏览对象的值设置为 true。
9. 如权利要求 1至 8中的任一项所述的方法, 还包括步骤: 获取网页显示控件的原有网页渲染处理器对象,其中从网页显示控件 中反射原有网页渲染处理器对象, 以获取所述原有网页渲染处理器对象; 生成继承事件处理器类的对象,将所述原有网页渲染处理器对象传递到其 中, 以构建定制网页渲染处理器对象, 并且利用所述定制网页渲染处理器 对象替换网页显示控件的原有网页渲染处理器对象;
获取网页内容左侧边框的像素值,根据所述网页内容左侧边框的像素 值移动网页内容, 并且调用所述原有网页渲染处理器对象执行处理。
10. 如权利要求 9所述的方法, 其中所述获取网页内容左侧边框的像 素值的步骤包括:
从缩放管理器对象中反射缩放中点横坐标像素值方法以及缩放中点 纵坐标像素值方法, 以获取缩放中点的所在视图的横纵坐标像素值;
调用网页显示控件的获取可视区域横坐标像素值方法和获取可视区 域纵坐标像素值方法,以获取可视区域左下顶点在网页中的横纵坐标像素 值;
从网页显示控件中反射获取内容的横坐标像素值方法和获取内容的 纵坐标像素值方法,并且将所述缩放中点的所在视图的横纵坐标像素值与 所述可视区域左下顶点在网页中的横纵坐标像素值分别相加并作为参数 传递到所述获取内容的横坐标像素值方法和所述获取内容的纵坐标像素 值方法,以获取缩放中点在网页中的横坐标像素值以及缩放中点在网页中 的纵坐标像素值;
调用网页显示控件的获取显示缩放比例方法, 以获取显示缩放比例; 以及
将所述缩放中点在网页中的横坐标像素值、所述缩放中点在网页中的 纵坐标像素值、所述显示缩放比例作为参数传递到获取网页内容左侧边框 的像素值方法, 以获取网页内容左侧边框的像素值。
11. 如权利要求 10所述的方法, 其中所述缩放中点在网页中的横坐 标像素值和在网页中的纵坐标像素值分别是网页缩放操作结束时缩放中 点在网页中的横坐标像素值和在网页中的纵坐标像素值,所述显示缩放比 例是缩放后显示缩放比例 ,其中将网页缩放操作结束时缩放中点在网页中 的横坐标像素值和在网页中的纵坐标像素值以及缩放后显示缩放比例作 为参数传递到获取网页内容左侧边框的像素值方法,以获取网页内容左侧 边框的第一像素值,
其中在所述根据该网页内容左侧边框的像素值移动网页内容的步骤 中, 在所述网页内容左侧边框的第一像素值为正数或零的情况下, 根据该 第一像素值移动网页内容,并且将该第一像素值记录为该网页的网页内容 左侧边框的参考像素值。
12. 如权利要求 10所述的方法, 其中在所述根据所述网页内容左侧 边框的像素值移动网页内容的步骤中 ,将所保存的网页内容左侧边框的像 素值、 所述显示缩放比例、 可视区域左下顶点在网页中的纵坐标像素值作 为参数传递到移动可视区域方法 , 从而在水平方向上移动网页内容。
13. 如权利要求 11 所述的方法, 还包括步骤: 在所述网页内容左侧 边框的第一像素值为负数的情况下,基于缩放操作开始时缩放中点的横坐 标像素值和纵坐标像素值以及缩放前显示缩放比例,获取网页内容左侧边 框的第二像素值 ,在所述网页内容左侧边框的第二像素值为正数或零的情 况下, 根据所述第二像素值移动网页内容, 并将该第二像素值记录为该网 页的网页内容左侧边框的参考像素值。
14. 如权利要求 13所述的方法, 其中所述网页的网页内容左侧边框 的参考像素值的默认值为一负的预定值,在检测到对触摸电子设备的操作 为松开 n个触摸点中的 n-1个触摸点的操作的情况下、在所述将网页文字 缩放比例设置为网页显示控件的显示缩放比例的步骤之前,所述方法还包 括:
获取该网页的网页内容左侧边框的参考像素值;
判断所述参考像素值是否为正数或零,如果其为正数或零, 则该参考 像素值不变;
如果所述参考像素值为负数,则根据缩放操作开始时缩放中点的横坐 标像素值和纵坐标像素值以及缩放前显示缩放比例 ,获取网页内容左侧边 框的像素值,并且在该获取的像素值为正数或零的情况下将其作为网页内 容左侧边框的参考像素值。
15. 如权利要求 14所述的方法, 其中当所述第二像素值为负数时, 根据所述参考像素值移动网页内容。
16. 如权利要求 1至 7中的任一项所述的方法, 其中所述网页显示控 件是 Android ***的 Web View 控件, 所述缩放管理器对象是 mZoomManager对象, 所述缩放处理器对象是 mListener对象, 所述缩放 处理器类是 OnScaleGestureListener 类, 所述文字缩放比例对象是 mTextWmpScale对象, 所述缩放检测器对象是 mScaleDetector对象, 所述 缩放开始方法、 缩放过程方法、 缩放完成方法分别为 mListener对象的 onScaleBegin方法、 onScale方法、 onScaleEnd方法, 所述触摸事件方法 包括 onTouchEvent方法以及 dispatchTouchEvent方法,所述设置并启用缩 放比例方法是 setZoomScale方法或 setNewZoomScale方法, 所述事件处 理器类是 Handler类, 所述网页渲染处理器对象是 mPrivateHandler对象, 所述接收消息方法是 handleMessage方法, 所述缩放中点横坐标像素值方 法是 mZoomCenterX 方法, 所述缩放中点纵坐标像素值方法是 mZoomCenterY方法, 所述获取可视区域横坐标像素值方法是 getScrollX 方法, 所述获取可视区域纵坐标像素值方法是 getScrollY方法, 所述获取 内容的横坐标像素值方法是 viewToContentX方法, 所述获取内容的纵坐 标像素值方法是 viewToContentY 方法, 所述获取显示缩放比例方法是 getScale 方法, 所述获取网 页 内容左侧边框的像素值方法是 getBlockLeftEdge方法或 nativeGetBlockLeftEdge方法,所述移动可视区域 方法是 scrollTo方法或 pinScrollTo方法。
17. 一种电子设备上网页缩放的装置, 包括:
定制缩放处理器对象构建模块, 配置为生成继承缩放处理器类的对 象, 将原有缩放处理器对象传递到其中, 以构建定制缩放处理器对象, 并 且利用所述定制缩放处理器对象替换原有缩放处理器对象;
定制触摸事件方法构建模块, 配置为继承网页显示控件, 以构建定制 触摸事件方法;
触摸点检测模块,配置为检测对触摸电子设备的操作为松开 n个触摸 点中的 n-1个触摸点的操作, 其中 n为大于或等于 2的整数;
缩放处理器支持判断模块,配置为判断电子设备的操作***是否支持 缩放处理器对象;
缩放操作模块, 配置为在支持的情况下, 利用所述缩放处理器对象进 行操作, 包括缩放开始方法、 缩放过程方法和缩放完成方法, 其中在缩放 完成方法中, 将网页文字缩放比例设置为网页显示控件的显示缩放比例, 并且执行所述原有缩放处理器对象的缩放完成方法;
触摸事件方法执行模块, 配置为在不支持的情况下,将网页文字缩放 比例设置为网页显示控件的显示缩放比例,从缩放管理器对象中反射设置 并启用缩放比例方法以进行调用 ,并且执行被继承的网页显示控件的触摸 事件方法。
18. 如权利要求 17所述的装置, 还包括原有缩放处理器对象获取模 块,配置为在所述定制缩放处理器对象构建模块生成继承缩放处理器类的 对象并且将原有缩放处理器对象传递到其中以构建定制缩放处理器对象 的步骤之前, 获取原有缩放处理器对象, 其中
在电子设备的操作***为 Android 2.3.x或更早版本的情况下, 所述 原有缩放处理器对象获取模块从网页显示控件中反射并获取缩放检测器 对象, 并且从所述缩放检测器对象中反射并获取原有缩放处理器对象; 或 者
在电子设备的操作***为 Android 4.0或更新版本的情况下, 所述原 有缩放处理器对象获取模块从网页显示控件中反射并获取缩放管理器对 象,从所述缩放管理器对象中反射并获取缩放检测器对象, 并且从所述缩 放检测器对象中反射并获取原有缩放处理器对象。
19. 如权利要求 17所述的装置, 其中所述缩放操作模块或者所述触 摸事件方法执行模块在将网页文字缩放比例设置为网页显示控件的显示 缩放比例的过程中 , 执行以下操作:
在电子设备的操作***为 Android 2.3.x或更早版本的情况下, 从所 述网页显示控件中反射文字缩放比例对象,并且将网页显示控件的显示缩 放比例的值赋予所述文字缩放比例对象; 或者
在电子设备的操作***为 Android 4.0或更新版本的情况下, 从所述 缩放管理器对象中反射文字缩放比例对象,并且将网页显示控件的显示缩 放比例的值赋予所述文字缩放比例对象。
20. 如权利要求 17所述的装置, 其中在所述缩放操作模块从缩放管 理器对象中反射设置并启用缩放比例方法以进行调用的过程中,调用时传 递的参数包括被设置为网页显示控件的显示缩放比例的网页文字缩放比 例、 允许文字排版、 以及允许强制文字排版。
21. 如权利要求 17所述的装置, 其中所述缩放操作模块配置为在缩 放过程方法中 , 执行所述原有缩放处理器对象的缩放过程方法。
22. 如权利要求 17所述的装置, 其中所述缩放操作模块配置为在缩 放开始方法中, 禁止缩放和拖动同时进行, 并且执行所述原有缩放处理器 对象的缩放开始方法。
23. 如权利要求 17所述的装置, 其中所述触摸点检测模块配置为利 用 ACTION— POINTER— UP对象或者 ACTION— POINTER— n— UP对象检测 是否为松开 n个触摸点中的 n-1个触摸点而触发触摸事件方法。
24. 如权利要求 17至 22中的任一项所述的装置, 还包括: 启用宽屏浏览对象设置模块,配置为在所述网页文字缩放比例设置模 块将网页文字缩放比例设置为网页显示控件的显示缩放比例之前,将是否 启用宽屏浏览对象的值设置为 false, 并且配置为在所述缩放比例调用模 块从缩放管理器对象中反射设置并启用缩放比例方法以进行调用之后 ,将 是否启用宽屏浏览对象的值设置为 true。
25. 如权利要求 17至 22中的任一项所述的装置, 还包括:
定制网页渲染处理器对象构建模块,配置为获取网页显示控件的原有 网页渲染处理器对象,其中从网页显示控件中反射原有网页渲染处理器对 象,以获取所述原有网页渲染处理器对象;生成继承事件处理器类的对象, 将所述原有网页渲染处理器对象传递到其中,以构建定制网页渲染处理器 对象,并且利用所述定制网页渲染处理器对象替换网页显示控件的原有网 页渲染处理器对象;
像素值获取模块, 配置为获取网页内容左侧边框的像素值; 以及 网页内容移动模块,配置为根据所述网页内容左侧边框的像素值移动 网页内容, 并且调用所述原有网页渲染处理器对象执行处理。
26. 如权利要求 25所述的装置, 其中所述像素值获取模块配置为: 从缩放管理器对象中反射缩放中点横坐标像素值方法以及缩放中点 纵坐标像素值方法, 以获取缩放中点的所在视图的横纵坐标像素值;
调用网页显示控件的获取可视区域横坐标像素值方法和获取可视区 域纵坐标像素值方法,以获取可视区域左下顶点在网页中的横纵坐标像素 值;
从网页显示控件中反射获取内容的横坐标像素值方法和获取内容的 纵坐标像素值方法,并且将所述缩放中点的所在视图的横纵坐标像素值与 所述可视区域左下顶点在网页中的横纵坐标像素值分别相加并作为参数 传递到所述获取内容的横坐标像素值方法和所述获取内容的纵坐标像素 值方法,以获取缩放中点在网页中的横坐标像素值以及缩放中点在网页中 的纵坐标像素值;
调用网页显示控件的获取显示缩放比例方法, 以获取显示缩放比例; 以及
将所述缩放中点在网页中的横坐标像素值、所述缩放中点在网页中的 纵坐标像素值、所述显示缩放比例作为参数传递到获取网页内容左侧边框 的像素值方法, 以获取网页内容左侧边框的像素值。
27 如权利要求 26所述的装置,其中所述缩放中点在网页中的横坐标 像素值和在网页中的纵坐标像素值分别是网页缩放操作结束时缩放中点 在网页中的横坐标像素值和在网页中的纵坐标像素值,所述显示缩放比例 是缩放后显示缩放比例,其中所述像素值获取模块将网页缩放操作结束时 缩放中点在网页中的横坐标像素值和在网页中的纵坐标像素值以及缩放 后显示缩放比例作为参数传递到获取网页内容左侧边框的像素值方法,以 获取网页内容左侧边框的第一像素值,
其中在所述网页内容左侧边框的第一像素值为正数或零的情况下 ,网 页内容移动模块根据该第一像素值移动网页内容,并且将该第一像素值记 录为该网页的网页内容左侧边框的参考像素值。
28. 如权利要求 26所述的装置, 其中在所述网页内容移动模块将所 保存的网页内容左侧边框的像素值、 所述显示缩放比例、可视区域左下顶 点在网页中的纵坐标像素值作为参数传递到移动可视区域方法,从而在水 平方向上移动网页内容。
29. 如权利要求 27所述的装置, 其中在所述网页内容左侧边框的第 一像素值为负数的情况下,所述像素值获取模块基于缩放操作开始时缩放 中点的横坐标像素值和纵坐标像素值以及缩放前显示缩放比例,获取网页 内容左侧边框的第二像素值 ,
在所述网页内容左侧边框的第二像素值为正数或零的情况下,所述网 页内容移动模块根据所述第二像素值移动网页内容,并将该第二像素值记 录为该网页的网页内容左侧边框的参考像素值。
30. 如权利要求 29所述的装置, 其中所述网页的网页内容左侧边框 的参考像素值的默认值为一负的预定值,在所述触摸点检测模块检测到对 触摸电子设备的操作为松开 n个触摸点中的 n-1 个触摸点的操作的情况 下、在所述缩放操作模块或者所述触摸事件方法执行模块将网页文字缩放 比例设置为网页显示控件的显示缩放比例之前, 所述像素值获取模块: 获取该网页的网页内容左侧边框的参考像素值;
判断所述参考像素值是否为正数或零,如果其为正数或零, 则该参考 像素值不变;
如果所述参考像素值为负数,则根据缩放操作开始时缩放中点的横坐 标像素值和纵坐标像素值以及缩放前显示缩放比例 ,获取网页内容左侧边 框的像素值,并且在该获取的像素值为正数或零的情况下将其作为网页内 容左侧边框的参考像素值。
31. 如权利要求 30所述的装置, 其中当所述第二像素值为负数时, 所述网页内容移动模块根据所述参考像素值移动网页内容。
32. 如权利要求 17至 22中的任一项所述的装置, 其中所述网页显示 控件是 Android ***的 WebView 控件, 所述缩放管理器对象是 mZoomManager对象, 所述缩放处理器对象是 mListener对象, 所述缩放 处理器类是 OnScaleGestureListener 类, 所述文字缩放比例对象是 mTextWmpScale对象,所述缩放检测器对象是 mScaleDetector对象,所述 缩放开始方法、 缩放过程方法、 缩放完成方法分别为 mListener对象的 onScaleBegin方法、 onScale方法、 onScaleEnd方法, 所述触摸事件方法 包括 onTouchEvent方法以及 dispatchTouchEvent方法,所述设置并启用缩 放比例方法是 setZoomScale方法或 setNewZoomScale方法, 所述事件处 理器类是 Handler类, 所述网页渲染处理器对象是 mPrivateHandler对象, 所述接收消息方法是 handleMessage方法, 所述缩放中点横坐标像素值方 法是 mZoomCenterX 方法, 所述缩放中点纵坐标像素值方法是 mZoomCenterY方法, 所述获取可视区域横坐标像素值方法是 getScrollX 方法 , 所述获取可视区域纵坐标像素值方法是 getScrollY方法 , 所述获取 内容的横坐标像素值方法是 viewToContentX方法, 所述获取内容的纵坐 标像素值方法是 viewToContentY 方法, 所述获取显示缩放比例方法是 getScale 方法, 所述获取网页内容左侧边框的像素值方法是 getBlockLeftEdge方法或 nativeGetBlockLeftEdge方法,所述移动可视区域 方法是 scrollTo方法或 pinScrollTo方法。
33. 一种计算机程序, 包括计算机可读代码, 当所述计算机可读代 码在服务器上运行时, 导致所述服务器执行根据权利要求 1-16中的任 一个所述的电子设备上网页缩放的方法。
34.—种计算机可读介质,其中存储了如权利要求 33所述的计算机 程序。
PCT/CN2014/074454 2013-06-28 2014-03-31 一种电子设备上网页缩放的方法和装置 WO2014206124A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US14/901,512 US10061494B2 (en) 2013-06-28 2014-03-31 Method and device for webpage zooming on electronic apparatus

Applications Claiming Priority (16)

Application Number Priority Date Filing Date Title
CN201310268150.6A CN103345497B (zh) 2013-06-28 2013-06-28 一种电子设备上网页缩放的方法和装置
CN201310267927.7A CN103336817B (zh) 2013-06-28 2013-06-28 一种电子设备上网页缩放的方法和装置
CN201310269588.6A CN103324741B (zh) 2013-06-28 2013-06-28 一种电子设备上网页缩放和对齐的方法和装置
CN201310269018.7 2013-06-28
CN201310267962.9 2013-06-28
CN201310269018.7A CN103336818B (zh) 2013-06-28 2013-06-28 一种电子设备上网页缩放后对齐的方法和装置
CN201310270415.6 2013-06-28
CN201310269405.0A CN103324738B (zh) 2013-06-28 2013-06-28 一种电子设备上网页缩放后对齐的方法和装置
CN201310267927.7 2013-06-28
CN201310269384.2 2013-06-28
CN201310269384.2A CN103336819B (zh) 2013-06-28 2013-06-28 一种电子设备上网页缩放后对齐的方法和装置
CN201310269588.6 2013-06-28
CN201310268150.6 2013-06-28
CN201310270415.6A CN103324743B (zh) 2013-06-28 2013-06-28 一种电子设备上网页缩放和对齐的方法和装置
CN201310269405.0 2013-06-28
CN201310267962.9A CN103324734B (zh) 2013-06-28 2013-06-28 一种电子设备上网页缩放的方法和装置

Publications (1)

Publication Number Publication Date
WO2014206124A1 true WO2014206124A1 (zh) 2014-12-31

Family

ID=52140981

Family Applications (2)

Application Number Title Priority Date Filing Date
PCT/CN2014/074454 WO2014206124A1 (zh) 2013-06-28 2014-03-31 一种电子设备上网页缩放的方法和装置
PCT/CN2014/074455 WO2014206125A1 (zh) 2013-06-28 2014-03-31 一种电子设备上网页缩放后对齐的方法和装置

Family Applications After (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/074455 WO2014206125A1 (zh) 2013-06-28 2014-03-31 一种电子设备上网页缩放后对齐的方法和装置

Country Status (2)

Country Link
US (1) US10061494B2 (zh)
WO (2) WO2014206124A1 (zh)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6672309B2 (ja) * 2014-09-09 2020-03-25 ライブパーソン, インコーポレイテッド 動的コード管理
CN107133235A (zh) * 2016-02-29 2017-09-05 广州市动景计算机科技有限公司 页面重新排版方法、重新排版装置、浏览器及电子设备
KR102354016B1 (ko) * 2017-08-22 2022-01-21 삼성전자주식회사 표시 장치에 표시된 콘텐트의 크기를 변경하기 위한 방법 및 그 전자 장치
CN111831387B (zh) * 2018-05-14 2024-01-02 创新先进技术有限公司 一种页面处理方法、装置及设备
CN111179161B (zh) * 2018-11-09 2023-04-28 阿里巴巴集团控股有限公司 图片缩放处理方法和装置以及电子设备
CN109597548B (zh) * 2018-11-16 2020-05-12 北京字节跳动网络技术有限公司 菜单显示方法、装置、设备及存储介质

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009053833A1 (en) * 2007-10-25 2009-04-30 Nokia Corp. Apparatus and method for zooming objects on a display
CN102314502A (zh) * 2011-09-01 2012-01-11 百度在线网络技术(北京)有限公司 一种用于在移动终端上显示网页主体内容的方法和设备
US20120110438A1 (en) * 2010-11-03 2012-05-03 Microsoft Corporation Proportional Font Scaling
CN102566908A (zh) * 2011-12-13 2012-07-11 鸿富锦精密工业(深圳)有限公司 电子设备及其页面缩放方法
CN103324741A (zh) * 2013-06-28 2013-09-25 北京奇虎科技有限公司 一种电子设备上网页缩放和对齐的方法和装置
CN103324738A (zh) * 2013-06-28 2013-09-25 北京奇虎科技有限公司 一种电子设备上网页缩放后对齐的方法和装置
CN103324743A (zh) * 2013-06-28 2013-09-25 北京奇虎科技有限公司 一种电子设备上网页缩放和对齐的方法和装置
CN103324734A (zh) * 2013-06-28 2013-09-25 北京奇虎科技有限公司 一种电子设备上网页缩放的方法和装置
CN103336818A (zh) * 2013-06-28 2013-10-02 北京奇虎科技有限公司 一种电子设备上网页缩放后对齐的方法和装置
CN103336817A (zh) * 2013-06-28 2013-10-02 北京奇虎科技有限公司 一种电子设备上网页缩放的方法和装置
CN103336819A (zh) * 2013-06-28 2013-10-02 北京奇虎科技有限公司 一种电子设备上网页缩放后对齐的方法和装置
CN103345497A (zh) * 2013-06-28 2013-10-09 北京奇虎科技有限公司 一种电子设备上网页缩放的方法和装置

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6421063B1 (en) * 1999-04-09 2002-07-16 Hewlett-Packard Company Pixel zoom system and method for a computer graphics system
US20030195872A1 (en) * 1999-04-12 2003-10-16 Paul Senn Web-based information content analyzer and information dimension dictionary
US7542050B2 (en) * 2004-03-03 2009-06-02 Virtual Iris Studios, Inc. System for delivering and enabling interactivity with images
US7743348B2 (en) * 2004-06-30 2010-06-22 Microsoft Corporation Using physical objects to adjust attributes of an interactive display application
US7768536B2 (en) * 2007-04-11 2010-08-03 Sony Ericsson Mobile Communications Ab Methods of displaying information at different zoom settings and related devices and computer program products
US9378188B2 (en) * 2008-04-15 2016-06-28 Opera Software Asa Method and device for dynamically wrapping text when displaying a selected region of an electronic document
US8217909B2 (en) * 2008-12-19 2012-07-10 Cypress Semiconductor Corporation Multi-finger sub-gesture reporting for a user interface device
US20110035701A1 (en) * 2009-08-10 2011-02-10 Williams Harel M Focal point zoom
US20130132867A1 (en) * 2011-11-21 2013-05-23 Bradley Edward Morris Systems and Methods for Image Navigation Using Zoom Operations
CN102591853B (zh) * 2011-12-29 2015-04-01 优视科技有限公司 网页重排方法、网页重排装置以及移动终端
CN102637198B (zh) * 2012-02-28 2015-04-01 优视科技有限公司 网页内容显示的实现方法、装置、浏览器及移动终端
US20130254139A1 (en) * 2012-03-21 2013-09-26 Xiaoguang Lei Systems and methods for building a universal intelligent assistant with learning capabilities
CN102779167B (zh) * 2012-06-21 2016-01-06 北京奇虎科技有限公司 在移动终端中显示网页的方法及***
US9671951B2 (en) * 2012-10-09 2017-06-06 Htc Corporation Method for zooming screen and electronic apparatus and computer readable medium using the same
KR20140097820A (ko) * 2013-01-30 2014-08-07 삼성전자주식회사 전자장치에서 웹페이지 내의 특정 객체의 속성을 조절하기 위한 방법 및 장치
US9507781B2 (en) * 2013-04-30 2016-11-29 Jpmorgan Chase Bank, N.A. System and method for mobile presentation processing
US10271010B2 (en) * 2013-10-31 2019-04-23 Shindig, Inc. Systems and methods for controlling the display of content
TW201624265A (zh) * 2014-12-30 2016-07-01 富智康(香港)有限公司 畫面調整方法及系統

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009053833A1 (en) * 2007-10-25 2009-04-30 Nokia Corp. Apparatus and method for zooming objects on a display
US20120110438A1 (en) * 2010-11-03 2012-05-03 Microsoft Corporation Proportional Font Scaling
CN102314502A (zh) * 2011-09-01 2012-01-11 百度在线网络技术(北京)有限公司 一种用于在移动终端上显示网页主体内容的方法和设备
CN102566908A (zh) * 2011-12-13 2012-07-11 鸿富锦精密工业(深圳)有限公司 电子设备及其页面缩放方法
CN103324741A (zh) * 2013-06-28 2013-09-25 北京奇虎科技有限公司 一种电子设备上网页缩放和对齐的方法和装置
CN103324738A (zh) * 2013-06-28 2013-09-25 北京奇虎科技有限公司 一种电子设备上网页缩放后对齐的方法和装置
CN103324743A (zh) * 2013-06-28 2013-09-25 北京奇虎科技有限公司 一种电子设备上网页缩放和对齐的方法和装置
CN103324734A (zh) * 2013-06-28 2013-09-25 北京奇虎科技有限公司 一种电子设备上网页缩放的方法和装置
CN103336818A (zh) * 2013-06-28 2013-10-02 北京奇虎科技有限公司 一种电子设备上网页缩放后对齐的方法和装置
CN103336817A (zh) * 2013-06-28 2013-10-02 北京奇虎科技有限公司 一种电子设备上网页缩放的方法和装置
CN103336819A (zh) * 2013-06-28 2013-10-02 北京奇虎科技有限公司 一种电子设备上网页缩放后对齐的方法和装置
CN103345497A (zh) * 2013-06-28 2013-10-09 北京奇虎科技有限公司 一种电子设备上网页缩放的方法和装置

Also Published As

Publication number Publication date
US10061494B2 (en) 2018-08-28
US20170123635A1 (en) 2017-05-04
WO2014206125A1 (zh) 2014-12-31

Similar Documents

Publication Publication Date Title
WO2020147665A1 (zh) 文件处理方法、装置、终端及存储介质
WO2014206124A1 (zh) 一种电子设备上网页缩放的方法和装置
WO2019174546A1 (zh) 用户界面显示方法、装置、设备及存储介质
EP3680766A1 (en) Split screen display method, apparatus, terminal, and storage medium
WO2020038168A1 (zh) 内容分享方法、装置、终端及存储介质
JP6133318B2 (ja) クロス・ウィンドウ・アニメーション
US11036345B2 (en) System and method for on-screen graphical user interface encapsulation and reproduction
WO2019174467A1 (zh) 输入法界面显示方法、装置、终端及存储介质
WO2019174465A1 (zh) 用户界面显示方法、装置、终端及存储介质
RU2727063C1 (ru) Способ и устройство обработки услуг
TWI604375B (zh) 螢幕分享方法以及使用該方法的裝置
WO2019174466A1 (zh) 消息提醒方法、装置、设备及存储介质
CN103324734B (zh) 一种电子设备上网页缩放的方法和装置
US9484003B2 (en) Content bound graphic
WO2019047147A1 (zh) 图标移动方法及装置
WO2016045523A1 (zh) 一种移动终端界面内容的显示方法、装置及终端
WO2019100985A1 (zh) 页面处理方法及移动终端
WO2022218111A1 (zh) 应用界面的显示方法、装置、终端及存储介质
WO2018010440A1 (zh) 一种投影画面调整方法、装置和投影终端
KR20140031234A (ko) 계층적 영역들에서의 다중 입력 제스처들
WO2014161357A1 (zh) 浏览器资源显示方法和装置、计算机可读存储介质
US11314391B2 (en) Navigation bar controlling method and terminal
WO2019011141A1 (zh) 启动、配置方法,装置,设备,介质和操作***
WO2016192546A1 (zh) 一种动态曲线的数据点更新方法和设备
WO2017101390A1 (zh) 一种图片显示方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14818408

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 14901512

Country of ref document: US

122 Ep: pct application non-entry in european phase

Ref document number: 14818408

Country of ref document: EP

Kind code of ref document: A1