Changeset 181898 in webkit
- Timestamp:
- Mar 24, 2015, 12:13:06 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
dom/Document.cpp (modified) (4 diffs)
-
dom/Document.h (modified) (2 diffs)
-
dom/Element.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r181897 r181898 1 2015-03-24 David Hyatt <hyatt@apple.com> 2 3 Improve the offsetWidth/Height layout optimization 4 https://bugs.webkit.org/show_bug.cgi?id=143008 5 6 Reviewed by Dean Jackson. 7 8 * dom/Document.cpp: 9 (WebCore::Document::updateLayoutIfDimensionsOutOfDate): 10 * dom/Document.h: 11 Change Element* to Element&. Clean up the dimension bits to use shifting. Remove both the inline and 12 the positioning restrictions on the optimization check. 13 14 * dom/Element.cpp: 15 (WebCore::Element::offsetWidth): 16 (WebCore::Element::offsetHeight): 17 Change to use Element& instead of Element*. 18 19 (WebCore::Element::clientWidth): 20 (WebCore::Element::clientHeight): 21 (WebCore::Element::scrollWidth): 22 (WebCore::Element::scrollHeight): 23 Turn on the optimization for clientWidth/Height and scrollWidth/Height. 24 1 25 2015-03-24 Yoav Weiss <yoav@yoav.ws> 2 26 -
trunk/Source/WebCore/dom/Document.cpp
r181838 r181898 1897 1897 } 1898 1898 1899 bool Document::updateLayoutIfDimensionsOutOfDate(Element *element, DimensionsCheck dimensionsCheck)1899 bool Document::updateLayoutIfDimensionsOutOfDate(Element& element, DimensionsCheck dimensionsCheck) 1900 1900 { 1901 1901 ASSERT(isMainThread()); … … 1921 1921 bool requireFullLayout = false; 1922 1922 if (HTMLFrameOwnerElement* owner = ownerElement()) { 1923 if (owner->document().updateLayoutIfDimensionsOutOfDate( owner))1923 if (owner->document().updateLayoutIfDimensionsOutOfDate(*owner)) 1924 1924 requireFullLayout = true; 1925 1925 } 1926 1926 1927 1927 updateStyleIfNeeded(); 1928 1929 RenderObject* renderer = element ->renderer();1928 1929 RenderObject* renderer = element.renderer(); 1930 1930 if (!renderer || renderer->needsLayout()) 1931 1931 requireFullLayout = true; … … 1941 1941 1942 1942 // Check our containing block chain. If anything in the chain needs a layout, then require a full layout. 1943 for (RenderObject* currRenderer = element ->renderer(); currRenderer && !currRenderer->isRenderView(); currRenderer = currRenderer->container()) {1943 for (RenderObject* currRenderer = element.renderer(); currRenderer && !currRenderer->isRenderView(); currRenderer = currRenderer->container()) { 1944 1944 1945 1945 // Require the entire container chain to be boxes. … … 1970 1970 } 1971 1971 1972 if (!currentBox->isRenderBlockFlow() || currentBox->isInline() || currentBox->isOutOfFlowPositioned() || currentBox->flowThreadContainingBlock() || currentBox->isWritingModeRoot()) { 1973 // FIXME: For now require only block-level non-positioned 1974 // block flows all the way back to the root. This limits the optimization 1972 if (!currentBox->isRenderBlockFlow() || currentBox->flowThreadContainingBlock() || currentBox->isWritingModeRoot()) { 1973 // FIXME: For now require only block flows all the way back to the root. This limits the optimization 1975 1974 // for now, and we'll expand it in future patches to apply to more and more scenarios. 1976 1975 // Disallow regions/columns from having the optimization. -
trunk/Source/WebCore/dom/Document.h
r181838 r181898 261 261 }; 262 262 263 enum DimensionsCheck { WidthDimensionsCheck = 0x1, HeightDimensionsCheck = 0x2, AllDimensionsCheck = 0x3};263 enum DimensionsCheck { WidthDimensionsCheck = 1 << 0, HeightDimensionsCheck = 1 << 1, AllDimensionsCheck = 1 << 2 }; 264 264 265 265 class Document : public ContainerNode, public TreeScope, public ScriptExecutionContext, public FontSelectorClient { … … 570 570 bool hasLivingRenderTree() const { return renderView() && !renderTreeBeingDestroyed(); } 571 571 572 bool updateLayoutIfDimensionsOutOfDate(Element *, DimensionsCheck = AllDimensionsCheck);572 bool updateLayoutIfDimensionsOutOfDate(Element&, DimensionsCheck = AllDimensionsCheck); 573 573 574 574 AXObjectCache* existingAXObjectCache() const; -
trunk/Source/WebCore/dom/Element.cpp
r181484 r181898 729 729 double Element::offsetWidth() 730 730 { 731 document().updateLayoutIfDimensionsOutOfDate( this, WidthDimensionsCheck);731 document().updateLayoutIfDimensionsOutOfDate(*this, WidthDimensionsCheck); 732 732 if (RenderBoxModelObject* renderer = renderBoxModelObject()) { 733 733 LayoutUnit offsetWidth = subpixelMetricsEnabled(renderer->document()) ? renderer->offsetWidth() : LayoutUnit(renderer->pixelSnappedOffsetWidth()); … … 739 739 double Element::offsetHeight() 740 740 { 741 document().updateLayoutIfDimensionsOutOfDate( this, HeightDimensionsCheck);741 document().updateLayoutIfDimensionsOutOfDate(*this, HeightDimensionsCheck); 742 742 if (RenderBoxModelObject* renderer = renderBoxModelObject()) { 743 743 LayoutUnit offsetHeight = subpixelMetricsEnabled(renderer->document()) ? renderer->offsetHeight() : LayoutUnit(renderer->pixelSnappedOffsetHeight()); … … 791 791 double Element::clientWidth() 792 792 { 793 document().updateLayoutI gnorePendingStylesheets();793 document().updateLayoutIfDimensionsOutOfDate(*this, WidthDimensionsCheck); 794 794 795 795 if (!document().hasLivingRenderTree()) … … 812 812 double Element::clientHeight() 813 813 { 814 document().updateLayoutIgnorePendingStylesheets(); 815 814 document().updateLayoutIfDimensionsOutOfDate(*this, HeightDimensionsCheck); 816 815 if (!document().hasLivingRenderTree()) 817 816 return 0; … … 873 872 int Element::scrollWidth() 874 873 { 875 document().updateLayoutI gnorePendingStylesheets();874 document().updateLayoutIfDimensionsOutOfDate(*this, WidthDimensionsCheck); 876 875 if (RenderBox* rend = renderBox()) 877 876 return adjustForAbsoluteZoom(rend->scrollWidth(), *rend); … … 881 880 int Element::scrollHeight() 882 881 { 883 document().updateLayoutI gnorePendingStylesheets();882 document().updateLayoutIfDimensionsOutOfDate(*this, HeightDimensionsCheck); 884 883 if (RenderBox* rend = renderBox()) 885 884 return adjustForAbsoluteZoom(rend->scrollHeight(), *rend);
Note:
See TracChangeset
for help on using the changeset viewer.