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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.h

Issue 2218003003: Fix integer overflow in FrameView::m_visuallyNonEmptyPixelCount (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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) 1997 Martin Jones (mjones@kde.org) 2 Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 (C) 1998 Waldo Bastian (bastian@kde.org) 3 (C) 1998 Waldo Bastian (bastian@kde.org)
4 (C) 1998, 1999 Torben Weis (weis@kde.org) 4 (C) 1998, 1999 Torben Weis (weis@kde.org)
5 (C) 1999 Lars Knoll (knoll@kde.org) 5 (C) 1999 Lars Knoll (knoll@kde.org)
6 (C) 1999 Antti Koivisto (koivisto@kde.org) 6 (C) 1999 Antti Koivisto (koivisto@kde.org)
7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 Color m_baseBackgroundColor; 817 Color m_baseBackgroundColor;
818 IntSize m_lastViewportSize; 818 IntSize m_lastViewportSize;
819 float m_lastZoomFactor; 819 float m_lastZoomFactor;
820 820
821 AtomicString m_mediaType; 821 AtomicString m_mediaType;
822 AtomicString m_mediaTypeWhenNotPrinting; 822 AtomicString m_mediaTypeWhenNotPrinting;
823 823
824 bool m_safeToPropagateScrollToParent; 824 bool m_safeToPropagateScrollToParent;
825 825
826 unsigned m_visuallyNonEmptyCharacterCount; 826 unsigned m_visuallyNonEmptyCharacterCount;
827 unsigned m_visuallyNonEmptyPixelCount; 827 uint64_t m_visuallyNonEmptyPixelCount;
828 bool m_isVisuallyNonEmpty; 828 bool m_isVisuallyNonEmpty;
829 829
830 Member<Node> m_fragmentAnchor; 830 Member<Node> m_fragmentAnchor;
831 831
832 // layoutObject to hold our custom scroll corner. 832 // layoutObject to hold our custom scroll corner.
833 LayoutScrollbarPart* m_scrollCorner; 833 LayoutScrollbarPart* m_scrollCorner;
834 834
835 Member<ScrollableAreaSet> m_scrollableAreas; 835 Member<ScrollableAreaSet> m_scrollableAreas;
836 Member<ScrollableAreaSet> m_animatingScrollableAreas; 836 Member<ScrollableAreaSet> m_animatingScrollableAreas;
837 std::unique_ptr<ResizerAreaSet> m_resizerAreas; 837 std::unique_ptr<ResizerAreaSet> m_resizerAreas;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 // The first few hundred characters rarely contain the interesting content o f the page. 945 // The first few hundred characters rarely contain the interesting content o f the page.
946 static const unsigned visualCharacterThreshold = 200; 946 static const unsigned visualCharacterThreshold = 200;
947 if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold) 947 if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold)
948 setIsVisuallyNonEmpty(); 948 setIsVisuallyNonEmpty();
949 } 949 }
950 950
951 inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size) 951 inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size)
952 { 952 {
953 if (m_isVisuallyNonEmpty) 953 if (m_isVisuallyNonEmpty)
954 return; 954 return;
955 m_visuallyNonEmptyPixelCount += size.width() * size.height(); 955 m_visuallyNonEmptyPixelCount += size.area();
956 // Use a threshold value to prevent very small amounts of visible content fr om triggering didMeaningfulLayout. 956 // Use a threshold value to prevent very small amounts of visible content fr om triggering didMeaningfulLayout.
957 static const unsigned visualPixelThreshold = 32 * 32; 957 static const unsigned visualPixelThreshold = 32 * 32;
958 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) 958 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold)
959 setIsVisuallyNonEmpty(); 959 setIsVisuallyNonEmpty();
960 } 960 }
961 961
962 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView()); 962 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView());
963 DEFINE_TYPE_CASTS(FrameView, ScrollableArea, scrollableArea, scrollableArea->isF rameView(), scrollableArea.isFrameView()); 963 DEFINE_TYPE_CASTS(FrameView, ScrollableArea, scrollableArea, scrollableArea->isF rameView(), scrollableArea.isFrameView());
964 964
965 } // namespace blink 965 } // namespace blink
966 966
967 #endif // FrameView_h 967 #endif // FrameView_h
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