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

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

Issue 1899193007: Remove special-code for paginating floats followed by lines of text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 19 matching lines...) Expand all
30 30
31 #include <algorithm> 31 #include <algorithm>
32 32
33 using namespace WTF; 33 using namespace WTF;
34 34
35 namespace blink { 35 namespace blink {
36 36
37 struct SameSizeAsFloatingObject { 37 struct SameSizeAsFloatingObject {
38 void* pointers[2]; 38 void* pointers[2];
39 LayoutRect rect; 39 LayoutRect rect;
40 int paginationStrut;
41 uint32_t bitfields : 8; 40 uint32_t bitfields : 8;
42 }; 41 };
43 42
44 static_assert(sizeof(FloatingObject) == sizeof(SameSizeAsFloatingObject), "Float ingObject should stay small"); 43 static_assert(sizeof(FloatingObject) == sizeof(SameSizeAsFloatingObject), "Float ingObject should stay small");
45 44
46 FloatingObject::FloatingObject(LayoutBox* layoutObject) 45 FloatingObject::FloatingObject(LayoutBox* layoutObject)
47 : m_layoutObject(layoutObject) 46 : m_layoutObject(layoutObject)
48 , m_originatingLine(nullptr) 47 , m_originatingLine(nullptr)
49 , m_paginationStrut(0)
50 , m_shouldPaint(true) 48 , m_shouldPaint(true)
51 , m_isDescendant(false) 49 , m_isDescendant(false)
52 , m_isPlaced(false) 50 , m_isPlaced(false)
53 , m_isLowestNonOverhangingFloatInChild(false) 51 , m_isLowestNonOverhangingFloatInChild(false)
54 #if ENABLE(ASSERT) 52 #if ENABLE(ASSERT)
55 , m_isInPlacedTree(false) 53 , m_isInPlacedTree(false)
56 #endif 54 #endif
57 { 55 {
58 EFloat type = layoutObject->style()->floating(); 56 EFloat type = layoutObject->style()->floating();
59 ASSERT(type != NoFloat); 57 ASSERT(type != NoFloat);
60 if (type == LeftFloat) 58 if (type == LeftFloat)
61 m_type = FloatLeft; 59 m_type = FloatLeft;
62 else if (type == RightFloat) 60 else if (type == RightFloat)
63 m_type = FloatRight; 61 m_type = FloatRight;
64 } 62 }
65 63
66 FloatingObject::FloatingObject(LayoutBox* layoutObject, Type type, const LayoutR ect& frameRect, bool shouldPaint, bool isDescendant, bool isLowestNonOverhanging FloatInChild) 64 FloatingObject::FloatingObject(LayoutBox* layoutObject, Type type, const LayoutR ect& frameRect, bool shouldPaint, bool isDescendant, bool isLowestNonOverhanging FloatInChild)
67 : m_layoutObject(layoutObject) 65 : m_layoutObject(layoutObject)
68 , m_originatingLine(nullptr) 66 , m_originatingLine(nullptr)
69 , m_frameRect(frameRect) 67 , m_frameRect(frameRect)
70 , m_paginationStrut(0)
71 , m_type(type) 68 , m_type(type)
72 , m_shouldPaint(shouldPaint) 69 , m_shouldPaint(shouldPaint)
73 , m_isDescendant(isDescendant) 70 , m_isDescendant(isDescendant)
74 , m_isPlaced(true) 71 , m_isPlaced(true)
75 , m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild) 72 , m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild)
76 #if ENABLE(ASSERT) 73 #if ENABLE(ASSERT)
77 , m_isInPlacedTree(false) 74 , m_isInPlacedTree(false)
78 #endif 75 #endif
79 { 76 {
80 } 77 }
81 78
82 PassOwnPtr<FloatingObject> FloatingObject::create(LayoutBox* layoutObject) 79 PassOwnPtr<FloatingObject> FloatingObject::create(LayoutBox* layoutObject)
83 { 80 {
84 OwnPtr<FloatingObject> newObj = adoptPtr(new FloatingObject(layoutObject)); 81 OwnPtr<FloatingObject> newObj = adoptPtr(new FloatingObject(layoutObject));
85 newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer()); // If a layer exists, the float will paint itself. Otherwise someone else will. 82 newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer()); // If a layer exists, the float will paint itself. Otherwise someone else will.
86 newObj->setIsDescendant(true); 83 newObj->setIsDescendant(true);
87 84
88 return newObj.release(); 85 return newObj.release();
89 } 86 }
90 87
91 PassOwnPtr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset, bool shouldPaint, bool isDescendant) const 88 PassOwnPtr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset, bool shouldPaint, bool isDescendant) const
92 { 89 {
93 return adoptPtr(new FloatingObject(layoutObject(), getType(), LayoutRect(fra meRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, is LowestNonOverhangingFloatInChild())); 90 return adoptPtr(new FloatingObject(layoutObject(), getType(), LayoutRect(fra meRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, is LowestNonOverhangingFloatInChild()));
94 } 91 }
95 92
96 PassOwnPtr<FloatingObject> FloatingObject::unsafeClone() const 93 PassOwnPtr<FloatingObject> FloatingObject::unsafeClone() const
97 { 94 {
98 OwnPtr<FloatingObject> cloneObject = adoptPtr(new FloatingObject(layoutObjec t(), getType(), m_frameRect, m_shouldPaint, m_isDescendant, false)); 95 OwnPtr<FloatingObject> cloneObject = adoptPtr(new FloatingObject(layoutObjec t(), getType(), m_frameRect, m_shouldPaint, m_isDescendant, false));
99 cloneObject->m_paginationStrut = m_paginationStrut;
100 cloneObject->m_isPlaced = m_isPlaced; 96 cloneObject->m_isPlaced = m_isPlaced;
101 return cloneObject.release(); 97 return cloneObject.release();
102 } 98 }
103 99
104 template <FloatingObject::Type FloatTypeValue> 100 template <FloatingObject::Type FloatTypeValue>
105 class ComputeFloatOffsetAdapter { 101 class ComputeFloatOffsetAdapter {
106 public: 102 public:
107 typedef FloatingObjectInterval IntervalType; 103 typedef FloatingObjectInterval IntervalType;
108 104
109 ComputeFloatOffsetAdapter(const LayoutBlockFlow* layoutObject, LayoutUnit li neTop, LayoutUnit lineBottom, LayoutUnit offset) 105 ComputeFloatOffsetAdapter(const LayoutBlockFlow* layoutObject, LayoutUnit li neTop, LayoutUnit lineBottom, LayoutUnit offset)
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 } 618 }
623 619
624 String ValueToString<FloatingObject*>::toString(const FloatingObject* floatingOb ject) 620 String ValueToString<FloatingObject*>::toString(const FloatingObject* floatingOb ject)
625 { 621 {
626 return String::format("%p (%gx%g %gx%g)", floatingObject, floatingObject->fr ameRect().x().toFloat(), floatingObject->frameRect().y().toFloat(), floatingObje ct->frameRect().maxX().toFloat(), floatingObject->frameRect().maxY().toFloat()); 622 return String::format("%p (%gx%g %gx%g)", floatingObject, floatingObject->fr ameRect().x().toFloat(), floatingObject->frameRect().y().toFloat(), floatingObje ct->frameRect().maxX().toFloat(), floatingObject->frameRect().maxY().toFloat());
627 } 623 }
628 #endif 624 #endif
629 625
630 626
631 } // namespace blink 627 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/FloatingObjects.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698