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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2261663002: Disallow cast/implicit conversion from LayoutUnit to int/unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 3 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
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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
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 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 { 753 {
754 if (!size().isEmpty()) 754 if (!size().isEmpty())
755 rects.append(LayoutRect(layerOffset, size())); 755 rects.append(LayoutRect(layerOffset, size()));
756 } 756 }
757 757
758 int LayoutBox::reflectionOffset() const 758 int LayoutBox::reflectionOffset() const
759 { 759 {
760 if (!style()->boxReflect()) 760 if (!style()->boxReflect())
761 return 0; 761 return 0;
762 if (style()->boxReflect()->direction() == ReflectionLeft || style()->boxRefl ect()->direction() == ReflectionRight) 762 if (style()->boxReflect()->direction() == ReflectionLeft || style()->boxRefl ect()->direction() == ReflectionRight)
763 return valueForLength(style()->boxReflect()->offset(), borderBoxRect().w idth()); 763 return valueForLength(style()->boxReflect()->offset(), borderBoxRect().w idth()).toInt();
764 return valueForLength(style()->boxReflect()->offset(), borderBoxRect().heigh t()); 764 return valueForLength(style()->boxReflect()->offset(), borderBoxRect().heigh t()).toInt();
765 } 765 }
766 766
767 LayoutRect LayoutBox::reflectedRect(const LayoutRect& r) const 767 LayoutRect LayoutBox::reflectedRect(const LayoutRect& r) const
768 { 768 {
769 if (!style()->boxReflect()) 769 if (!style()->boxReflect())
770 return LayoutRect(); 770 return LayoutRect();
771 771
772 LayoutRect box = borderBoxRect(); 772 LayoutRect box = borderBoxRect();
773 LayoutRect result = r; 773 LayoutRect result = r;
774 switch (style()->boxReflect()->direction()) { 774 switch (style()->boxReflect()->direction()) {
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 isVisible = viewBounds.contains(objectBounds); 1551 isVisible = viewBounds.contains(objectBounds);
1552 1552
1553 LayoutRect screenRect; 1553 LayoutRect screenRect;
1554 if (!objectBounds.isEmpty()) { 1554 if (!objectBounds.isEmpty()) {
1555 screenRect = viewBounds; 1555 screenRect = viewBounds;
1556 screenRect.intersect(objectBounds); 1556 screenRect.intersect(objectBounds);
1557 } 1557 }
1558 1558
1559 int screenArea = 0; 1559 int screenArea = 0;
1560 if (!screenRect.isEmpty() && isVisible) 1560 if (!screenRect.isEmpty() && isVisible)
1561 screenArea = static_cast<uint32_t>(screenRect.width() * screenRect.heigh t()); 1561 screenArea = (screenRect.width() * screenRect.height()).toInt();
1562 return ResourcePriority(isVisible ? ResourcePriority::Visible : ResourcePrio rity::NotVisible, screenArea); 1562 return ResourcePriority(isVisible ? ResourcePriority::Visible : ResourcePrio rity::NotVisible, screenArea);
1563 } 1563 }
1564 1564
1565 void LayoutBox::frameRectChanged() 1565 void LayoutBox::frameRectChanged()
1566 { 1566 {
1567 if (node() && node()->isElementNode()) { 1567 if (node() && node()->isElementNode()) {
1568 Element& element = toElement(*node()); 1568 Element& element = toElement(*node());
1569 element.setNeedsResizeObserverUpdate(); 1569 element.setNeedsResizeObserverUpdate();
1570 } 1570 }
1571 // The frame rect may change because of layout of other objects. 1571 // The frame rect may change because of layout of other objects.
(...skipping 3259 matching lines...) Expand 10 before | Expand all | Expand 10 after
4831 m_rareData->m_snapAreas->remove(&snapArea); 4831 m_rareData->m_snapAreas->remove(&snapArea);
4832 } 4832 }
4833 } 4833 }
4834 4834
4835 SnapAreaSet* LayoutBox::snapAreas() const 4835 SnapAreaSet* LayoutBox::snapAreas() const
4836 { 4836 {
4837 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4837 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4838 } 4838 }
4839 4839
4840 } // namespace blink 4840 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutButton.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698