Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 1935043002: Avoid style recalc and layout when not necessary for client size. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Skip layout for local frame roots only Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/root-client-size-iframe-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 { 663 {
664 document().updateLayoutIgnorePendingStylesheetsForNode(this); 664 document().updateLayoutIgnorePendingStylesheetsForNode(this);
665 665
666 if (LayoutBox* layoutObject = layoutBox()) 666 if (LayoutBox* layoutObject = layoutBox())
667 return adjustLayoutUnitForAbsoluteZoom(layoutObject->clientTop(), layout Object->styleRef()).round(); 667 return adjustLayoutUnitForAbsoluteZoom(layoutObject->clientTop(), layout Object->styleRef()).round();
668 return 0; 668 return 0;
669 } 669 }
670 670
671 int Element::clientWidth() 671 int Element::clientWidth()
672 { 672 {
673 document().updateLayoutIgnorePendingStylesheetsForNode(this);
674
675 // When in strict mode, clientWidth for the document element should return t he width of the containing frame. 673 // When in strict mode, clientWidth for the document element should return t he width of the containing frame.
676 // When in quirks mode, clientWidth for the body element should return the w idth of the containing frame. 674 // When in quirks mode, clientWidth for the body element should return the w idth of the containing frame.
677 bool inQuirksMode = document().inQuirksMode(); 675 bool inQuirksMode = document().inQuirksMode();
678 if ((!inQuirksMode && document().documentElement() == this) 676 if ((!inQuirksMode && document().documentElement() == this)
679 || (inQuirksMode && isHTMLElement() && document().body() == this)) { 677 || (inQuirksMode && isHTMLElement() && document().body() == this)) {
680 if (LayoutViewItem layoutView = LayoutViewItem(document().layoutView())) { 678 if (LayoutViewItem layoutView = LayoutViewItem(document().layoutView())) {
679 if (!RuntimeEnabledFeatures::overlayScrollbarsEnabled() || !document ().frame()->isLocalRoot())
680 document().updateLayoutIgnorePendingStylesheetsForNode(this);
681 if (document().page()->settings().forceZeroLayoutHeight()) 681 if (document().page()->settings().forceZeroLayoutHeight())
682 return adjustLayoutUnitForAbsoluteZoom(layoutView.overflowClipRe ct(LayoutPoint()).width(), layoutView.styleRef()).round(); 682 return adjustLayoutUnitForAbsoluteZoom(layoutView.overflowClipRe ct(LayoutPoint()).width(), layoutView.styleRef()).round();
683 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutView.layoutS ize().width()), layoutView.styleRef()).round(); 683 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutView.layoutS ize().width()), layoutView.styleRef()).round();
684 } 684 }
685 } 685 }
686 686
687 document().updateLayoutIgnorePendingStylesheetsForNode(this);
688
687 if (LayoutBox* layoutObject = layoutBox()) 689 if (LayoutBox* layoutObject = layoutBox())
688 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedClientWidth()), layoutObject->styleRef()).round(); 690 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedClientWidth()), layoutObject->styleRef()).round();
689 return 0; 691 return 0;
690 } 692 }
691 693
692 int Element::clientHeight() 694 int Element::clientHeight()
693 { 695 {
694 document().updateLayoutIgnorePendingStylesheetsForNode(this);
695
696 // When in strict mode, clientHeight for the document element should return the height of the containing frame. 696 // When in strict mode, clientHeight for the document element should return the height of the containing frame.
697 // When in quirks mode, clientHeight for the body element should return the height of the containing frame. 697 // When in quirks mode, clientHeight for the body element should return the height of the containing frame.
698 bool inQuirksMode = document().inQuirksMode(); 698 bool inQuirksMode = document().inQuirksMode();
699 699
700 if ((!inQuirksMode && document().documentElement() == this) 700 if ((!inQuirksMode && document().documentElement() == this)
701 || (inQuirksMode && isHTMLElement() && document().body() == this)) { 701 || (inQuirksMode && isHTMLElement() && document().body() == this)) {
702 if (LayoutViewItem layoutView = LayoutViewItem(document().layoutView())) { 702 if (LayoutViewItem layoutView = LayoutViewItem(document().layoutView())) {
703 if (!RuntimeEnabledFeatures::overlayScrollbarsEnabled() || !document ().frame()->isLocalRoot())
704 document().updateLayoutIgnorePendingStylesheetsForNode(this);
703 if (document().page()->settings().forceZeroLayoutHeight()) 705 if (document().page()->settings().forceZeroLayoutHeight())
704 return adjustLayoutUnitForAbsoluteZoom(layoutView.overflowClipRe ct(LayoutPoint()).height(), layoutView.styleRef()).round(); 706 return adjustLayoutUnitForAbsoluteZoom(layoutView.overflowClipRe ct(LayoutPoint()).height(), layoutView.styleRef()).round();
705 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutView.layoutS ize().height()), layoutView.styleRef()).round(); 707 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutView.layoutS ize().height()), layoutView.styleRef()).round();
706 } 708 }
707 } 709 }
708 710
711 document().updateLayoutIgnorePendingStylesheetsForNode(this);
712
709 if (LayoutBox* layoutObject = layoutBox()) 713 if (LayoutBox* layoutObject = layoutBox())
710 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedClientHeight()), layoutObject->styleRef()).round(); 714 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedClientHeight()), layoutObject->styleRef()).round();
711 return 0; 715 return 0;
712 } 716 }
713 717
714 double Element::scrollLeft() 718 double Element::scrollLeft()
715 { 719 {
716 document().updateLayoutIgnorePendingStylesheetsForNode(this); 720 document().updateLayoutIgnorePendingStylesheetsForNode(this);
717 721
718 if (document().scrollingElement() == this) { 722 if (document().scrollingElement() == this) {
(...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after
3695 3699
3696 DEFINE_TRACE(Element) 3700 DEFINE_TRACE(Element)
3697 { 3701 {
3698 if (hasRareData()) 3702 if (hasRareData())
3699 visitor->trace(elementRareData()); 3703 visitor->trace(elementRareData());
3700 visitor->trace(m_elementData); 3704 visitor->trace(m_elementData);
3701 ContainerNode::trace(visitor); 3705 ContainerNode::trace(visitor);
3702 } 3706 }
3703 3707
3704 } // namespace blink 3708 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/root-client-size-iframe-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698