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

Side by Side Diff: Source/core/layout/LayoutBlockFlow.cpp

Issue 1317143005: [WIP] do something :-) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « Source/core/layout/LayoutBlock.cpp ('k') | Source/core/layout/LayoutInline.cpp » ('j') | 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "core/layout/line/LineWidth.h" 50 #include "core/layout/line/LineWidth.h"
51 #include "core/layout/shapes/ShapeOutsideInfo.h" 51 #include "core/layout/shapes/ShapeOutsideInfo.h"
52 #include "core/paint/BlockFlowPainter.h" 52 #include "core/paint/BlockFlowPainter.h"
53 #include "core/paint/ClipScope.h" 53 #include "core/paint/ClipScope.h"
54 #include "core/paint/DeprecatedPaintLayer.h" 54 #include "core/paint/DeprecatedPaintLayer.h"
55 #include "core/paint/LayoutObjectDrawingRecorder.h" 55 #include "core/paint/LayoutObjectDrawingRecorder.h"
56 #include "core/paint/PaintInfo.h" 56 #include "core/paint/PaintInfo.h"
57 #include "platform/RuntimeEnabledFeatures.h" 57 #include "platform/RuntimeEnabledFeatures.h"
58 #include "platform/geometry/TransformState.h" 58 #include "platform/geometry/TransformState.h"
59 #include "platform/text/BidiTextRun.h" 59 #include "platform/text/BidiTextRun.h"
60 #include "wtf/SizeAssertions.h"
60 61
61 namespace blink { 62 namespace blink {
62 63
64 ASSERT_SIZE(LayoutBlockFlow::MarginValues, 16, 16);
65
63 bool LayoutBlockFlow::s_canPropagateFloatIntoSibling = false; 66 bool LayoutBlockFlow::s_canPropagateFloatIntoSibling = false;
64 67
65 struct SameSizeAsMarginInfo {
66 uint16_t bitfields;
67 LayoutUnit margins[2];
68 };
69
70 static_assert(sizeof(LayoutBlockFlow::MarginValues) == sizeof(LayoutUnit[4]), "M arginValues should stay small");
71
72 class MarginInfo { 68 class MarginInfo {
73 // Collapsing flags for whether we can collapse our margins with our childre n's margins. 69 // Collapsing flags for whether we can collapse our margins with our childre n's margins.
74 bool m_canCollapseWithChildren : 1; 70 bool m_canCollapseWithChildren : 1;
75 bool m_canCollapseMarginBeforeWithChildren : 1; 71 bool m_canCollapseMarginBeforeWithChildren : 1;
76 bool m_canCollapseMarginAfterWithChildren : 1; 72 bool m_canCollapseMarginAfterWithChildren : 1;
77 bool m_canCollapseMarginAfterWithLastChild: 1; 73 bool m_canCollapseMarginAfterWithLastChild: 1;
78 74
79 // Whether or not we are a quirky container, i.e., do we collapse away top a nd bottom 75 // Whether or not we are a quirky container, i.e., do we collapse away top a nd bottom
80 // margins in our container. Table cells and the body are the common example s. We 76 // margins in our container. Table cells and the body are the common example s. We
81 // also have a custom style property for Safari RSS to deal with TypePad blo g articles. 77 // also have a custom style property for Safari RSS to deal with TypePad blo g articles.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 bool determinedMarginBeforeQuirk() const { return m_determinedMarginBeforeQu irk; } 142 bool determinedMarginBeforeQuirk() const { return m_determinedMarginBeforeQu irk; }
147 bool hasMarginBeforeQuirk() const { return m_hasMarginBeforeQuirk; } 143 bool hasMarginBeforeQuirk() const { return m_hasMarginBeforeQuirk; }
148 bool hasMarginAfterQuirk() const { return m_hasMarginAfterQuirk; } 144 bool hasMarginAfterQuirk() const { return m_hasMarginAfterQuirk; }
149 LayoutUnit positiveMargin() const { return m_positiveMargin; } 145 LayoutUnit positiveMargin() const { return m_positiveMargin; }
150 LayoutUnit negativeMargin() const { return m_negativeMargin; } 146 LayoutUnit negativeMargin() const { return m_negativeMargin; }
151 bool discardMargin() const { return m_discardMargin; } 147 bool discardMargin() const { return m_discardMargin; }
152 LayoutUnit margin() const { return m_positiveMargin - m_negativeMargin; } 148 LayoutUnit margin() const { return m_positiveMargin - m_negativeMargin; }
153 void setLastChildIsSelfCollapsingBlockWithClearance(bool value) { m_lastChil dIsSelfCollapsingBlockWithClearance = value; } 149 void setLastChildIsSelfCollapsingBlockWithClearance(bool value) { m_lastChil dIsSelfCollapsingBlockWithClearance = value; }
154 bool lastChildIsSelfCollapsingBlockWithClearance() const { return m_lastChil dIsSelfCollapsingBlockWithClearance; } 150 bool lastChildIsSelfCollapsingBlockWithClearance() const { return m_lastChil dIsSelfCollapsingBlockWithClearance; }
155 }; 151 };
152
153 ASSERT_SIZE(MarginInfo, 12, 12);
154
156 static bool inNormalFlow(LayoutBox* child) 155 static bool inNormalFlow(LayoutBox* child)
157 { 156 {
158 LayoutBlock* curr = child->containingBlock(); 157 LayoutBlock* curr = child->containingBlock();
159 LayoutView* layoutView = child->view(); 158 LayoutView* layoutView = child->view();
160 while (curr && curr != layoutView) { 159 while (curr && curr != layoutView) {
161 if (curr->isLayoutFlowThread()) 160 if (curr->isLayoutFlowThread())
162 return true; 161 return true;
163 if (curr->isFloatingOrOutOfFlowPositioned()) 162 if (curr->isFloatingOrOutOfFlowPositioned())
164 return false; 163 return false;
165 curr = curr->containingBlock(); 164 curr = curr->containingBlock();
166 } 165 }
167 return true; 166 return true;
168 } 167 }
169 168
170 LayoutBlockFlow::LayoutBlockFlow(ContainerNode* node) 169 LayoutBlockFlow::LayoutBlockFlow(ContainerNode* node)
171 : LayoutBlock(node) 170 : LayoutBlock(node)
172 { 171 {
173 static_assert(sizeof(MarginInfo) == sizeof(SameSizeAsMarginInfo), "MarginInf o should stay small");
174 setChildrenInline(true); 172 setChildrenInline(true);
175 } 173 }
176 174
177 LayoutBlockFlow::~LayoutBlockFlow() 175 LayoutBlockFlow::~LayoutBlockFlow()
178 { 176 {
179 } 177 }
180 178
181 LayoutBlockFlow* LayoutBlockFlow::createAnonymous(Document* document) 179 LayoutBlockFlow* LayoutBlockFlow::createAnonymous(Document* document)
182 { 180 {
183 LayoutBlockFlow* layoutBlockFlow = new LayoutBlockFlow(nullptr); 181 LayoutBlockFlow* layoutBlockFlow = new LayoutBlockFlow(nullptr);
(...skipping 2886 matching lines...) Expand 10 before | Expand all | Expand 10 after
3070 FrameView* frameView = document().view(); 3068 FrameView* frameView = document().view();
3071 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3069 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3072 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3070 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3073 if (size().height() < visibleHeight) 3071 if (size().height() < visibleHeight)
3074 top += (visibleHeight - size().height()) / 2; 3072 top += (visibleHeight - size().height()) / 2;
3075 setY(top); 3073 setY(top);
3076 dialog->setCentered(top); 3074 dialog->setCentered(top);
3077 } 3075 }
3078 3076
3079 } // namespace blink 3077 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlock.cpp ('k') | Source/core/layout/LayoutInline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698