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

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

Issue 2394263004: Reformat comments in core/layout up until LayoutMultiColumnFlowThread (Closed)
Patch Set: Rebase w/HEAD Created 4 years, 2 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 | « no previous file | third_party/WebKit/Source/core/layout/LayoutBoxModelObject.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, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2006, 2007, 2009 Apple Inc. All rights reserved.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // This is the only way layers should ever be destroyed. 138 // This is the only way layers should ever be destroyed.
139 void destroyLayer(); 139 void destroyLayer();
140 140
141 LayoutSize relativePositionOffset() const; 141 LayoutSize relativePositionOffset() const;
142 LayoutSize relativePositionLogicalOffset() const { 142 LayoutSize relativePositionLogicalOffset() const {
143 return style()->isHorizontalWritingMode() 143 return style()->isHorizontalWritingMode()
144 ? relativePositionOffset() 144 ? relativePositionOffset()
145 : relativePositionOffset().transposedSize(); 145 : relativePositionOffset().transposedSize();
146 } 146 }
147 147
148 // Populates StickyPositionConstraints, setting the sticky box rect, containin g block rect and updating 148 // Populates StickyPositionConstraints, setting the sticky box rect,
149 // the constraint offsets according to the available space. 149 // containing block rect and updating the constraint offsets according to the
150 // available space.
150 FloatRect computeStickyConstrainingRect() const; 151 FloatRect computeStickyConstrainingRect() const;
151 void updateStickyPositionConstraints() const; 152 void updateStickyPositionConstraints() const;
152 LayoutSize stickyPositionOffset() const; 153 LayoutSize stickyPositionOffset() const;
153 154
154 LayoutSize offsetForInFlowPosition() const; 155 LayoutSize offsetForInFlowPosition() const;
155 156
156 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (LayoutFlow) 157 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines
157 // to return the remaining width on a given line (and the height of a single l ine). 158 // (LayoutInline) to return the remaining width on a given line (and the heigh t
159 // of a single line).
158 virtual LayoutUnit offsetLeft(const Element*) const; 160 virtual LayoutUnit offsetLeft(const Element*) const;
159 virtual LayoutUnit offsetTop(const Element*) const; 161 virtual LayoutUnit offsetTop(const Element*) const;
160 virtual LayoutUnit offsetWidth() const = 0; 162 virtual LayoutUnit offsetWidth() const = 0;
161 virtual LayoutUnit offsetHeight() const = 0; 163 virtual LayoutUnit offsetHeight() const = 0;
162 164
163 int pixelSnappedOffsetLeft(const Element* parent) const { 165 int pixelSnappedOffsetLeft(const Element* parent) const {
164 return roundToInt(offsetLeft(parent)); 166 return roundToInt(offsetLeft(parent));
165 } 167 }
166 int pixelSnappedOffsetTop(const Element* parent) const { 168 int pixelSnappedOffsetTop(const Element* parent) const {
167 return roundToInt(offsetTop(parent)); 169 return roundToInt(offsetTop(parent));
168 } 170 }
169 virtual int pixelSnappedOffsetWidth(const Element*) const; 171 virtual int pixelSnappedOffsetWidth(const Element*) const;
170 virtual int pixelSnappedOffsetHeight(const Element*) const; 172 virtual int pixelSnappedOffsetHeight(const Element*) const;
171 173
172 bool hasSelfPaintingLayer() const; 174 bool hasSelfPaintingLayer() const;
173 PaintLayer* layer() const { return m_layer.get(); } 175 PaintLayer* layer() const { return m_layer.get(); }
174 PaintLayerScrollableArea* getScrollableArea() const; 176 PaintLayerScrollableArea* getScrollableArea() const;
175 177
176 virtual void updateFromStyle(); 178 virtual void updateFromStyle();
177 179
178 // The type of PaintLayer to instantiate. 180 // The type of PaintLayer to instantiate. Any value returned from this
179 // Any value returned from this function other than NoPaintLayer 181 // function other than NoPaintLayer will populate |m_layer|.
180 // will populate |m_layer|.
181 virtual PaintLayerType layerTypeRequired() const = 0; 182 virtual PaintLayerType layerTypeRequired() const = 0;
182 183
183 // This will work on inlines to return the bounding box of all of the lines' b order boxes. 184 // This will work on inlines to return the bounding box of all of the lines'
185 // border boxes.
184 virtual IntRect borderBoundingBox() const = 0; 186 virtual IntRect borderBoundingBox() const = 0;
185 187
186 virtual LayoutRect visualOverflowRect() const = 0; 188 virtual LayoutRect visualOverflowRect() const = 0;
187 189
188 // Checks if this box, or any of it's descendants, or any of it's continuation s, 190 // Checks if this box, or any of it's descendants, or any of it's
189 // will take up space in the layout of the page. 191 // continuations, will take up space in the layout of the page.
190 bool hasNonEmptyLayoutSize() const; 192 bool hasNonEmptyLayoutSize() const;
191 bool usesCompositedScrolling() const; 193 bool usesCompositedScrolling() const;
192 194
193 // Checks if all of the background's layers can be painted as locally 195 // Checks if all of the background's layers can be painted as locally
194 // attached. 196 // attached.
195 bool hasLocalEquivalentBackground() const; 197 bool hasLocalEquivalentBackground() const;
196 198
197 // These return the CSS computed padding values. 199 // These return the CSS computed padding values.
198 LayoutUnit computedCSSPaddingTop() const { 200 LayoutUnit computedCSSPaddingTop() const {
199 return computedCSSPadding(style()->paddingTop()); 201 return computedCSSPadding(style()->paddingTop());
(...skipping 21 matching lines...) Expand all
221 } 223 }
222 LayoutUnit computedCSSPaddingOver() const { 224 LayoutUnit computedCSSPaddingOver() const {
223 return computedCSSPadding(style()->paddingOver()); 225 return computedCSSPadding(style()->paddingOver());
224 } 226 }
225 LayoutUnit computedCSSPaddingUnder() const { 227 LayoutUnit computedCSSPaddingUnder() const {
226 return computedCSSPadding(style()->paddingUnder()); 228 return computedCSSPadding(style()->paddingUnder());
227 } 229 }
228 230
229 // These functions are used during layout. 231 // These functions are used during layout.
230 // - Table cells override them to include the intrinsic padding (see 232 // - Table cells override them to include the intrinsic padding (see
231 // explanations in LayoutTableCell). 233 // explanations in LayoutTableCell).
232 // - Table override them to exclude padding with collapsing borders. 234 // - Table override them to exclude padding with collapsing borders.
233 virtual LayoutUnit paddingTop() const { return computedCSSPaddingTop(); } 235 virtual LayoutUnit paddingTop() const { return computedCSSPaddingTop(); }
234 virtual LayoutUnit paddingBottom() const { 236 virtual LayoutUnit paddingBottom() const {
235 return computedCSSPaddingBottom(); 237 return computedCSSPaddingBottom();
236 } 238 }
237 virtual LayoutUnit paddingLeft() const { return computedCSSPaddingLeft(); } 239 virtual LayoutUnit paddingLeft() const { return computedCSSPaddingLeft(); }
238 virtual LayoutUnit paddingRight() const { return computedCSSPaddingRight(); } 240 virtual LayoutUnit paddingRight() const { return computedCSSPaddingRight(); }
239 virtual LayoutUnit paddingBefore() const { 241 virtual LayoutUnit paddingBefore() const {
240 return computedCSSPaddingBefore(); 242 return computedCSSPaddingBefore();
241 } 243 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 389
388 // Returns true if the background is painted opaque in the given rect. 390 // Returns true if the background is painted opaque in the given rect.
389 // The query rect is given in local coordinate system. 391 // The query rect is given in local coordinate system.
390 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const { 392 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const {
391 return false; 393 return false;
392 } 394 }
393 395
394 void invalidateTreeIfNeeded(const PaintInvalidationState&) override; 396 void invalidateTreeIfNeeded(const PaintInvalidationState&) override;
395 397
396 // http://www.w3.org/TR/css3-background/#body-background 398 // http://www.w3.org/TR/css3-background/#body-background
397 // <html> root element with no background steals background from its first <bo dy> child. 399 // <html> root element with no background steals background from its first
398 // The used background for such body element should be the initial value. (i.e . transparent) 400 // <body> child. The used background for such body element should be the
401 // initial value. (i.e. transparent)
399 bool backgroundStolenForBeingBody( 402 bool backgroundStolenForBeingBody(
400 const ComputedStyle* rootElementStyle = nullptr) const; 403 const ComputedStyle* rootElementStyle = nullptr) const;
401 404
402 protected: 405 protected:
403 void willBeDestroyed() override; 406 void willBeDestroyed() override;
404 407
405 LayoutPoint adjustedPositionRelativeTo(const LayoutPoint&, 408 LayoutPoint adjustedPositionRelativeTo(const LayoutPoint&,
406 const Element*) const; 409 const Element*) const;
407 410
408 // Returns the continuation associated with |this|. 411 // Returns the continuation associated with |this|.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 const PaintLayer*, 446 const PaintLayer*,
444 const LayoutPoint&, 447 const LayoutPoint&,
445 const LayoutRect&) const override; 448 const LayoutRect&) const override;
446 449
447 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) override; 450 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) override;
448 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; 451 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
449 452
450 void invalidateStickyConstraints(); 453 void invalidateStickyConstraints();
451 454
452 public: 455 public:
453 // These functions are only used internally to manipulate the layout tree stru cture via remove/insert/appendChildNode. 456 // These functions are only used internally to manipulate the layout tree
454 // Since they are typically called only to move objects around within anonymou s blocks (which only have layers in 457 // structure via remove/insert/appendChildNode.
455 // the case of column spans), the default for fullRemoveInsert is false rather than true. 458 // Since they are typically called only to move objects around within
459 // anonymous blocks (which only have layers in the case of column spans), the
460 // default for fullRemoveInsert is false rather than true.
456 void moveChildTo(LayoutBoxModelObject* toBoxModelObject, 461 void moveChildTo(LayoutBoxModelObject* toBoxModelObject,
457 LayoutObject* child, 462 LayoutObject* child,
458 LayoutObject* beforeChild, 463 LayoutObject* beforeChild,
459 bool fullRemoveInsert = false); 464 bool fullRemoveInsert = false);
460 void moveChildTo(LayoutBoxModelObject* toBoxModelObject, 465 void moveChildTo(LayoutBoxModelObject* toBoxModelObject,
461 LayoutObject* child, 466 LayoutObject* child,
462 bool fullRemoveInsert = false) { 467 bool fullRemoveInsert = false) {
463 moveChildTo(toBoxModelObject, child, 0, fullRemoveInsert); 468 moveChildTo(toBoxModelObject, child, 0, fullRemoveInsert);
464 } 469 }
465 void moveAllChildrenTo(LayoutBoxModelObject* toBoxModelObject, 470 void moveAllChildrenTo(LayoutBoxModelObject* toBoxModelObject,
466 bool fullRemoveInsert = false) { 471 bool fullRemoveInsert = false) {
467 moveAllChildrenTo(toBoxModelObject, 0, fullRemoveInsert); 472 moveAllChildrenTo(toBoxModelObject, 0, fullRemoveInsert);
468 } 473 }
469 void moveAllChildrenTo(LayoutBoxModelObject* toBoxModelObject, 474 void moveAllChildrenTo(LayoutBoxModelObject* toBoxModelObject,
470 LayoutObject* beforeChild, 475 LayoutObject* beforeChild,
471 bool fullRemoveInsert = false) { 476 bool fullRemoveInsert = false) {
472 moveChildrenTo(toBoxModelObject, slowFirstChild(), 0, beforeChild, 477 moveChildrenTo(toBoxModelObject, slowFirstChild(), 0, beforeChild,
473 fullRemoveInsert); 478 fullRemoveInsert);
474 } 479 }
475 // Move all of the kids from |startChild| up to but excluding |endChild|. 0 ca n be passed as the |endChild| to denote 480 // Move all of the kids from |startChild| up to but excluding |endChild|. 0
476 // that all the kids from |startChild| onwards should be moved. 481 // can be passed as the |endChild| to denote that all the kids from
482 // |startChild| onwards should be moved.
477 void moveChildrenTo(LayoutBoxModelObject* toBoxModelObject, 483 void moveChildrenTo(LayoutBoxModelObject* toBoxModelObject,
478 LayoutObject* startChild, 484 LayoutObject* startChild,
479 LayoutObject* endChild, 485 LayoutObject* endChild,
480 bool fullRemoveInsert = false) { 486 bool fullRemoveInsert = false) {
481 moveChildrenTo(toBoxModelObject, startChild, endChild, 0, fullRemoveInsert); 487 moveChildrenTo(toBoxModelObject, startChild, endChild, 0, fullRemoveInsert);
482 } 488 }
483 virtual void moveChildrenTo(LayoutBoxModelObject* toBoxModelObject, 489 virtual void moveChildrenTo(LayoutBoxModelObject* toBoxModelObject,
484 LayoutObject* startChild, 490 LayoutObject* startChild,
485 LayoutObject* endChild, 491 LayoutObject* endChild,
486 LayoutObject* beforeChild, 492 LayoutObject* beforeChild,
487 bool fullRemoveInsert = false); 493 bool fullRemoveInsert = false);
488 494
489 private: 495 private:
490 void createLayer(); 496 void createLayer();
491 497
492 LayoutUnit computedCSSPadding(const Length&) const; 498 LayoutUnit computedCSSPadding(const Length&) const;
493 bool isBoxModelObject() const final { return true; } 499 bool isBoxModelObject() const final { return true; }
494 500
495 LayoutBoxModelObjectRareData& ensureRareData() { 501 LayoutBoxModelObjectRareData& ensureRareData() {
496 if (!m_rareData) 502 if (!m_rareData)
497 m_rareData = wrapUnique(new LayoutBoxModelObjectRareData()); 503 m_rareData = wrapUnique(new LayoutBoxModelObjectRareData());
498 return *m_rareData.get(); 504 return *m_rareData.get();
499 } 505 }
500 506
501 bool hasAutoHeightOrContainingBlockWithAutoHeight( 507 bool hasAutoHeightOrContainingBlockWithAutoHeight(
502 bool checkingContainingBlock) const; 508 bool checkingContainingBlock) const;
503 509
504 // The PaintLayer associated with this object. 510 // The PaintLayer associated with this object. |m_layer| can be nullptr
505 // |m_layer| can be nullptr depending on the return value of layerTypeRequired (). 511 // depending on the return value of layerTypeRequired().
506 std::unique_ptr<PaintLayer> m_layer; 512 std::unique_ptr<PaintLayer> m_layer;
507 513
508 std::unique_ptr<LayoutBoxModelObjectRareData> m_rareData; 514 std::unique_ptr<LayoutBoxModelObjectRareData> m_rareData;
509 }; 515 };
510 516
511 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject()); 517 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject());
512 518
513 } // namespace blink 519 } // namespace blink
514 520
515 #endif // LayoutBoxModelObject_h 521 #endif // LayoutBoxModelObject_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698