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

Side by Side Diff: Source/core/rendering/RenderBlock.h

Issue 209443007: Remove shape-inside support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix Zoltan's comments Created 6 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 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights 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 11 matching lines...) Expand all
22 22
23 #ifndef RenderBlock_h 23 #ifndef RenderBlock_h
24 #define RenderBlock_h 24 #define RenderBlock_h
25 25
26 #include "core/rendering/ColumnInfo.h" 26 #include "core/rendering/ColumnInfo.h"
27 #include "core/rendering/FloatingObjects.h" 27 #include "core/rendering/FloatingObjects.h"
28 #include "core/rendering/GapRects.h" 28 #include "core/rendering/GapRects.h"
29 #include "core/rendering/RenderBox.h" 29 #include "core/rendering/RenderBox.h"
30 #include "core/rendering/RenderLineBoxList.h" 30 #include "core/rendering/RenderLineBoxList.h"
31 #include "core/rendering/RootInlineBox.h" 31 #include "core/rendering/RootInlineBox.h"
32 #include "core/rendering/shapes/ShapeInsideInfo.h"
33 #include "core/rendering/style/ShapeValue.h" 32 #include "core/rendering/style/ShapeValue.h"
34 #include "platform/text/TextBreakIterator.h" 33 #include "platform/text/TextBreakIterator.h"
35 #include "platform/text/TextRun.h" 34 #include "platform/text/TextRun.h"
36 #include "wtf/ListHashSet.h" 35 #include "wtf/ListHashSet.h"
37 #include "wtf/OwnPtr.h" 36 #include "wtf/OwnPtr.h"
38 37
39 namespace WebCore { 38 namespace WebCore {
40 39
41 class BasicShape; 40 class BasicShape;
42 class BidiContext; 41 class BidiContext;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 136
138 void setHasMarginBeforeQuirk(bool b) { m_hasMarginBeforeQuirk = b; } 137 void setHasMarginBeforeQuirk(bool b) { m_hasMarginBeforeQuirk = b; }
139 void setHasMarginAfterQuirk(bool b) { m_hasMarginAfterQuirk = b; } 138 void setHasMarginAfterQuirk(bool b) { m_hasMarginAfterQuirk = b; }
140 139
141 bool hasMarginBeforeQuirk() const { return m_hasMarginBeforeQuirk; } 140 bool hasMarginBeforeQuirk() const { return m_hasMarginBeforeQuirk; }
142 bool hasMarginAfterQuirk() const { return m_hasMarginAfterQuirk; } 141 bool hasMarginAfterQuirk() const { return m_hasMarginAfterQuirk; }
143 142
144 bool hasMarginBeforeQuirk(const RenderBox* child) const; 143 bool hasMarginBeforeQuirk(const RenderBox* child) const;
145 bool hasMarginAfterQuirk(const RenderBox* child) const; 144 bool hasMarginAfterQuirk(const RenderBox* child) const;
146 145
147 void markShapeInsideDescendantsForLayout();
148 void markPositionedObjectsForLayout(); 146 void markPositionedObjectsForLayout();
149 // FIXME: Do we really need this to be virtual? It's just so we can call thi s on 147 // FIXME: Do we really need this to be virtual? It's just so we can call thi s on
150 // RenderBoxes without needed to check whether they're RenderBlocks first. 148 // RenderBoxes without needed to check whether they're RenderBlocks first.
151 virtual void markForPaginationRelayoutIfNeeded(SubtreeLayoutScope&) OVERRIDE FINAL; 149 virtual void markForPaginationRelayoutIfNeeded(SubtreeLayoutScope&) OVERRIDE FINAL;
152 150
153 // FIXME-BLOCKFLOW: Remove virtualizaion when all of the line layout code ha s been moved out of RenderBlock 151 // FIXME-BLOCKFLOW: Remove virtualizaion when all of the line layout code ha s been moved out of RenderBlock
154 virtual bool containsFloats() const { return false; } 152 virtual bool containsFloats() const { return false; }
155 153
156 LayoutUnit textIndentOffset() const; 154 LayoutUnit textIndentOffset() const;
157 155
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } 254 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingM ode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); }
257 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo rContent() + availableLogicalWidth(); } 255 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetFo rContent() + availableLogicalWidth(); }
258 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor Content(); } 256 LayoutUnit startOffsetForContent() const { return style()->isLeftToRightDire ction() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetFor Content(); }
259 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC ontent(); } 257 LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirec tion() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForC ontent(); }
260 258
261 #ifndef NDEBUG 259 #ifndef NDEBUG
262 void checkPositionedObjectsNeedLayout(); 260 void checkPositionedObjectsNeedLayout();
263 void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, const Inline Box* = 0, const char* = 0, const RenderObject* = 0) const; 261 void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, const Inline Box* = 0, const char* = 0, const RenderObject* = 0) const;
264 #endif 262 #endif
265 263
266 ShapeInsideInfo& ensureShapeInsideInfo()
267 {
268 if (!m_rareData || !m_rareData->m_shapeInsideInfo)
269 setShapeInsideInfo(ShapeInsideInfo::createInfo(*this));
270 return *m_rareData->m_shapeInsideInfo;
271 }
272 ShapeInsideInfo* shapeInsideInfo() const
273 {
274 return m_rareData && m_rareData->m_shapeInsideInfo && ShapeInsideInfo::i sEnabledFor(*this) ? m_rareData->m_shapeInsideInfo.get() : 0;
275 }
276 void setShapeInsideInfo(PassOwnPtr<ShapeInsideInfo> value)
277 {
278 if (!m_rareData)
279 m_rareData = adoptPtr(new RenderBlockRareData());
280 m_rareData->m_shapeInsideInfo = value;
281 }
282 ShapeInsideInfo* layoutShapeInsideInfo() const;
283 bool allowsShapeInsideInfoSharing(const RenderBlock* other) const;
284 LayoutSize logicalOffsetFromShapeAncestorContainer(const RenderBlock* contai ner) const; 264 LayoutSize logicalOffsetFromShapeAncestorContainer(const RenderBlock* contai ner) const;
285 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE; 265 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE;
286 266
287 // inline-block elements paint all phases atomically. This function ensures that. Certain other elements 267 // inline-block elements paint all phases atomically. This function ensures that. Certain other elements
288 // (grid items, flex items) require this behavior as well, and this function exists as a helper for them. 268 // (grid items, flex items) require this behavior as well, and this function exists as a helper for them.
289 // It is expected that the caller will call this function independent of the value of paintInfo.phase. 269 // It is expected that the caller will call this function independent of the value of paintInfo.phase.
290 static void paintAsInlineBlock(RenderObject*, PaintInfo&, const LayoutPoint& ); 270 static void paintAsInlineBlock(RenderObject*, PaintInfo&, const LayoutPoint& );
291 protected: 271 protected:
292 virtual void willBeDestroyed() OVERRIDE; 272 virtual void willBeDestroyed() OVERRIDE;
293 273
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 protected: 334 protected:
355 virtual void addOverflowFromChildren(); 335 virtual void addOverflowFromChildren();
356 void addOverflowFromPositionedObjects(); 336 void addOverflowFromPositionedObjects();
357 void addOverflowFromBlockChildren(); 337 void addOverflowFromBlockChildren();
358 void addVisualOverflowFromTheme(); 338 void addVisualOverflowFromTheme();
359 339
360 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE; 340 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE;
361 341
362 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE; 342 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE;
363 343
364 bool updateRegionsAndShapesLogicalSize(RenderFlowThread*);
365 void computeRegionRangeForBlock(RenderFlowThread*); 344 void computeRegionRangeForBlock(RenderFlowThread*);
366 345
367 void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, RenderBox* ); 346 void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, RenderBox* );
368 347
369 virtual bool isInlineBlockOrInlineTable() const OVERRIDE FINAL { return isIn line() && isReplaced(); } 348 virtual bool isInlineBlockOrInlineTable() const OVERRIDE FINAL { return isIn line() && isReplaced(); }
370 349
371 private: 350 private:
372 void computeShapeSize();
373 void updateRegionsAndShapesAfterChildLayout(RenderFlowThread*, bool); 351 void updateRegionsAndShapesAfterChildLayout(RenderFlowThread*, bool);
374 void updateShapeInsideInfoAfterStyleChange(const ShapeValue*, const ShapeVal ue* oldShape);
375 void relayoutShapeDescendantIfMoved(RenderBlock* child, LayoutSize offset);
376 352
377 virtual RenderObjectChildList* virtualChildren() OVERRIDE FINAL { return chi ldren(); } 353 virtual RenderObjectChildList* virtualChildren() OVERRIDE FINAL { return chi ldren(); }
378 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE FINAL { return children(); } 354 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE FINAL { return children(); }
379 355
380 virtual const char* renderName() const OVERRIDE; 356 virtual const char* renderName() const OVERRIDE;
381 357
382 virtual bool isRenderBlock() const OVERRIDE FINAL { return true; } 358 virtual bool isRenderBlock() const OVERRIDE FINAL { return true; }
383 359
384 void makeChildrenNonInline(RenderObject* insertionPoint = 0); 360 void makeChildrenNonInline(RenderObject* insertionPoint = 0);
385 virtual void removeLeftoverAnonymousBlock(RenderBlock* child); 361 virtual void removeLeftoverAnonymousBlock(RenderBlock* child);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 : m_paginationStrut(0) 517 : m_paginationStrut(0)
542 , m_pageLogicalOffset(0) 518 , m_pageLogicalOffset(0)
543 , m_lineBreakToAvoidWidow(-1) 519 , m_lineBreakToAvoidWidow(-1)
544 , m_didBreakAtLineToAvoidWidow(false) 520 , m_didBreakAtLineToAvoidWidow(false)
545 { 521 {
546 } 522 }
547 523
548 LayoutUnit m_paginationStrut; 524 LayoutUnit m_paginationStrut;
549 LayoutUnit m_pageLogicalOffset; 525 LayoutUnit m_pageLogicalOffset;
550 526
551 OwnPtr<ShapeInsideInfo> m_shapeInsideInfo;
552 int m_lineBreakToAvoidWidow : 31; 527 int m_lineBreakToAvoidWidow : 31;
553 unsigned m_didBreakAtLineToAvoidWidow : 1; 528 unsigned m_didBreakAtLineToAvoidWidow : 1;
554 }; 529 };
555 530
556 protected: 531 protected:
557 OwnPtr<RenderBlockRareData> m_rareData; 532 OwnPtr<RenderBlockRareData> m_rareData;
558 533
559 RenderObjectChildList m_children; 534 RenderObjectChildList m_children;
560 RenderLineBoxList m_lineBoxes; // All of the root line boxes created for t his block flow. For example, <div>Hello<br>world.</div> will have two total lin es for the <div>. 535 RenderLineBoxList m_lineBoxes; // All of the root line boxes created for t his block flow. For example, <div>Hello<br>world.</div> will have two total lin es for the <div>.
561 536
(...skipping 10 matching lines...) Expand all
572 // (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline). 547 // (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline).
573 friend class RenderRubyBase; 548 friend class RenderRubyBase;
574 // FIXME-BLOCKFLOW: Remove this when the line layout stuff has all moved out of RenderBlock 549 // FIXME-BLOCKFLOW: Remove this when the line layout stuff has all moved out of RenderBlock
575 friend class LineBreaker; 550 friend class LineBreaker;
576 551
577 // FIXME: This is temporary as we move code that accesses block flow 552 // FIXME: This is temporary as we move code that accesses block flow
578 // member variables out of RenderBlock and into RenderBlockFlow. 553 // member variables out of RenderBlock and into RenderBlockFlow.
579 friend class RenderBlockFlow; 554 friend class RenderBlockFlow;
580 }; 555 };
581 556
582
583 inline bool RenderBlock::allowsShapeInsideInfoSharing(const RenderBlock* other) const
584 {
585 if (!other)
586 return false;
587 for (const RenderBlock* current = this; current && current != other && !curr ent->isRenderFlowThread(); current = current->containingBlock()) {
588 if (current->isInline() || current->isFloating())
589 return false;
590 if (current->parent() != current->containingBlock())
591 return false;
592 }
593 return true;
594 }
595
596 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock()); 557 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlock, isRenderBlock());
597 558
598 } // namespace WebCore 559 } // namespace WebCore
599 560
600 #endif // RenderBlock_h 561 #endif // RenderBlock_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698