[go: up one dir, main page]

CN115033814B - Page display method, electronic device and storage medium - Google Patents

Page display method, electronic device and storage medium Download PDF

Info

Publication number
CN115033814B
CN115033814B CN202210470378.2A CN202210470378A CN115033814B CN 115033814 B CN115033814 B CN 115033814B CN 202210470378 A CN202210470378 A CN 202210470378A CN 115033814 B CN115033814 B CN 115033814B
Authority
CN
China
Prior art keywords
target
width
value
page
typesetting
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202210470378.2A
Other languages
Chinese (zh)
Other versions
CN115033814A (en
Inventor
孙上斌
于刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhangyue Technology Co Ltd
Original Assignee
Zhangyue Technology Co Ltd
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
Application filed by Zhangyue Technology Co Ltd filed Critical Zhangyue Technology Co Ltd
Priority to CN202210470378.2A priority Critical patent/CN115033814B/en
Publication of CN115033814A publication Critical patent/CN115033814A/en
Application granted granted Critical
Publication of CN115033814B publication Critical patent/CN115033814B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The disclosure relates to a page display method, electronic equipment and a storage medium. The page display method comprises the steps of obtaining a page file corresponding to a target page, detecting whether a target object with a width to be replaced exists in the target page according to the page file, adjusting a target width parameter in the page file to be a target value if the target object exists in the target page, wherein the target width parameter is a parameter of the target object related to the width, and displaying the target page based on the adjusted page file. According to the embodiment of the disclosure, the target object in the target page can be normally displayed in the width aspect, and the user experience is improved.

Description

Page display method, electronic device and storage medium
Technical Field
The disclosure relates to the field of computer technology, and in particular, to a page display method, electronic equipment and a storage medium.
Background
With the rapid development of the internet, user experience is becoming more and more important on the basis of meeting the public availability. In some cases, a user may view some pages displayed on a mobile terminal through a browser to obtain different viewing experiences.
However, in the related art, when some pages displayed on the mobile terminal are viewed through the browser, the page resources adapted to the mobile terminal are generally displayed directly on the browser, so that some incompatible pages occur, for example, a situation that a certain display object in the pages cannot be completely displayed in the screen in the width direction, and the display object is not normally displayed, thereby affecting the user experience.
Disclosure of Invention
In order to solve the technical problems, the disclosure provides a page display method, electronic equipment and a storage medium.
In a first aspect, the present disclosure provides a page display method, including:
acquiring a page file corresponding to a target page;
detecting whether a target object with a width to be replaced exists in a target page according to the page file;
if the target object exists in the target page, adjusting the target width parameter in the page file to be a target value, wherein the target width parameter is a parameter of the target object related to the width;
And displaying the target page based on the adjusted page file.
In a second aspect, the present disclosure provides an electronic device comprising a processor and a memory for storing executable instructions that cause the processor to:
acquiring a page file corresponding to a target page;
detecting whether a target object with a width to be replaced exists in a target page according to the page file;
if the target object exists in the target page, adjusting the target width parameter in the page file to be a target value, wherein the target width parameter is a parameter of the target object related to the width;
And displaying the target page based on the adjusted page file.
In a third aspect, the present disclosure provides a computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to implement the page display method of the first aspect.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
According to the page display method, the electronic device and the storage medium, after the page file corresponding to the target page is obtained, whether the target object with the width to be replaced exists in the corresponding target page or not can be detected according to the page file, if the target object exists in the target page, the target width parameter in the page file is adjusted to be the target value, namely, the parameter related to the width of the target object is adjusted to be the target value, then the target page is displayed based on the adjusted page file, and the target page with the target object with the width to be replaced is the object which cannot be completely displayed in the screen in the width direction, so that the parameter related to the width of the target object with the width to be replaced can be adjusted, the target object in the target page can be normally displayed in the width aspect, and user experience is improved.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
FIG. 1 is a schematic diagram showing a display of an electronic book page in the related art;
Fig. 2 is a schematic flow chart of a page display method according to an embodiment of the disclosure;
Fig. 3 shows a schematic display diagram of an electronic book page according to an embodiment of the disclosure;
FIG. 4 is a schematic flow chart of another page display method according to an embodiment of the disclosure;
Fig. 5 shows a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment," another embodiment "means" at least one additional embodiment, "and" some embodiments "means" at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
In the related art, when some pages displayed on a mobile terminal are viewed through a browser, page resources adapted to the mobile terminal are generally displayed directly on the browser, resulting in some incompatible pages.
For example, fig. 1 shows a schematic display of an electronic book page.
As shown in fig. 1, in the browser page 101, an electronic book cover image 102 is displayed, and since the electronic book cover image 102 is not adapted to the browser, the right side of the electronic book cover image 102 exceeds the screen and cannot be completely displayed in the browser page 101, so that a lateral roller bar 103 appears in the lateral direction of the electronic book cover image 102, and a user needs to pull the lateral roller bar 103 left and right to see all the electronic book cover images 102 during browsing, which affects the user experience.
Therefore, when some pages displayed on the mobile terminal are watched through the browser, abnormal display of display objects such as that a certain display object in the page cannot be completely displayed in a screen in the width direction can occur, so that user experience is affected.
In order to solve the above-mentioned problems, embodiments of the present disclosure provide a page display method, an electronic device, and a storage medium that enable a target object in a target page to be displayed normally in terms of width.
Next, a page display method provided by an embodiment of the present disclosure will be described with reference to fig. 2 to 4.
The page display method provided by the embodiment of the disclosure can be executed by the electronic equipment capable of providing the page display function. The electronic device may include, but is not limited to, mobile terminals such as smartphones, notebook computers, personal Digital Assistants (PDAs), tablet computers (PADs), portable Multimedia Players (PMPs), in-vehicle terminals (e.g., in-vehicle navigation terminals), wearable devices, etc., as well as stationary terminals such as digital TVs, desktop computers, smart home devices, etc.
Fig. 2 shows a flowchart of a page display method according to an embodiment of the disclosure.
As shown in fig. 2, the page display method may include the following steps.
S210, acquiring a page file corresponding to the target page.
In the embodiment of the disclosure, when a user wants to browse a target page on an electronic device through a browser, the target page can be opened on the electronic device through the browser, and at this time, the electronic device can respond to the operation of opening the target page by the user to acquire a page file corresponding to the target page.
In some embodiments, the electronic device may receive and obtain a page file corresponding to the target page uploaded by the user.
In other embodiments, the electronic device may receive and respond to a click operation of the page link by the user, and download the page file corresponding to the target page based on the page link.
Alternatively, the target page may be a different type of page. For example, the page may be an electronic book page, a news page, a video page, etc., which is not limited herein.
Alternatively, the page file may be the source file of the target page. Wherein the source file may be a code file written by a programmer in a language supported by the development tool. A code may be a set of explicit rules that represent information in discrete form by characters, symbols, or signal symbols.
Alternatively, the page file may include a code file of a standard typesetting style corresponding to the target page, but is not limited thereto.
S220, detecting whether a target object with the width to be replaced exists in the target page according to the page file.
In the embodiment of the disclosure, after the electronic device obtains the page file corresponding to the target page, whether the target object with the width to be replaced exists in the corresponding target page or not may be detected according to the page file.
Wherein the width may be the lateral width of the page.
Alternatively, the target object of the width to be replaced refers to an object that cannot be completely displayed in the screen in the width direction, that is, the target object may be a page object whose width needs to be adjusted.
Alternatively, the page object may be a page element in the target page.
Wherein the page element may be an element constituting the target page. For example, the page element may be a text element, a picture element, a control element, a link element, etc., but is not limited thereto.
Specifically, after the electronic device obtains the page file corresponding to the target page, the electronic device may analyze the page file to obtain a data tree corresponding to the page file, and further determine whether the target page has a target object with a width to be replaced based on the data tree.
A data tree is understood, among other things, to be a tree structure formed by individual page objects and object containers referred to by a page file based on standard typesetting styles. The root node of the data tree may correspond to the object containers of all page objects and all other object containers within the presentation target, and the root node contains standard typesetting style information for the corresponding object containers. The root node may be connected to at least one primary child node, where each primary child node may correspond to a page object that is directly displayed in an object container corresponding to the root node or an object container that is directly displayed in an object container corresponding to the root node, and each primary child node may include standard typesetting style information corresponding to the page object or the object container. And by analogy, each level of nodes of the data tree respectively corresponds to each level of page objects and object containers which are associated in a level, and the root node to the leaf node of the data tree can correspond to all page objects and object containers which are related to the page file.
Therefore, the electronic device can detect whether the target page cannot be completely displayed in the screen when being displayed based on the data tree, determine that the target object with the width to be replaced exists in the target page if the object which cannot be completely displayed in the screen in the width direction exists in the target page, and determine that the target object with the width to be replaced does not exist in the target page if the object which cannot be completely displayed in the screen in the width direction does not exist in the target page.
And S230, if the existence of the target object in the target page is detected, adjusting the target width parameter in the page file to be a target value, wherein the target width parameter is a parameter related to the width of the target object.
In the implementation of the disclosure, after detecting whether a target object with a width to be replaced exists in a target page, if the target object with the width to be replaced exists in the target page, the electronic device adjusts a target width parameter in a page file to be a target value, that is, adjusts a parameter related to the width of the target object in the page file to be the target value.
Alternatively, the target width parameter may be a parameter related to the width of the target object.
Alternatively, the target value may be a value for changing the target width parameter.
Specifically, after detecting whether the target object with the width to be replaced exists in the target page, if the target object with the width to be replaced exists in the target page, the electronic device may find a target width parameter in the data tree, that is, find a parameter related to the width of the target object in the data tree, so that a code corresponding to the parameter related to the width of the target object is found in the page file based on a mapping relationship between the data tree and the page file, and then adjust the code, so that the parameter related to the width of the target object is adjusted to be a target value.
S240, displaying the target page based on the adjusted page file.
In the embodiment of the disclosure, after the electronic device adjusts the target width parameter in the page file to the target value, the electronic device may display the corresponding target page according to the adjusted page file.
Specifically, the electronic device may obtain the page file corresponding to the adjusted target page after adjusting the target width parameter in the page file to the target value, and the electronic device may analyze the adjusted page file to obtain an adjusted data tree, so as to display the corresponding target page based on the adjusted data tree.
Therefore, in the embodiment of the disclosure, after the page file corresponding to the target page is obtained, whether the target object with the width to be replaced exists in the corresponding target page or not can be detected according to the page file, if the target object exists in the target page, the target width parameter in the page file is adjusted to be the target value, that is, the parameter related to the width of the target object is adjusted to be the target value, then the target page is displayed based on the adjusted page file, and because the target page with the target object with the width to be replaced is the object which cannot be completely displayed in the screen in the width direction, the parameter related to the width of the target object with the width to be replaced can be adjusted, so that the target object in the target page can be normally displayed in the width aspect, and the user experience is improved.
In some embodiments of the present disclosure, the electronic device may detect whether a target object with a width to be replaced exists in the target page according to different detection conditions, which will be described in detail below.
In some embodiments, S120 may specifically include detecting whether a first object having a percentage width greater than a preset percentage width threshold exists in the page file, and if the first object is detected to exist in the page file, taking the first object as a target object.
In the embodiment of the present disclosure, after the electronic device obtains the page file, whether the first object with the percentage width greater than the preset percentage width threshold exists in the page file may be detected according to the data tree corresponding to the page file.
Specifically, the electronic device may traverse the data tree corresponding to the page file, that is, traverse standard typesetting style information of each page object in the data tree, compare the percentage width in the standard typesetting style information of each page object with a preset percentage width threshold, if the percentage width in any standard typesetting style information is greater than the preset percentage width threshold, determine that the page object corresponding to the standard typesetting style information is a first object whose percentage width is greater than the preset percentage width threshold, thereby determining that the first object exists in the page file, and if the percentage width in any standard typesetting style information is less than or equal to the preset percentage width threshold, determine that the page object corresponding to the standard typesetting style information is not the first object.
Alternatively, the first object may be an object whose percentage width parameter is greater than a preset percentage width threshold.
Alternatively, the percentage width may be a percentage parameter used to define the width of the first object.
Alternatively, the preset percentage width threshold may be a preset maximum percentage width allowed for the page. For example, the preset percentage width threshold may be 100%.
Specifically, taking a preset percentage width threshold value as 100% as an example, the electronic device may find whether a percentage width parameter greater than 100% exists in a data tree corresponding to the page file, and take an object with the percentage width parameter greater than 100% as the first object.
Further, if the electronic device detects that a first object with the percentage width larger than the preset percentage width threshold exists in the page file, the first object is taken as a target object.
Specifically, taking a preset percentage width threshold value as 100% as an example, if the electronic device detects that a percentage width parameter greater than 100% exists in the page file, taking a first object corresponding to the percentage width parameter as a target object, that is, a target object with a width to be replaced exists in a target page corresponding to the page file.
Therefore, in the embodiment of the disclosure, after the electronic device detects that the first object with the width percentage greater than the threshold value of the preset width percentage exists, it may be determined that the target object with the width to be replaced exists in the target page, that is, the object which cannot be completely displayed in the screen in the width direction exists, so that parameters related to the width of the target object with the width to be replaced are adjusted, so that the target object in the target page can be normally displayed in terms of the page width, and user experience is improved.
In other embodiments, the step S120 may specifically include detecting whether a second object with a negative margin value exists in the page file, and if the second object is detected to exist in the page file, taking the second object as a target object.
In the embodiment of the present disclosure, after the electronic device obtains the page file, whether the second object whose outer edge distance is a negative edge distance value exists in the page file may be detected according to a data tree corresponding to the page file.
Specifically, the electronic device may traverse the data tree corresponding to the page file, that is, traverse the standard typesetting style information of each page object in the data tree, and query the outer margin in the standard typesetting style information of each page object, if the outer margin in any standard typesetting style information is a negative margin value, determine that the page object corresponding to the standard typesetting style information is a second object whose outer margin is a negative margin value, thereby determining that the second object exists in the page file, and if the outer margin in any standard typesetting style information is not a negative margin value, determine that the page object corresponding to the standard typesetting style information is not the second object.
Alternatively, the second object may be an object whose outer edge parameter is a negative edge value.
Alternatively, the outer margin may be a margin value parameter for defining the width of the second object.
Alternatively, the negative margin value may be a value where the margin is a negative number, i.e. the margin is less than 0. For example, the negative margin value may be-10 device independent pixels (DEVICE INDEPENDENT pixels, DP).
Specifically, after the electronic device obtains the page file, whether an object with the margin value parameter being the negative margin value exists in the page file, that is, an object with the margin being the negative margin value, is searched, and the object with the margin being the negative margin value is used as the second object.
Further, if the electronic device detects that a second object with the outer margin being a negative margin value exists in the page file, the second object is taken as a target object.
Specifically, taking the negative margin value as-10 DP as an example, if the electronic device detects that the external margin with the negative margin value exists in the page file, for example, the external margin with the negative margin value as-10 DP, the second object corresponding to the external margin is taken as the target object, that is, the target object with the width to be replaced exists in the target page corresponding to the page file.
Therefore, in the embodiment of the disclosure, after the electronic device detects that the second object with the negative margin exists, it may be determined that the target object with the width to be replaced exists in the target page, that is, the object which cannot be completely displayed in the screen in the width direction exists, so that parameters related to the width of the target object with the width to be replaced are adjusted, so that the target object in the target page can be normally displayed in terms of the page width, and user experience is improved.
In still other embodiments, the step S120 may specifically further include detecting whether a third object with an object width greater than a preset width threshold exists in the page file, and if the third object is detected to exist in the page file, taking the third object as a target object.
Specifically, the electronic device may traverse the data tree corresponding to the page file, that is, traverse the standard typesetting style information of each page object in the data tree, compare the object width in the standard typesetting style information of each page object with a preset width threshold, if the object width in any standard typesetting style information is greater than the preset width threshold, determine that the page object corresponding to the standard typesetting style information is a third object whose object width is greater than the preset width threshold, thereby determining that the third object is in the page file, and if the object width in any standard typesetting style information is less than or equal to the preset width threshold, determine that the page object corresponding to the standard typesetting style information is not the third object.
In the embodiment of the present disclosure, after the electronic device obtains the page file, whether a third object whose object width is greater than a preset width threshold exists in the page file may be detected according to a data tree corresponding to the page file.
Alternatively, the third object may be an object whose object width parameter is greater than a preset width threshold.
Alternatively, the object width may be a width value parameter for defining the width of the third object.
Alternatively, the preset width threshold may be a preset maximum width value. The width value may be a window width (VW), for example, the preset width threshold may be 20VW.
Specifically, taking the preset width threshold value of 20VW as an example, after the electronic device obtains the page file, the electronic device may find whether the object with the object width greater than the preset width threshold value, that is, the object with the object width greater than 20VW, in the page file, and take the object with the object width greater than 20VW as the third object.
Further, if the electronic device detects that a third object with the object width larger than the preset width threshold exists in the page file, the third object is taken as a target object.
Specifically, taking the preset width threshold value of 20VW as an example, if the electronic device detects that an object with an object width greater than the preset width threshold value of 20VW exists in the page file, the third object corresponding to the object width is taken as a target object, that is, a target object with a width to be replaced exists in a target page corresponding to the page file.
Therefore, in the embodiment of the disclosure, after detecting that the third object with the width of the object being greater than the preset width threshold exists, the electronic device may determine that the target object with the width to be replaced exists in the target page, that is, the object which cannot be completely displayed in the screen in the width direction exists, so as to adjust the parameters related to the width of the target object with the width to be replaced, so that the target object in the target page can be normally displayed in terms of the page width, and user experience is improved.
In other embodiments of the present disclosure, the electronic device may further need to perform a pre-typesetting process on the page file before adjusting the target width parameter in the page file to the target value, so as to determine the target value for adjusting the target width parameter based on the pre-typesetting result.
Optionally, before the target width parameter in the page file is adjusted to the target value, the page display method further comprises the steps of inputting the page file into a preset typesetting engine to conduct typesetting to obtain a typesetting result, and determining the target value corresponding to the target width parameter according to the typesetting result.
In the embodiment of the disclosure, the electronic device may input the page file into a preset typesetting engine to perform pre-typesetting, obtain a corresponding pre-typesetting result, and then determine a target value corresponding to the target width parameter according to the pre-typesetting result.
Alternatively, the pre-set layout engine may be a pre-trained engine for pre-laying out the page file. The preset typesetting engine can be obtained by training aiming at the corresponding model of the electronic equipment and/or the browser used by the electronic equipment.
Specifically, the electronic device may input the page file into a preset typesetting engine to perform typesetting, so as to obtain a corresponding typesetting result, where the typesetting result may be a corresponding typesetting tree.
Optionally, the composition tree is similar to the data tree.
The typesetting tree is understood to be a tree structure formed by each page object and an object container which are related to the page file after the typesetting is performed on the basis of the typesetting style. The root node of the composition tree may correspond to an object container that exposes all page objects within the target page as well as all other object containers, and the root node contains pre-composition style information for the corresponding object container. The root node may be connected to at least one primary child node, where each primary child node may correspond to a page object that is directly displayed in an object container corresponding to the root node or an object container that is directly displayed in an object container corresponding to the root node, and each primary child node may include pre-typesetting style information of the corresponding page object or object container. And by analogy, each level of nodes of the data tree respectively corresponds to each level of page objects and object containers which are associated in a level, and the root node to the leaf node of the data tree can correspond to all page objects and object containers which are related to the page file.
Further, the electronic device may determine a target value corresponding to the target width parameter according to the pre-typesetting result.
Therefore, in the embodiment of the disclosure, the electronic device may pre-typeset the page file to obtain the target value for replacing the target width parameter, so as to adjust the parameter related to the width of the target object with the width to be replaced, so that the target object in the target page can be displayed normally in terms of the page width, and user experience is improved.
The electronic device obtains different target values corresponding to different detection conditions through pre-typesetting is described in detail below.
In some embodiments, when the electronic device determines that the target object is the first object whose percentage width is greater than the preset percentage width threshold, the target width parameter may be a percentage width parameter.
Optionally, determining the target value corresponding to the target width parameter according to the pre-typesetting result may specifically include determining a first object content width value corresponding to the target object and a second object content width value corresponding to a previous object of the target object according to the pre-typesetting result, and taking a ratio of the first object content width value to the second object content width value as the target value.
In the embodiment of the present disclosure, after determining that the target object is a first object whose percentage width is greater than a preset percentage width threshold, the electronic device may search the obtained typesetting tree for the first object and obtain a first object content width value corresponding to the first object, and then the electronic device may search the obtained typesetting tree for a previous object of the first object and obtain a second object content width value corresponding to the previous object.
The electronic device can query the node corresponding to the object container of the first object in the typesetting tree, obtain the pre-typesetting style information included in the node after the node is queried, then extract the first object content width value corresponding to the first object from the obtained pre-typesetting style information, and similarly, the electronic device can query the node corresponding to the object container of the upper level object of the first object in the typesetting tree, obtain the pre-typesetting style information included in the node after the node is queried, and then extract the second object content width value corresponding to the upper level object of the first object from the obtained pre-typesetting style information.
Alternatively, the previous level object of the first object may be a page object in a previous level object container of the object container to which the first object belongs.
Alternatively, the first object content width value may be a content width parameter related to the width of the first object in the composition tree.
Alternatively, the second object content width value may be a width-related content width parameter of a previous level object corresponding to the first object in the composition tree.
Specifically, the electronic device may find and obtain, in the composition tree, a corresponding first object content width value of the first object related to the width and a corresponding second object content width value of a previous level object corresponding to the first object related to the width.
Further, the electronic device takes the ratio of the first object content width value and the second object content width value as the target value after acquiring the first object content width value and the second object content width value.
Specifically, the electronic device may divide the obtained first object content width value by the second object content width value and multiply by 100, thereby obtaining a percentage ratio of the first object content width value and the second object content width value, and further use the obtained percentage ratio as the target value.
Therefore, in the embodiment of the disclosure, the electronic device may use the percentage ratio of the first object content width value corresponding to the typeset first object and the second object content width value corresponding to the previous object of the first object as the target value, so as to adjust the parameters related to the width of the target object with the width to be replaced, so that the target object in the target page can be displayed normally in terms of page width, and user experience is improved.
Optionally, the electronic device determines a first object content width value corresponding to the target object and a second object content width value corresponding to a previous object of the target object, which specifically includes obtaining a first typesetting width value of the target object, a first typesetting outer margin of the target object, a second typesetting width value of the previous object and a second typesetting outer margin of the previous object in a pre-typesetting result, taking a difference value between the first typesetting width value and the first typesetting outer margin as the first object content width value, and taking a difference value between the second typesetting width value and the second typesetting outer margin as the second object content width value.
In the embodiment of the disclosure, after the electronic device obtains the typesetting tree, the electronic device may search the typesetting tree for the first object and the previous-level object of the first object, and obtain the first typesetting width value of the first object, the first typesetting outer margin of the first object, the second typesetting width value of the previous-level object of the first object, and the second typesetting outer margin of the previous-level object of the first object.
Optionally, the first typesetting width value may be a width value parameter after the content corresponding to the first object is pre-typeset.
Optionally, the first typesetting margin may be a margin parameter after the content corresponding to the first object is pre-typeset.
Optionally, the second typesetting width value may be a width value parameter after the content corresponding to the previous level object of the first object is pre-typeset.
Optionally, the second typesetting margin may be a margin parameter after the content corresponding to the previous level object of the first object is pre-typeset.
Further, after the electronic device obtains the first typesetting width value, the first typesetting outer margin, the second typesetting width value and the second typesetting outer margin, the electronic device may subtract the first typesetting outer margin from the first typesetting width value, use the obtained difference as the first object content width value, and may subtract the second typesetting outer margin from the second typesetting width value, use the obtained difference as the second object content width value.
For example, the electronic device may find the first object a and the previous-level object B of the first object in the layout tree, obtain a first layout width value 18 pixel (pixels, PX) and a first layout margin 1PX of the first object a, and obtain a second layout width value 20PX and a second layout margin 2PX of the previous-level object B of the first object, and subtract the first layout width value 18PX by the first layout margin 1PX to obtain a difference value a17PX, and subtract the second layout width value 20PX by the second layout margin 2PX to obtain a difference value B18PX, thereby obtaining a first object content width value 17PX and a second object content width value 18PX.
Further, the electronic device may divide the first object content width value 17PX by the second object content width value 18PX and multiply 100, thereby obtaining a percentage value of 94%, i.e., the target value may be 94%, for replacing the target width parameter in the page file.
Therefore, in the embodiment of the disclosure, the electronic device may obtain the first object content width value and the second object content width value through calculation, so that the obtained target value is more accurate, and thus the parameters related to the width of the target object with the width to be replaced are adjusted, so that the target object in the target page can be displayed normally in terms of the page width, and the user experience is improved.
In other embodiments, when the electronic device determines that the target object is the second object whose margin is a negative margin value, the target width parameter may be the margin pattern.
Optionally, determining the target value corresponding to the target width parameter according to the pre-typesetting result may specifically include obtaining a third typesetting outer margin of the target object in the pre-typesetting result, and converting a unit format of the third typesetting outer margin into an original unit format of the target typesetting style to obtain the target value.
In the embodiment of the disclosure, after obtaining the typesetting tree, the electronic device may find a target object in the typesetting tree, that is, find a second object, and obtain a third typesetting outer margin of the second object after finding the second object.
Specifically, the electronic device may query a node corresponding to an object container to which the second object belongs in the typesetting tree, obtain pre-typesetting style information included in the node after querying the node, and then extract a third typesetting outer margin corresponding to the second object from the obtained pre-typesetting style information.
Optionally, the third typesetting margin may be a margin parameter after the content corresponding to the second object is pre-typeset.
Specifically, the electronic device may search and obtain the second object and the third typesetting margin of the second object in the typesetting tree.
Further, after the electronic device may obtain the third typesetting outer margin of the second object, the electronic device converts the unit format of the third typesetting outer margin into the original unit format of the target typesetting style, to obtain the target value.
For example, the unit format of the third layout outer margin may be PX.
Alternatively, the target typesetting style may be a typesetting style corresponding to an outer edge distance of the second object in the data tree.
For example, the original unit format may be DP.
For example, the electronic device may obtain a third typesetting outer margin of the second object in the typesetting tree, e.g., the third typesetting outer margin may be 5PX, and the electronic device may obtain a negative margin value of the second object in the data tree, e.g., the negative margin value may be-10 DP, at which time the electronic device may convert the unit format of the third typesetting outer margin 5PX into the original unit format DP based on the screen density. If the screen density is 160, the third layout outer margin 5PX may be converted into 5DP, so that the target value 5DP may be obtained.
Therefore, in the embodiment of the disclosure, the electronic device may convert the third typesetting outer margin unit format to obtain the target value, so as to adjust the parameters related to the width of the target object with the width to be replaced, so that the target object in the target page can be displayed normally in terms of the page width, and user experience is improved.
In still other embodiments, when the electronic device determines that the target object is a third object having an object width greater than the preset width threshold, the target width parameter may be an object width style.
Optionally, determining the target value corresponding to the target width parameter according to the pre-typesetting result may specifically include obtaining a screen width value and a third typesetting width value of the target object in the pre-typesetting result, comparing the third typesetting width value with the screen width value to obtain an object screen width ratio, and taking a product of the object screen width ratio and a preset height value as the target value.
In the embodiment of the disclosure, after obtaining the typesetting tree, the electronic device may query the typesetting tree for a target object, that is, a third object, and obtain a third typesetting width value of the third object, and obtain a screen width value.
Specifically, the electronic device may query a node corresponding to an object container to which the third object belongs in the typesetting tree, obtain pre-typesetting style information included in the node after querying the node, and then extract a third typesetting width value corresponding to the third object from the obtained pre-typesetting style information.
Alternatively, the third layout width value may be a width value parameter after the content of the third object is pre-laid out.
Alternatively, the screen width value may be a width value parameter of a screen corresponding to the browser.
Specifically, the electronic device may find and obtain a third layout width value and a screen width value of the third object in the layout tree.
Further, after the electronic device obtains the third layout width value and the screen width value, the electronic device may compare the third layout width value with the screen width value, thereby obtaining the object screen width ratio, and then take the product of the object screen width ratio and the preset height value as the target value.
Alternatively, the object screen width ratio may be a ratio obtained by comparing the third layout width value with the progress of the screen width value.
Alternatively, the preset height value may be a preset height value. For example, the preset height value may be 100VW.
For example, the electronic device may search and obtain the third layout width value 22PX and the screen width value 25PX in the layout tree, then the electronic device may compare the third layout width value 22PX with the screen width value 25PX to obtain the object screen width ratio of 0.88, and then the electronic device may multiply the obtained object screen width ratio of 0.88 with the preset height value 100VW, thereby obtaining the performance product 88%, and further take the product 88% as the target value.
Therefore, in the embodiment of the disclosure, the electronic device may obtain the target value of the third object, so as to adjust the parameters related to the width of the target object with the width to be replaced, so that the target object in the target page can be displayed normally in terms of the page width, and user experience is improved.
In still other embodiments of the present disclosure, the electronic device may replace the target width parameter in the page file with the resulting target value, as described in detail below.
Optionally, adjusting the target width parameter in the page file to the target value may specifically include adjusting a target width style corresponding to the target width parameter in the page file from an original value to the target value.
In the embodiment of the disclosure, after the electronic device obtains the target value, the target width style corresponding to the target width parameter in the page file may be adjusted from the original value to the target value.
Alternatively, the target width style may be a code class for controlling the style of the page object. For example, the container style class may include, but is not limited to, width style, text style, font style, and the like.
Specifically, after determining that the target object exists in the target page, the electronic device may acquire a target width style of the target object in the source file corresponding to the page file, and adjust an original value in the target width style to a target value, so that a target width parameter in the page file is adjusted to the target value.
Fig. 3 shows a display schematic diagram of an electronic book page provided in an embodiment of the disclosure.
As shown in fig. 3, after the electronic device obtains the target value, the electronic device adjusts the target width parameter in the surface file to the target value, so that the electronic book cover image 302 in fig. 3 can be obtained by displaying the target page based on the adjusted page file, after the electronic device adjusts the target width parameter in the page file corresponding to the electronic book cover image 302 to the target value, the electronic book cover image 302 can be completely displayed in the browser page 301, so that the electronic book cover image 302 can display the normal page width, and further user experience is improved.
Therefore, in the embodiment of the disclosure, the parameters related to the width of the target object with the width to be replaced are adjusted, so that the target object in the target page can be normally displayed in terms of the page width, and the user experience is improved.
Fig. 4 is a flowchart illustrating another page display method according to an embodiment of the present disclosure. Taking a target page as an electronic book page as an example for illustration.
As shown in fig. 4, the page display method may include the following steps.
S401, acquiring a page file corresponding to a target page.
In the embodiment of the disclosure, the electronic device may acquire the page file corresponding to the target page. For example, a page file corresponding to an electronic book page may be obtained.
S402, whether a first object exists in the page file.
In the embodiment of the present disclosure, after the electronic device obtains the page file, whether the first object with the percentage width greater than the preset percentage width threshold exists in the page file may be detected according to the data tree corresponding to the page file. If it is detected that there is a first object with a percentage width greater than the preset percentage width threshold in the page file, S406 is performed, and if it is detected that there is no first object with a percentage width greater than the preset percentage width threshold in the page file, S403 is performed.
Specifically, taking a preset percentage width threshold value as 100% as an example, the electronic device may find whether a percentage width parameter greater than 100% exists in a data tree corresponding to the page file, and take an object with the percentage width parameter greater than 100% as the first object.
S403, whether a second object exists in the page file.
In the embodiment of the present disclosure, after the electronic device obtains the page file, whether the second object whose outer edge distance is a negative edge distance value exists in the page file may be detected according to the data tree corresponding to the page file. If it is detected that the second object whose margin is a negative margin value exists in the page file, S407 is performed, and if it is detected that the second object whose margin is a negative margin value does not exist in the page file, S404 is performed.
Specifically, taking the negative margin value as-10 DP as an example, if the electronic device detects that the external margin with the negative margin value exists in the page file, for example, the external margin with the negative margin value as-10 DP, the second object corresponding to the external margin is taken as the target object, that is, the target object with the width to be replaced exists in the target page corresponding to the page file.
S404, whether a third object exists in the page file.
In the embodiment of the present disclosure, after the electronic device obtains the page file, whether a third object whose object width is greater than a preset width threshold exists in the page file may be detected according to a data tree corresponding to the page file. And executing S408 if the third object with the object width larger than the preset width threshold value is detected to exist in the page file, and if the third object with the object width larger than the preset width threshold value is detected to not exist in the page file, the target object with the width to be replaced does not exist in the target page.
Specifically, taking the preset width threshold value of 20VW as an example, after the electronic device obtains the page file, the electronic device may find whether the object with the object width greater than the preset width threshold value, that is, the object with the object width greater than 20VW, in the page file, and take the object with the object width greater than 20VW as the third object.
S405, performing pre-typesetting on the page file to obtain a pre-typesetting result.
In the embodiment of the disclosure, the electronic device may input the page file into a preset typesetting engine to perform pre-typesetting, obtain a corresponding pre-typesetting result, and then determine a target value corresponding to the target width parameter according to the pre-typesetting result.
S406, if the first object exists in the page file, acquiring a target value corresponding to the first object based on the pre-typesetting result.
In the embodiment of the present disclosure, if the electronic device detects that the first object exists in the page file, the electronic device may search the obtained typesetting tree for the first object, and obtain a first object content width value corresponding to the first object, and then the electronic device may search the obtained typesetting tree for a previous level object of the first object, and obtain a second object content width value corresponding to the previous level object, where a ratio of the first object content width value and the second object content width value is used as a target value.
For example, the electronic device may find the first object a and the previous-level object B of the first object in the layout tree, obtain a first layout width value 18 pixel (pixels, PX) and a first layout margin 1PX of the first object a, and obtain a second layout width value 20PX and a second layout margin 2PX of the previous-level object B of the first object, and subtract the first layout width value 18PX by the first layout margin 1PX to obtain a difference value a17PX, and subtract the second layout width value 20PX by the second layout margin 2PX to obtain a difference value B18PX, thereby obtaining a first object content width value 17PX and a second object content width value 18PX.
Further, the electronic device may divide the first object content width value 17PX by the second object content width value 18PX and multiply 100, thereby obtaining a percentage value of 94%, i.e., the target value may be 94%, for replacing the target width parameter in the page file.
S407, if the second object exists in the page file, acquiring a target value corresponding to the second object based on the pre-typesetting result.
In the embodiment of the present disclosure, if the electronic device detects that the second object exists in the page file, a third typesetting outer margin of the second object may be searched and obtained in the typesetting tree, and then a unit format of the third typesetting outer margin is converted into an original unit format of the target typesetting style, so as to obtain the target value.
For example, the electronic device may obtain a third typesetting outer margin of the second object in the typesetting tree, e.g., the third typesetting outer margin may be 5PX, and the electronic device may obtain a negative margin value of the second object in the data tree, e.g., the negative margin value may be-10 DP, at which time the electronic device may convert the unit format of the third typesetting outer margin 5PX into the original unit format DP based on the screen density. If the screen density is 160, the third layout outer margin 5PX may be converted into 5DP, so that the target value 5DP may be obtained.
S408, if the third object exists in the page file, acquiring a target value corresponding to the third object based on the pre-typesetting result.
In the embodiment of the present disclosure, if the electronic device detects that the third object exists in the page file, a third layout width value of the third object may be queried and obtained in the layout tree, and a screen width value may be obtained, and then the third layout width value is compared with the screen width value, so as to obtain an object screen width ratio, and thus a product of the object screen width ratio and a preset height value is taken as a target value.
For example, the electronic device may search and obtain the third layout width value 22PX and the screen width value 25PX in the layout tree, then the electronic device may compare the third layout width value 22PX with the screen width value 25PX to obtain the object screen width ratio of 0.88, and then the electronic device may multiply the obtained object screen width ratio of 0.88 with the preset height value 100VW, thereby obtaining the performance product 88%, and further take the product 88% as the target value.
S409, adjusting the target width parameter in the page file to a target value.
In the embodiment of the disclosure, after the electronic device obtains the target value, the target width parameter in the page file may be adjusted to the target value.
S410, displaying the target page based on the adjusted page file.
S410 is the same as S140, and will not be described here again.
The specific embodiments of the above steps are referred to above, and will not be repeated here.
Therefore, in the embodiment of the disclosure, the parameters related to the width of the target object with the width to be replaced are adjusted, so that the target object in the target page can be normally displayed in terms of the page width, and the user experience is improved.
Fig. 5 shows a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Electronic devices provided by embodiments of the present disclosure may include, but are not limited to, mobile terminals such as smartphones, notebook computers, PDA, PAD, PMP, in-vehicle terminals (e.g., in-vehicle navigation terminals), wearable devices, and the like, as well as stationary terminals such as digital TVs, desktop computers, smart home devices, and the like.
It should be noted that the electronic device 500 shown in fig. 5 is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present disclosure.
The electronic device 500 conventionally comprises a processor 510 and a computer program product or computer readable medium in the form of a memory 520. The memory 520 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. The memory 520 has a storage space 521 for executable instructions (or program code) 5211 for performing any of the method steps in the page display method described above. For example, the memory space 521 for executable instructions may include individual executable instructions 5211 for implementing the various steps in the above page display method, respectively. The executable instructions may be read from or written to one or more computer program products. These computer program products comprise a program code carrier such as a hard disk, compact Disk (CD), memory card or floppy disk. Such computer program products are typically portable or fixed storage units. The memory unit may have memory segments or memory spaces or the like arranged similarly to the memory 520 in the electronic device 500 of fig. 5. The executable instructions may be compressed, for example, in a suitable form. In general, the memory unit comprises executable instructions for performing the steps of the page display method according to the present disclosure, i.e. code that is readable by a processor, such as the processor 510, for example, which when executed by the electronic device 500, causes the electronic device 500 to perform the various steps in the page display method described above.
Of course, only some of the components of the electronic device 500 that are relevant to the present disclosure are shown in fig. 5 for simplicity, components such as buses, input/output interfaces, input devices, output devices, and the like are omitted. In addition, the electronic device 500 may include any other suitable components depending on the particular application.
Embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, cause the processor to perform the page display method provided by the embodiments of the present disclosure.
The computer readable storage medium may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of a readable storage medium include an electrical link having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable medium may be included in the electronic device or may exist alone without being incorporated into the electronic device.
In an embodiment of the present disclosure, program code for performing the operations of the present disclosure may be written in one or more programming languages, including but not limited to an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of remote computers, the remote computer may be linked to the user's computer through any sort of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be linked to an external computer (for example, through the Internet using an Internet service provider).
The application discloses a method for preparing a composite material, which comprises the following steps:
a1, a page display method, wherein the method comprises the following steps:
acquiring a page file corresponding to a target page;
detecting whether a target object with a width to be replaced exists in a target page according to the page file;
if the target object exists in the target page, adjusting the target width parameter in the page file to be a target value, wherein the target width parameter is a parameter of the target object related to the width;
And displaying the target page based on the adjusted page file.
A2, the method according to claim A1, wherein detecting whether the target object with the width to be replaced exists in the target page according to the page file comprises the following steps:
detecting whether a first object with the percentage width larger than a preset percentage width threshold exists in the page file or not;
and if the first object exists in the page file, taking the first object as a target object.
A3. the method according to any of the claims A1-A2, wherein detecting whether there is a target object of width to be replaced in the target page based on the page file comprises:
detecting whether a second object with the outer margin being a negative margin value exists in the page file;
and if the second object exists in the page file, taking the second object as a target object.
A4, the method according to any one of claims A1-A3, wherein detecting whether a target object of a width to be replaced exists in the target page according to the page file comprises:
detecting whether a third object with the width of the object being larger than a preset width threshold exists in the page file;
And if the third object is detected to exist in the page file, taking the third object as a target object.
The method of claim A1, wherein prior to adjusting the target width parameter in the page file to the target value, the method further comprises:
Inputting the page file into a preset typesetting engine for typesetting to obtain a preset typesetting result;
and determining a target value corresponding to the target width parameter according to the pre-typesetting result.
A6, the method according to claim A5, wherein the target object is a first object with a percentage width larger than a preset percentage width threshold, and the target width parameter is a percentage width parameter;
wherein, according to the pre-typesetting result, determining the target value corresponding to the target width parameter comprises the following steps:
determining a first object content width value corresponding to the target object and a second object content width value corresponding to the object at the upper level of the target object according to the pre-typesetting result;
The ratio of the first object content width value to the second object content width value is taken as a target value.
The method according to claim A6, wherein determining, according to the pre-typesetting result, the first object content width value corresponding to the target object and the second object content width value corresponding to the object at the upper level of the target object includes:
acquiring a first typesetting width value of a target object, a first typesetting outer margin of the target object, a second typesetting width value of a previous level object and a second typesetting outer margin of the previous level object from a pre-typesetting result;
taking the difference value between the first typesetting width value and the first typesetting outer margin as a first object content width value;
and taking the difference value between the second typesetting width value and the second typesetting outer margin as a second object content width value.
A8, the method according to claim A5, wherein the target object is a second object with a negative margin value and the target width parameter is a margin pattern;
wherein, according to the pre-typesetting result, determining the target value corresponding to the target width parameter comprises the following steps:
obtaining a third typesetting margin of the target object from the pre-typesetting result;
and converting the unit format of the third typesetting outer margin into the original unit format of the target typesetting style to obtain a target value.
A9, the method according to claim A5, wherein the target object is a third object with an object width larger than a preset width threshold value, and the target width parameter is an object width pattern;
wherein, according to the pre-typesetting result, determining the target value corresponding to the target width parameter comprises the following steps:
Acquiring a screen width value and a third typesetting width value of the target object from the pre-typesetting result;
comparing the third typesetting width value with the screen width value to obtain the width ratio of the object screen;
Taking the product of the object screen width ratio and the preset height value as a target value.
A10, the method according to any of the claims A1-A9, wherein adjusting the target width parameter in the page file to the target value comprises:
and adjusting the target width pattern corresponding to the target width parameter in the page file from the original value to the target value.
B11, an electronic device, comprising a processor and a memory, the memory to store executable instructions that cause the processor to:
acquiring a page file corresponding to a target page;
detecting whether a target object with a width to be replaced exists in a target page according to the page file;
if the target object exists in the target page, adjusting the target width parameter in the page file to be a target value, wherein the target width parameter is a parameter of the target object related to the width;
And displaying the target page based on the adjusted page file.
B12, the electronic device of claim B11, wherein the executable instructions, when detecting from the pagefile whether there is a target object of the width to be replaced in the target page, specifically cause the processor to perform:
detecting whether a first object with the percentage width larger than a preset percentage width threshold exists in the page file or not;
and if the first object exists in the page file, taking the first object as a target object.
The electronic device of any of claims B11-B12, wherein the executable instructions, when detecting from the pagefile whether there is a target object in the target page of width to be replaced, specifically cause the processor to perform:
detecting whether a second object with the outer margin being a negative margin value exists in the page file;
and if the second object exists in the page file, taking the second object as a target object.
The electronic device of any of claims B11-B13, wherein the executable instructions, when detecting from the pagefile whether there is a target object in the target page of width to be replaced, specifically cause the processor to perform:
detecting whether a third object with the width of the object being larger than a preset width threshold exists in the page file;
And if the third object is detected to exist in the page file, taking the third object as a target object.
B15, the electronic device of claim B11, wherein the executable instructions further cause the processor to, prior to adjusting the target width parameter in the page file to the target value:
Inputting the page file into a preset typesetting engine for typesetting to obtain a preset typesetting result;
and determining a target value corresponding to the target width parameter according to the pre-typesetting result.
B16, the electronic device according to claim B15, wherein the target object is a first object whose percentage width is greater than a preset percentage width threshold, and the target width parameter is a percentage width parameter;
Wherein, when determining the target value corresponding to the target width parameter according to the pre-typesetting result, the executable instruction specifically causes the processor to execute:
determining a first object content width value corresponding to the target object and a second object content width value corresponding to the object at the upper level of the target object according to the pre-typesetting result;
The ratio of the first object content width value to the second object content width value is taken as a target value.
B17, the electronic device according to claim B16, wherein, when determining, according to the pre-typesetting result, the first object content width value corresponding to the target object and the second object content width value corresponding to the object at the upper level of the target object, the executable instructions specifically cause the processor to perform:
acquiring a first typesetting width value of a target object, a first typesetting outer margin of the target object, a second typesetting width value of a previous level object and a second typesetting outer margin of the previous level object from a pre-typesetting result;
taking the difference value between the first typesetting width value and the first typesetting outer margin as a first object content width value;
and taking the difference value between the second typesetting width value and the second typesetting outer margin as a second object content width value.
B18, the electronic device according to claim B15, wherein the target object is a second object whose outer margin is a negative margin value, and the target width parameter is an outer margin pattern;
Wherein, when determining the target value corresponding to the target width parameter according to the pre-typesetting result, the executable instruction specifically causes the processor to execute:
acquiring a first typesetting margin of a target object from a pre-typesetting result;
and converting the unit format of the third typesetting outer margin into the original unit format of the target typesetting style to obtain a target value.
B19, the electronic device according to claim B15, wherein the target object is a third object whose object width is greater than a preset width threshold, and the target width parameter is an object width pattern;
Wherein, when determining the target value corresponding to the target width parameter according to the pre-typesetting result, the executable instruction specifically causes the processor to execute:
Acquiring a screen width value and a first typesetting width value of a target object from a pre-typesetting result;
comparing the third typesetting width value with the screen width value to obtain the width ratio of the object screen;
Taking the product of the object screen width ratio and the preset height value as a target value.
B20, the electronic device of any one of claims B11-B19, wherein the executable instructions, when adjusting the target width parameter in the page file to the target value, specifically cause the processor to perform:
and adjusting the target width pattern corresponding to the target width parameter in the page file from the original value to the target value.
C21, a computer readable storage medium, wherein the storage medium stores a computer program which, when executed by a processor, causes the processor to implement the page display method using any of the preceding claims A1-a 10.
Various component embodiments of the present disclosure may be implemented in whole or in part in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that some or all of the functions of some or all of the components in an electronic device according to embodiments of the present disclosure may be implemented in practice using a microprocessor or Digital Signal Processor (DSP). The present disclosure may also be embodied as a device or apparatus program (e.g., computer program and computer program product) for performing a portion or all of the methods described herein. Such a program embodying the present disclosure may be stored on a computer readable medium, or may have 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.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (17)

1.一种页面显示方法,其特征在于,所述方法包括:1. A page display method, characterized in that the method comprises: 获取目标页面对应的页面文件;Get the page file corresponding to the target page; 根据所述页面文件检测所述目标页面中是否存在待替换宽度的目标对象;Detecting whether there is a target object with a width to be replaced in the target page according to the page file; 若检测到所述目标页面中存在所述目标对象,将所述页面文件中的目标宽度参数调整为目标值,所述目标宽度参数为所述目标对象的与宽度相关的参数;If it is detected that the target object exists in the target page, adjusting a target width parameter in the page file to a target value, the target width parameter being a parameter related to the width of the target object; 基于调整后的页面文件,显示所述目标页面;Based on the adjusted page file, display the target page; 其中,所述根据所述页面文件检测所述目标页面中是否存在待替换宽度的目标对象,包括:The step of detecting whether there is a target object with a width to be replaced in the target page according to the page file includes: 检测所述页面文件中是否存在百分比宽度大于预设百分比宽度阈值的第一对象;Detecting whether there is a first object in the page file with a percentage width greater than a preset percentage width threshold; 若检测到所述页面文件中存在所述第一对象,则将所述第一对象作为所述目标对象;If it is detected that the first object exists in the page file, taking the first object as the target object; 其中,在所述将所述页面文件中的目标宽度参数调整为目标值之前,所述方法还包括:Before adjusting the target width parameter in the page file to the target value, the method further includes: 将所述页面文件输入至预设排版引擎中进行预排版,得到预排版结果;Inputting the page file into a preset typesetting engine for pre-typesetting to obtain a pre-typesetting result; 根据所述预排版结果,确定所述目标宽度参数对应的所述目标值。The target value corresponding to the target width parameter is determined according to the pre-layout result. 2.根据权利要求1所述的方法,其特征在于,所述根据所述页面文件检测所述目标页面中是否存在待替换宽度的目标对象,包括:2. The method according to claim 1, characterized in that the step of detecting whether there is a target object of a width to be replaced in the target page according to the page file comprises: 检测所述页面文件中是否存在外边距为负边距值的第二对象;Detect whether there is a second object with a negative margin value in the page file; 若检测到所述页面文件中存在所述第二对象,则将所述第二对象作为所述目标对象。If it is detected that the second object exists in the page file, the second object is used as the target object. 3.根据权利要求1-2中任一项所述的方法,其特征在于,所述根据所述页面文件检测所述目标页面中是否存在待替换宽度的目标对象,包括:3. The method according to any one of claims 1 to 2, characterized in that the step of detecting whether there is a target object of a width to be replaced in the target page according to the page file comprises: 检测所述页面文件中是否存在对象宽度大于预设宽度阈值的第三对象;Detecting whether there is a third object in the page file whose object width is greater than a preset width threshold; 若检测到所述页面文件中存在所述第三对象,则将所述第三对象作为所述目标对象。If it is detected that the third object exists in the page file, the third object is used as the target object. 4.根据权利要求1所述的方法,其特征在于,所述目标对象为百分比宽度大于预设百分比宽度阈值的第一对象,所述目标宽度参数为百分比宽度参数;4. The method according to claim 1, characterized in that the target object is a first object whose percentage width is greater than a preset percentage width threshold, and the target width parameter is a percentage width parameter; 其中,所述根据所述预排版结果,确定所述目标宽度参数对应的所述目标值,包括:Wherein, determining the target value corresponding to the target width parameter according to the pre-typesetting result includes: 根据所述预排版结果,确定所述目标对象对应的第一对象内容宽度值和所述目标对象的上一级对象对应的第二对象内容宽度值;Determine, according to the pre-layout result, a first object content width value corresponding to the target object and a second object content width value corresponding to the parent object of the target object; 将所述第一对象内容宽度值与所述第二对象内容宽度值的比值作为所述目标值。The ratio of the first object content width value to the second object content width value is used as the target value. 5.根据权利要求4所述的方法,其特征在于,所述根据所述预排版结果,确定所述目标对象对应的第一对象内容宽度值和所述目标对象的上一级对象对应的第二对象内容宽度值,包括:5. The method according to claim 4, characterized in that the step of determining the first object content width value corresponding to the target object and the second object content width value corresponding to the parent object of the target object according to the pre-layout result comprises: 在所述预排版结果中获取所述目标对象的第一排版宽度值、所述目标对象的第一排版外边距、所述上一级对象的第二排版宽度值和所述上一级对象的第二排版外边距;Acquire the first typesetting width value of the target object, the first typesetting outer margin of the target object, the second typesetting width value of the upper-level object, and the second typesetting outer margin of the upper-level object in the pre-typesetting result; 将所述第一排版宽度值与所述第一排版外边距的差值作为所述第一对象内容宽度值;The difference between the first typesetting width value and the first typesetting outer margin is used as the first object content width value; 将所述第二排版宽度值与所述第二排版外边距的差值作为所述第二对象内容宽度值。The difference between the second layout width value and the second layout margin is used as the second object content width value. 6.根据权利要求1所述的方法,其特征在于,所述目标对象为外边距为负边距值的第二对象,所述目标宽度参数为外边距样式;6. The method according to claim 1, characterized in that the target object is a second object whose margin is a negative margin value, and the target width parameter is a margin style; 其中,所述根据所述预排版结果,确定所述目标宽度参数对应的所述目标值,包括:Wherein, determining the target value corresponding to the target width parameter according to the pre-typesetting result includes: 在所述预排版结果中获取所述目标对象的第三排版外边距;Obtaining the third layout outer margin of the target object in the pre-layout result; 将所述第三排版外边距的单位格式转换为目标排版样式的原始单位格式,得到所述目标值。The unit format of the third typesetting outer margin is converted into the original unit format of the target typesetting style to obtain the target value. 7.根据权利要求1所述的方法,其特征在于,所述目标对象为对象宽度大于预设宽度阈值的第三对象,所述目标宽度参数为对象宽度样式;7. The method according to claim 1, characterized in that the target object is a third object whose object width is greater than a preset width threshold, and the target width parameter is an object width pattern; 其中,所述根据所述预排版结果,确定所述目标宽度参数对应的所述目标值,包括:Wherein, determining the target value corresponding to the target width parameter according to the pre-typesetting result includes: 在所述预排版结果中获取屏幕宽度值和所述目标对象的第三排版宽度值;Obtaining a screen width value and a third layout width value of the target object in the pre-layout result; 将所述第三排版宽度值与所述屏幕宽度值相比,得到对象屏幕宽度占比;Compare the third layout width value with the screen width value to obtain the object screen width ratio; 将所述对象屏幕宽度占比与预设高度值的乘积作为所述目标值。The product of the object screen width ratio and the preset height value is used as the target value. 8.根据权利要求1-7中任一项所述的方法,其特征在于,所述将所述页面文件中的目标宽度参数调整为目标值,包括:8. The method according to any one of claims 1 to 7, characterized in that the step of adjusting the target width parameter in the page file to a target value comprises: 将所述页面文件中的所述目标宽度参数对应的目标宽度样式由原始值调整为所述目标值。The target width style corresponding to the target width parameter in the page file is adjusted from an original value to the target value. 9.一种电子设备,其特征在于,包括处理器和存储器,所述存储器用于存储可执行指令,所述可执行指令使所述处理器执行以下操作:9. An electronic device, comprising a processor and a memory, wherein the memory is used to store executable instructions, and the executable instructions enable the processor to perform the following operations: 获取目标页面对应的页面文件;Get the page file corresponding to the target page; 根据所述页面文件检测所述目标页面中是否存在待替换宽度的目标对象;Detecting whether there is a target object with a width to be replaced in the target page according to the page file; 若检测到所述目标页面中存在所述目标对象,将所述页面文件中的目标宽度参数调整为目标值,所述目标宽度参数为所述目标对象的与宽度相关的参数;If it is detected that the target object exists in the target page, adjusting a target width parameter in the page file to a target value, the target width parameter being a parameter related to the width of the target object; 基于调整后的页面文件,显示所述目标页面;Based on the adjusted page file, display the target page; 其中,在所述根据所述页面文件检测所述目标页面中是否存在待替换宽度的目标对象时,所述可执行指令具体使所述处理器执行:Wherein, when detecting whether there is a target object with a width to be replaced in the target page according to the page file, the executable instruction specifically causes the processor to execute: 检测所述页面文件中是否存在百分比宽度大于预设百分比宽度阈值的第一对象;Detecting whether there is a first object in the page file with a percentage width greater than a preset percentage width threshold; 若检测到所述页面文件中存在所述第一对象,则将所述第一对象作为所述目标对象;If it is detected that the first object exists in the page file, taking the first object as the target object; 其中,在所述将所述页面文件中的目标宽度参数调整为目标值之前,所述可执行指令还使所述处理器执行:Before adjusting the target width parameter in the page file to the target value, the executable instruction further causes the processor to execute: 将所述页面文件输入至预设排版引擎中进行预排版,得到预排版结果;Inputting the page file into a preset typesetting engine for pre-typesetting to obtain a pre-typesetting result; 根据所述预排版结果,确定所述目标宽度参数对应的所述目标值。The target value corresponding to the target width parameter is determined according to the pre-layout result. 10.根据权利要求9所述的电子设备,其特征在于,在所述根据所述页面文件检测所述目标页面中是否存在待替换宽度的目标对象时,所述可执行指令具体使所述处理器执行:10. The electronic device according to claim 9, wherein when detecting whether there is a target object with a width to be replaced in the target page according to the page file, the executable instruction specifically causes the processor to execute: 检测所述页面文件中是否存在外边距为负边距值的第二对象;Detect whether there is a second object with a negative margin value in the page file; 若检测到所述页面文件中存在所述第二对象,则将所述第二对象作为所述目标对象。If it is detected that the second object exists in the page file, the second object is used as the target object. 11.根据权利要求9-10中任一项所述的电子设备,其特征在于,在所述根据所述页面文件检测所述目标页面中是否存在待替换宽度的目标对象时,所述可执行指令具体使所述处理器执行:11. The electronic device according to any one of claims 9 to 10, characterized in that when detecting whether there is a target object with a width to be replaced in the target page according to the page file, the executable instruction specifically causes the processor to execute: 检测所述页面文件中是否存在对象宽度大于预设宽度阈值的第三对象;Detecting whether there is a third object in the page file whose object width is greater than a preset width threshold; 若检测到所述页面文件中存在所述第三对象,则将所述第三对象作为所述目标对象。If it is detected that the third object exists in the page file, the third object is used as the target object. 12.根据权利要求9所述的电子设备,其特征在于,所述目标对象为百分比宽度大于预设百分比宽度阈值的第一对象,所述目标宽度参数为百分比宽度参数;12. The electronic device according to claim 9, wherein the target object is a first object whose percentage width is greater than a preset percentage width threshold, and the target width parameter is a percentage width parameter; 其中,在所述根据所述预排版结果,确定所述目标宽度参数对应的所述目标值时,所述可执行指令具体使所述处理器执行:Wherein, when determining the target value corresponding to the target width parameter according to the pre-typesetting result, the executable instruction specifically causes the processor to execute: 根据所述预排版结果,确定所述目标对象对应的第一对象内容宽度值和所述目标对象的上一级对象对应的第二对象内容宽度值;Determine, according to the pre-layout result, a first object content width value corresponding to the target object and a second object content width value corresponding to the parent object of the target object; 将所述第一对象内容宽度值与所述第二对象内容宽度值的比值作为所述目标值。The ratio of the first object content width value to the second object content width value is used as the target value. 13.根据权利要求12所述的电子设备,其特征在于,在所述根据所述预排版结果,确定所述目标对象对应的第一对象内容宽度值和所述目标对象的上一级对象对应的第二对象内容宽度值时,所述可执行指令具体使所述处理器执行:13. The electronic device according to claim 12, wherein when determining the first object content width value corresponding to the target object and the second object content width value corresponding to the parent object of the target object according to the pre-typesetting result, the executable instruction specifically causes the processor to execute: 在所述预排版结果中获取所述目标对象的第一排版宽度值、所述目标对象的第一排版外边距、所述上一级对象的第二排版宽度值和所述上一级对象的第二排版外边距;Acquire the first typesetting width value of the target object, the first typesetting outer margin of the target object, the second typesetting width value of the upper-level object, and the second typesetting outer margin of the upper-level object in the pre-typesetting result; 将所述第一排版宽度值与所述第一排版外边距的差值作为所述第一对象内容宽度值;The difference between the first typesetting width value and the first typesetting outer margin is used as the first object content width value; 将所述第二排版宽度值与所述第二排版外边距的差值作为所述第二对象内容宽度值。The difference between the second layout width value and the second layout margin is used as the second object content width value. 14.根据权利要求9所述的电子设备,其特征在于,所述目标对象为外边距为负边距值的第二对象,所述目标宽度参数为外边距样式;14. The electronic device according to claim 9, wherein the target object is a second object whose margin is a negative margin value, and the target width parameter is a margin style; 其中,在所述根据所述预排版结果,确定所述目标宽度参数对应的所述目标值时,所述可执行指令具体使所述处理器执行:Wherein, when determining the target value corresponding to the target width parameter according to the pre-typesetting result, the executable instruction specifically causes the processor to execute: 在所述预排版结果中获取所述目标对象的第三排版外边距;Obtaining the third layout outer margin of the target object in the pre-layout result; 将所述第三排版外边距的单位格式转换为目标排版样式的原始单位格式,得到所述目标值。The unit format of the third typesetting outer margin is converted into the original unit format of the target typesetting style to obtain the target value. 15.根据权利要求9所述的电子设备,其特征在于,所述目标对象为对象宽度大于预设宽度阈值的第三对象,所述目标宽度参数为对象宽度样式;15. The electronic device according to claim 9, wherein the target object is a third object whose object width is greater than a preset width threshold, and the target width parameter is an object width pattern; 其中,在所述根据所述预排版结果,确定所述目标宽度参数对应的所述目标值时,所述可执行指令具体使所述处理器执行:Wherein, when determining the target value corresponding to the target width parameter according to the pre-typesetting result, the executable instruction specifically causes the processor to execute: 在所述预排版结果中获取屏幕宽度值和所述目标对象的第三排版宽度值;Obtaining a screen width value and a third layout width value of the target object in the pre-layout result; 将所述第三排版宽度值与所述屏幕宽度值相比,得到对象屏幕宽度占比;Compare the third layout width value with the screen width value to obtain the object screen width ratio; 将所述对象屏幕宽度占比与预设高度值的乘积作为所述目标值。The product of the object screen width ratio and the preset height value is used as the target value. 16.根据权利要求9-15中任一项所述的电子设备,其特征在于,在所述将所述页面文件中的目标宽度参数调整为目标值时,所述可执行指令具体使所述处理器执行:16. The electronic device according to any one of claims 9 to 15, characterized in that when the target width parameter in the page file is adjusted to a target value, the executable instruction specifically causes the processor to execute: 将所述页面文件中的所述目标宽度参数对应的目标宽度样式由原始值调整为所述目标值。The target width style corresponding to the target width parameter in the page file is adjusted from an original value to the target value. 17.一种计算机可读存储介质,其特征在于,所述存储介质存储有计算机程序,当所述计算机程序被处理器执行时,使得处理器实现用上述权利要求1-8中任一项所述的页面显示方法。17. A computer-readable storage medium, characterized in that the storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the page display method described in any one of claims 1 to 8.
CN202210470378.2A 2022-04-28 2022-04-28 Page display method, electronic device and storage medium Active CN115033814B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210470378.2A CN115033814B (en) 2022-04-28 2022-04-28 Page display method, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210470378.2A CN115033814B (en) 2022-04-28 2022-04-28 Page display method, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN115033814A CN115033814A (en) 2022-09-09
CN115033814B true CN115033814B (en) 2025-07-11

Family

ID=83119059

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210470378.2A Active CN115033814B (en) 2022-04-28 2022-04-28 Page display method, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN115033814B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119149849A (en) * 2023-06-16 2024-12-17 北京字跳网络技术有限公司 Page display method and device, electronic equipment and computer readable medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105975576A (en) * 2016-05-04 2016-09-28 北京京东尚科信息技术有限公司 Terminal content adaptive display method and device as well as terminal
CN109117210A (en) * 2017-06-22 2019-01-01 合网络技术(北京)有限公司 Page layout method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9703757B2 (en) * 2013-09-30 2017-07-11 Google Inc. Automatically determining a size for a content item for a web page
CN105224564B (en) * 2014-06-25 2019-02-15 广州市动景计算机科技有限公司 Method and device for web page adaptation to screen typesetting
CN107688557A (en) * 2016-08-03 2018-02-13 北大方正集团有限公司 Composition method, composing system and terminal
CN106776969A (en) * 2016-12-05 2017-05-31 乐视控股(北京)有限公司 Page adaptation method, device and electronic equipment
CN109597956A (en) * 2018-12-10 2019-04-09 北京字节跳动网络技术有限公司 Page display method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105975576A (en) * 2016-05-04 2016-09-28 北京京东尚科信息技术有限公司 Terminal content adaptive display method and device as well as terminal
CN109117210A (en) * 2017-06-22 2019-01-01 合网络技术(北京)有限公司 Page layout method and device

Also Published As

Publication number Publication date
CN115033814A (en) 2022-09-09

Similar Documents

Publication Publication Date Title
US8312388B2 (en) Information processing apparatus, information processing method and computer readable medium
US20200226133A1 (en) Knowledge map building system and method
US9177341B2 (en) Determining search relevance from user feedback
CN113421144B (en) A page display method, device, equipment, and storage medium
US10902254B2 (en) Converting a captured image of a layout to a structured document template
JP7386890B2 (en) Media annotation with product source links
US20130212498A1 (en) Selecting Content Within a Web Page
US20250238973A1 (en) Synthesizing visualizations for content collections
CN111385665A (en) Bullet screen information processing method, device, equipment and storage medium
US9521298B2 (en) Color management system
CN115033814B (en) Page display method, electronic device and storage medium
US8903817B1 (en) Determining search relevance from user feedback
CN115935049B (en) Artificial intelligence-based recommendation processing methods, devices, and electronic equipment
CN105190615A (en) Detection and visualization of schema-less data
CN108268488B (en) Webpage main graph identification method and device
CN113343137A (en) Optimized SEO page generation method and device, electronic equipment and storage medium
CN113762243A (en) Singing list processing method and device and electronic equipment
CN119760222A (en) Recommendation processing method, device, medium and program product of business component
Adorna et al. Developing a browser extension for the automated detection of deceptive patterns in cookie banners
CN105677696A (en) Retrieval apparatus and retrieval method
CN110515618A (en) Page information input optimization method, equipment, storage medium and device
JP4336813B2 (en) Image description system and method
CN114548037A (en) Multimedia information processing method and device, electronic equipment and storage medium
JP4692784B2 (en) Feature quantity selection program, feature quantity selection method and apparatus in image description system
CN112950167A (en) Design service matching method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant