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

Side by Side Diff: sky/engine/core/rendering/RenderBox.h

Issue 700743002: Remove margin collapsing. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « sky/engine/core/rendering/RenderBlockFlow.cpp ('k') | sky/engine/core/rendering/RenderBox.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) 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 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 { 296 {
297 const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); 297 const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style();
298 m_marginBox.setStart(styleToUse->direction(), value); 298 m_marginBox.setStart(styleToUse->direction(), value);
299 } 299 }
300 void setMarginEnd(LayoutUnit value, const RenderStyle* overrideStyle = 0) 300 void setMarginEnd(LayoutUnit value, const RenderStyle* overrideStyle = 0)
301 { 301 {
302 const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); 302 const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style();
303 m_marginBox.setEnd(styleToUse->direction(), value); 303 m_marginBox.setEnd(styleToUse->direction(), value);
304 } 304 }
305 305
306 // The following five functions are used to implement collapsing margins.
307 // All objects know their maximal positive and negative margins. The
308 // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargi n|.
309 // For a non-collapsing box, such as a leaf element, this formula will simpl y return
310 // the margin of the element. Blocks override the maxMarginBefore and maxMa rginAfter
311 // methods.
312 enum MarginSign { PositiveMargin, NegativeMargin };
313 virtual bool isSelfCollapsingBlock() const { return false; }
314 virtual LayoutUnit collapsedMarginBefore() const { return marginBefore(); }
315 virtual LayoutUnit collapsedMarginAfter() const { return marginAfter(); }
316
317 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO ffset) const override; 306 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO ffset) const override;
318 virtual void absoluteQuads(Vector<FloatQuad>&) const override; 307 virtual void absoluteQuads(Vector<FloatQuad>&) const override;
319 308
320 virtual void layout() override; 309 virtual void layout() override;
321 virtual void paint(PaintInfo&, const LayoutPoint&) override; 310 virtual void paint(PaintInfo&, const LayoutPoint&) override;
322 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) override; 311 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) override;
323 312
324 virtual LayoutUnit minPreferredLogicalWidth() const override; 313 virtual LayoutUnit minPreferredLogicalWidth() const override;
325 virtual LayoutUnit maxPreferredLogicalWidth() const override; 314 virtual LayoutUnit maxPreferredLogicalWidth() const override;
326 315
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 if (UNLIKELY(inlineBoxWrapper() != 0)) 725 if (UNLIKELY(inlineBoxWrapper() != 0))
737 deleteLineBoxWrapper(); 726 deleteLineBoxWrapper();
738 } 727 }
739 728
740 ensureRareData().m_inlineBoxWrapper = boxWrapper; 729 ensureRareData().m_inlineBoxWrapper = boxWrapper;
741 } 730 }
742 731
743 } // namespace blink 732 } // namespace blink
744 733
745 #endif // RenderBox_h 734 #endif // RenderBox_h
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlockFlow.cpp ('k') | sky/engine/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698