1. A method comprising: accessing, by a user device, data defining a document maintained at an online document processing service; identifying a plurality of elements within the document, the plurality of elements including a first paragraph and a second paragraph; generating a hierarchy of objects associated with the plurality of elements, the hierarchy of objects comprising a plurality of objects including a parent object, wherein generating a hierarchy of objects comprises: generating, for each of the plurality of elements, a respective object comprising a layout function and a render function, including a first object corresponding to the first paragraph and a second object corresponding to the second paragraph, the first object being different from the second object, wherein each of the first and second objects comprises: a programming class comprising one or more properties that define a first alphanumeric character of the corresponding paragraph and a last alphanumeric character of the corresponding paragraph; a layout function defining one or more calculations for determining a location of one or more lines in the corresponding paragraph and whether the corresponding paragraph can fit into an available page height; and a render function adapted to modify a HyperText Markup Language (“HTML”) of a webpage based on layout data associated with the corresponding paragraph; and generating a parent object adapted to determine a location of the document, determine an object corresponding to a particular one of the plurality of elements that is associated with the location, and invoke the determined object to lay out and render the particular one of the plurality of elements; determining, by the parent object, a selected location within the document; in response to determining the selected location: determining that the first paragraph and the second paragraph are associated with the selected location; invoking, by the parent object, the first object to generate first layout data associated with the first paragraph; invoking, by the parent object, the second object to generate second layout data associated with the second paragraph; rendering, by the first object, the first paragraph based on the first layout data; and rendering, by the second object, the second paragraph based on the second layout data.
1. A method comprising: accessing, by a user device, data defining a document maintained at an online document processing service; identifying a plurality of elements within the document, the plurality of elements including a first paragraph and a second paragraph; generating a hierarchy of objects associated with the plurality of elements, the hierarchy of objects comprising a plurality of objects including a parent object, wherein generating a hierarchy of objects comprises: generating, for each of the plurality of elements, a respective object comprising a layout function and a render function, including a first object corresponding to the first paragraph and a second object corresponding to the second paragraph, the first object being different from the second object, wherein each of the first and second objects comprises: a programming class comprising one or more properties that define a first alphanumeric character of the corresponding paragraph and a last alphanumeric character of the corresponding paragraph; a layout function defining one or more calculations for determining a location of one or more lines in the corresponding paragraph and whether the corresponding paragraph can fit into an available page height; and a render function adapted to modify a HyperText Markup Language (“HTML”) of a webpage based on layout data associated with the corresponding paragraph; and generating a parent object adapted to determine a location of the document, determine an object corresponding to a particular one of the plurality of elements that is associated with the location, and invoke the determined object to lay out and render the particular one of the plurality of elements; determining, by the parent object, a selected location within the document; in response to determining the selected location: determining that the first paragraph and the second paragraph are associated with the selected location; invoking, by the parent object, the first object to generate first layout data associated with the first paragraph; invoking, by the parent object, the second object to generate second layout data associated with the second paragraph; rendering, by the first object, the first paragraph based on the first layout data; and rendering, by the second object, the second paragraph based on the second layout data. 7. The method of claim 1 , further comprising: identifying a line of text within the first paragraph; and generating a line object corresponding to the line of text, the line object comprising a second layout function for laying out the line of text, wherein the first object and the line object function in a hierarchical relationship; the method further comprising: invoking, by the first object, the line object to lay out the line of text.