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

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

Issue 1648573002: Transition to explicit constructors in LayoutUnit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove int constructors for size/point... they result in incorrect conversions until LayoutUnit is … Created 4 years, 10 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 * 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 ScrollOffsetClamped 49 ScrollOffsetClamped
50 }; 50 };
51 51
52 struct LayoutBoxRareData { 52 struct LayoutBoxRareData {
53 WTF_MAKE_NONCOPYABLE(LayoutBoxRareData); USING_FAST_MALLOC(LayoutBoxRareData ); 53 WTF_MAKE_NONCOPYABLE(LayoutBoxRareData); USING_FAST_MALLOC(LayoutBoxRareData );
54 public: 54 public:
55 LayoutBoxRareData() 55 LayoutBoxRareData()
56 : m_spannerPlaceholder(nullptr) 56 : m_spannerPlaceholder(nullptr)
57 , m_overrideLogicalContentHeight(-1) 57 , m_overrideLogicalContentHeight(-1)
58 , m_overrideLogicalContentWidth(-1) 58 , m_overrideLogicalContentWidth(-1)
59 , m_previousBorderBoxSize(-1, -1) 59 , m_previousBorderBoxSize(LayoutUnit(-1), LayoutUnit(-1))
60 , m_percentHeightContainer(nullptr) 60 , m_percentHeightContainer(nullptr)
61 { 61 {
62 } 62 }
63 63
64 // For spanners, the spanner placeholder that lays us out within the multico l container. 64 // For spanners, the spanner placeholder that lays us out within the multico l container.
65 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; 65 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder;
66 66
67 LayoutUnit m_overrideLogicalContentHeight; 67 LayoutUnit m_overrideLogicalContentHeight;
68 LayoutUnit m_overrideLogicalContentWidth; 68 LayoutUnit m_overrideLogicalContentWidth;
69 69
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 { 312 {
313 if (rect == m_frameRect) 313 if (rect == m_frameRect)
314 return; 314 return;
315 m_frameRect = rect; 315 m_frameRect = rect;
316 frameRectChanged(); 316 frameRectChanged();
317 } 317 }
318 318
319 // Note that those functions have their origin at this box's CSS border box. 319 // Note that those functions have their origin at this box's CSS border box.
320 // As such their location doesn't account for 'top'/'left'. 320 // As such their location doesn't account for 'top'/'left'.
321 LayoutRect borderBoxRect() const { return LayoutRect(LayoutPoint(), size()); } 321 LayoutRect borderBoxRect() const { return LayoutRect(LayoutPoint(), size()); }
322 LayoutRect paddingBoxRect() const { return LayoutRect(borderLeft(), borderTo p(), clientWidth(), clientHeight()); } 322 LayoutRect paddingBoxRect() const { return LayoutRect(LayoutUnit(borderLeft( )), LayoutUnit(borderTop()), clientWidth(), clientHeight()); }
323 IntRect pixelSnappedBorderBoxRect() const { return IntRect(IntPoint(), m_fra meRect.pixelSnappedSize()); } 323 IntRect pixelSnappedBorderBoxRect() const { return IntRect(IntPoint(), m_fra meRect.pixelSnappedSize()); }
324 IntRect borderBoundingBox() const final { return pixelSnappedBorderBoxRect() ; } 324 IntRect borderBoundingBox() const final { return pixelSnappedBorderBoxRect() ; }
325 325
326 // The content area of the box (excludes padding - and intrinsic padding for table cells, etc... - and border). 326 // The content area of the box (excludes padding - and intrinsic padding for table cells, etc... - and border).
327 LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + padding Left(), borderTop() + paddingTop(), contentWidth(), contentHeight()); } 327 LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + padding Left(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }
328 LayoutSize contentBoxOffset() const { return LayoutSize(borderLeft() + paddi ngLeft(), borderTop() + paddingTop()); } 328 LayoutSize contentBoxOffset() const { return LayoutSize(borderLeft() + paddi ngLeft(), borderTop() + paddingTop()); }
329 // The content box in absolute coords. Ignores transforms. 329 // The content box in absolute coords. Ignores transforms.
330 IntRect absoluteContentBox() const; 330 IntRect absoluteContentBox() const;
331 // The offset of the content box in absolute coords, ignoring transforms. 331 // The offset of the content box in absolute coords, ignoring transforms.
332 IntSize absoluteContentBoxOffset() const; 332 IntSize absoluteContentBoxOffset() const;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (LayoutFlow) 394 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin es (LayoutFlow)
395 // to return the remaining width on a given line (and the height of a single line). 395 // to return the remaining width on a given line (and the height of a single line).
396 LayoutUnit offsetWidth() const override { return m_frameRect.width(); } 396 LayoutUnit offsetWidth() const override { return m_frameRect.width(); }
397 LayoutUnit offsetHeight() const override { return m_frameRect.height(); } 397 LayoutUnit offsetHeight() const override { return m_frameRect.height(); }
398 398
399 int pixelSnappedOffsetWidth() const final; 399 int pixelSnappedOffsetWidth() const final;
400 int pixelSnappedOffsetHeight() const final; 400 int pixelSnappedOffsetHeight() const final;
401 401
402 // More IE extensions. clientWidth and clientHeight represent the interior of an object 402 // More IE extensions. clientWidth and clientHeight represent the interior of an object
403 // excluding border and scrollbar. clientLeft/Top are just the borderLeftWi dth and borderTopWidth. 403 // excluding border and scrollbar. clientLeft/Top are just the borderLeftWi dth and borderTopWidth.
404 LayoutUnit clientLeft() const { return borderLeft() + (shouldPlaceBlockDirec tionScrollbarOnLogicalLeft() ? verticalScrollbarWidth() : 0); } 404 LayoutUnit clientLeft() const { return LayoutUnit(borderLeft() + (shouldPlac eBlockDirectionScrollbarOnLogicalLeft() ? verticalScrollbarWidth() : 0)); }
405 LayoutUnit clientTop() const { return borderTop(); } 405 LayoutUnit clientTop() const { return LayoutUnit(borderTop()); }
406 LayoutUnit clientWidth() const; 406 LayoutUnit clientWidth() const;
407 LayoutUnit clientHeight() const; 407 LayoutUnit clientHeight() const;
408 LayoutUnit clientLogicalWidth() const { return style()->isHorizontalWritingM ode() ? clientWidth() : clientHeight(); } 408 LayoutUnit clientLogicalWidth() const { return style()->isHorizontalWritingM ode() ? clientWidth() : clientHeight(); }
409 LayoutUnit clientLogicalHeight() const { return style()->isHorizontalWriting Mode() ? clientHeight() : clientWidth(); } 409 LayoutUnit clientLogicalHeight() const { return style()->isHorizontalWriting Mode() ? clientHeight() : clientWidth(); }
410 LayoutUnit clientLogicalBottom() const { return borderBefore() + clientLogic alHeight(); } 410 LayoutUnit clientLogicalBottom() const { return borderBefore() + clientLogic alHeight(); }
411 LayoutRect clientBoxRect() const { return LayoutRect(clientLeft(), clientTop (), clientWidth(), clientHeight()); } 411 LayoutRect clientBoxRect() const { return LayoutRect(clientLeft(), clientTop (), clientWidth(), clientHeight()); }
412 412
413 int pixelSnappedClientWidth() const; 413 int pixelSnappedClientWidth() const;
414 int pixelSnappedClientHeight() const; 414 int pixelSnappedClientHeight() const;
415 415
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 475
476 // The following functions are used to implement collapsing margins. 476 // The following functions are used to implement collapsing margins.
477 // All objects know their maximal positive and negative margins. The 477 // All objects know their maximal positive and negative margins. The
478 // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargi n|. 478 // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargi n|.
479 // For a non-collapsing box, such as a leaf element, this formula will simpl y return 479 // For a non-collapsing box, such as a leaf element, this formula will simpl y return
480 // the margin of the element. Blocks override the maxMarginBefore and maxMa rginAfter 480 // the margin of the element. Blocks override the maxMarginBefore and maxMa rginAfter
481 // methods. 481 // methods.
482 virtual bool isSelfCollapsingBlock() const { return false; } 482 virtual bool isSelfCollapsingBlock() const { return false; }
483 virtual LayoutUnit collapsedMarginBefore() const { return marginBefore(); } 483 virtual LayoutUnit collapsedMarginBefore() const { return marginBefore(); }
484 virtual LayoutUnit collapsedMarginAfter() const { return marginAfter(); } 484 virtual LayoutUnit collapsedMarginAfter() const { return marginAfter(); }
485 LayoutRectOutsets collapsedMarginBoxLogicalOutsets() const { return LayoutRe ctOutsets(collapsedMarginBefore(), 0, collapsedMarginAfter(), 0); } 485 LayoutRectOutsets collapsedMarginBoxLogicalOutsets() const
486 {
487 return LayoutRectOutsets(collapsedMarginBefore(), LayoutUnit(), collapse dMarginAfter(), LayoutUnit());
488 }
486 489
487 void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) c onst override; 490 void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) c onst override;
488 void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override; 491 void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;
489 492
490 int reflectionOffset() const; 493 int reflectionOffset() const;
491 // Given a rect in the object's coordinate space, returns the corresponding rect in the reflection. 494 // Given a rect in the object's coordinate space, returns the corresponding rect in the reflection.
492 LayoutRect reflectedRect(const LayoutRect&) const; 495 LayoutRect reflectedRect(const LayoutRect&) const;
493 496
494 void layout() override; 497 void layout() override;
495 void paint(const PaintInfo&, const LayoutPoint&) const override; 498 void paint(const PaintInfo&, const LayoutPoint&) const override;
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 if (UNLIKELY(m_inlineBoxWrapper != nullptr)) 1111 if (UNLIKELY(m_inlineBoxWrapper != nullptr))
1109 deleteLineBoxWrapper(); 1112 deleteLineBoxWrapper();
1110 } 1113 }
1111 1114
1112 m_inlineBoxWrapper = boxWrapper; 1115 m_inlineBoxWrapper = boxWrapper;
1113 } 1116 }
1114 1117
1115 } // namespace blink 1118 } // namespace blink
1116 1119
1117 #endif // LayoutBox_h 1120 #endif // LayoutBox_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698