WebCore::LayoutRect rect1(10, 10, 50, 50); WebCore::LayoutRect rect2(20, 20, 70, 70); WebCore::LayoutRect unitedRect = rect1.unite(rect2);
WebCore::LayoutRect rect1(0, 0, 100, 100); WebCore::LayoutRect rect2(-50, -50, 50, 50); WebCore::LayoutRect unitedRect = rect1.unite(rect2);In this example, rect1 and rect2 are situated such that rect2 overlaps with the top-left corner of rect1. The resulting unitedRect will encompass both rectangles, resulting in a rectangle with a position of (-50, -50), a width of 150, and a height of 150. Overall, LayoutRect unite is a useful function for combining two LayoutRect objects into a single encompassing rectangle, and is part of the WebCore namespace in the WebKit library.