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

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

Issue 2148043003: [Layout API] Fix layoutViewItem() null check in Element.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | 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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 return 0; 682 return 0;
683 } 683 }
684 684
685 int Element::clientWidth() 685 int Element::clientWidth()
686 { 686 {
687 // When in strict mode, clientWidth for the document element should return t he width of the containing frame. 687 // When in strict mode, clientWidth for the document element should return t he width of the containing frame.
688 // When in quirks mode, clientWidth for the body element should return the w idth of the containing frame. 688 // When in quirks mode, clientWidth for the body element should return the w idth of the containing frame.
689 bool inQuirksMode = document().inQuirksMode(); 689 bool inQuirksMode = document().inQuirksMode();
690 if ((!inQuirksMode && document().documentElement() == this) 690 if ((!inQuirksMode && document().documentElement() == this)
691 || (inQuirksMode && isHTMLElement() && document().body() == this)) { 691 || (inQuirksMode && isHTMLElement() && document().body() == this)) {
692 if (LayoutViewItem layoutView = LayoutViewItem(document().layoutView())) { 692 LayoutViewItem layoutView = document().layoutViewItem();
693 if (!layoutView.isNull()) {
693 if (!RuntimeEnabledFeatures::overlayScrollbarsEnabled() || !document ().frame()->isLocalRoot()) 694 if (!RuntimeEnabledFeatures::overlayScrollbarsEnabled() || !document ().frame()->isLocalRoot())
694 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(t his); 695 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(t his);
695 if (document().page()->settings().forceZeroLayoutHeight()) 696 if (document().page()->settings().forceZeroLayoutHeight())
696 return adjustLayoutUnitForAbsoluteZoom(layoutView.overflowClipRe ct(LayoutPoint()).width(), layoutView.styleRef()).round(); 697 return adjustLayoutUnitForAbsoluteZoom(layoutView.overflowClipRe ct(LayoutPoint()).width(), layoutView.styleRef()).round();
697 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutView.layoutS ize().width()), layoutView.styleRef()).round(); 698 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutView.layoutS ize().width()), layoutView.styleRef()).round();
698 } 699 }
699 } 700 }
700 701
701 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); 702 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
702 703
703 if (LayoutBox* layoutObject = layoutBox()) 704 if (LayoutBox* layoutObject = layoutBox())
704 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedClientWidth()), layoutObject->styleRef()).round(); 705 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedClientWidth()), layoutObject->styleRef()).round();
705 return 0; 706 return 0;
706 } 707 }
707 708
708 int Element::clientHeight() 709 int Element::clientHeight()
709 { 710 {
710 // When in strict mode, clientHeight for the document element should return the height of the containing frame. 711 // When in strict mode, clientHeight for the document element should return the height of the containing frame.
711 // When in quirks mode, clientHeight for the body element should return the height of the containing frame. 712 // When in quirks mode, clientHeight for the body element should return the height of the containing frame.
712 bool inQuirksMode = document().inQuirksMode(); 713 bool inQuirksMode = document().inQuirksMode();
713 714
714 if ((!inQuirksMode && document().documentElement() == this) 715 if ((!inQuirksMode && document().documentElement() == this)
715 || (inQuirksMode && isHTMLElement() && document().body() == this)) { 716 || (inQuirksMode && isHTMLElement() && document().body() == this)) {
716 if (LayoutViewItem layoutView = LayoutViewItem(document().layoutView())) { 717 LayoutViewItem layoutView = document().layoutViewItem();
718 if (!layoutView.isNull()) {
717 if (!RuntimeEnabledFeatures::overlayScrollbarsEnabled() || !document ().frame()->isLocalRoot()) 719 if (!RuntimeEnabledFeatures::overlayScrollbarsEnabled() || !document ().frame()->isLocalRoot())
718 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(t his); 720 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(t his);
719 if (document().page()->settings().forceZeroLayoutHeight()) 721 if (document().page()->settings().forceZeroLayoutHeight())
720 return adjustLayoutUnitForAbsoluteZoom(layoutView.overflowClipRe ct(LayoutPoint()).height(), layoutView.styleRef()).round(); 722 return adjustLayoutUnitForAbsoluteZoom(layoutView.overflowClipRe ct(LayoutPoint()).height(), layoutView.styleRef()).round();
721 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutView.layoutS ize().height()), layoutView.styleRef()).round(); 723 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutView.layoutS ize().height()), layoutView.styleRef()).round();
722 } 724 }
723 } 725 }
724 726
725 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); 727 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
726 728
(...skipping 3016 matching lines...) Expand 10 before | Expand all | Expand 10 after
3743 3745
3744 DEFINE_TRACE_WRAPPERS(Element) 3746 DEFINE_TRACE_WRAPPERS(Element)
3745 { 3747 {
3746 if (hasRareData()) { 3748 if (hasRareData()) {
3747 visitor->traceWrappers(elementRareData()); 3749 visitor->traceWrappers(elementRareData());
3748 } 3750 }
3749 ContainerNode::traceWrappers(visitor); 3751 ContainerNode::traceWrappers(visitor);
3750 } 3752 }
3751 3753
3752 } // namespace blink 3754 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698