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

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

Issue 1068683002: Delete RenderBlockFlow. (Closed) Base URL: https://github.com/domokit/mojo.git@block
Patch Set: Remove unused float-related code instead of moving it. Created 5 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SKY_ENGINE_CORE_RENDERING_RENDERPARAGRAPH_H_ 5 #ifndef SKY_ENGINE_CORE_RENDERING_RENDERPARAGRAPH_H_
6 #define SKY_ENGINE_CORE_RENDERING_RENDERPARAGRAPH_H_ 6 #define SKY_ENGINE_CORE_RENDERING_RENDERPARAGRAPH_H_
7 7
8 #include "sky/engine/core/dom/ContainerNode.h" 8 #include "sky/engine/core/dom/ContainerNode.h"
9 #include "sky/engine/core/rendering/RenderBlockFlow.h" 9 #include "sky/engine/core/rendering/RenderBlock.h"
10 #include "sky/engine/core/rendering/line/TrailingObjects.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
14 struct BidiRun;
13 class ContainerNode; 15 class ContainerNode;
16 // class InlineBidiResolver;
17 class InlineIterator;
14 18
15 class RenderParagraph final : public RenderBlockFlow { 19 class RenderParagraph final : public RenderBlock {
16 public: 20 public:
17 explicit RenderParagraph(ContainerNode*); 21 explicit RenderParagraph(ContainerNode*);
18 virtual ~RenderParagraph(); 22 virtual ~RenderParagraph();
19 23
20 static RenderParagraph* createAnonymous(Document&); 24 static RenderParagraph* createAnonymous(Document&);
21 25
22 bool isRenderParagraph() const override { return true; } 26 bool isRenderParagraph() const final { return true; }
27
28 void layout() final;
29
30 LayoutUnit logicalRightOffsetForLine(bool shouldIndentText) const
31 {
32 LayoutUnit right = logicalRightOffsetForContent();
33 if (shouldIndentText && !style()->isLeftToRightDirection())
34 right -= textIndentOffset();
35 return right;
36 }
37 LayoutUnit logicalLeftOffsetForLine(bool shouldIndentText) const
38 {
39 LayoutUnit left = logicalLeftOffsetForContent();
40 if (shouldIndentText && style()->isLeftToRightDirection())
41 left += textIndentOffset();
42 return left;
43 }
44
45 LayoutUnit logicalLeftSelectionOffset(RenderBlock* rootBlock, LayoutUnit pos ition) final;
46 LayoutUnit logicalRightSelectionOffset(RenderBlock* rootBlock, LayoutUnit po sition) final;
23 47
24 virtual RootInlineBox* lineAtIndex(int) const; 48 virtual RootInlineBox* lineAtIndex(int) const;
25 virtual int lineCount(const RootInlineBox* = 0, bool* = 0) const; 49 virtual int lineCount(const RootInlineBox* = 0, bool* = 0) const;
26 50
51 void deleteLineBoxTree() final;
52
27 GapRects inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& root BlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 53 GapRects inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& root BlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
28 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las tLogicalRight, const PaintInfo*); 54 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las tLogicalRight, const PaintInfo*);
29 55
56 static bool shouldSkipCreatingRunsForObject(RenderObject* obj)
57 {
58 return obj->isOutOfFlowPositioned() && !obj->style()->isOriginalDisplayI nlineType() && !obj->container()->isRenderInline();
59 }
60
61 // TODO(ojan): Remove the need for these.
62 using RenderBlock::lineBoxes;
63 using RenderBlock::firstLineBox;
64 using RenderBlock::lastRootBox;
65
30 protected: 66 protected:
31 void layoutChildren(bool relayoutChildren, SubtreeLayoutScope&, LayoutUnit b eforeEdge, LayoutUnit afterEdge) final;
32
33 void addOverflowFromChildren() final; 67 void addOverflowFromChildren() final;
34 68
35 void simplifiedNormalFlowLayout() final; 69 void simplifiedNormalFlowLayout() final;
36 70
37 void paintChildren(PaintInfo&, const LayoutPoint&, Vector<RenderBox*>& layer s) final; 71 void paintChildren(PaintInfo&, const LayoutPoint&, Vector<RenderBox*>& layer s) final;
38 72
39 bool hitTestContents(const HitTestRequest&, HitTestResult&, const HitTestLoc ation& locationInContainer, const LayoutPoint& accumulatedOffset) final; 73 bool hitTestContents(const HitTestRequest&, HitTestResult&, const HitTestLoc ation& locationInContainer, const LayoutPoint& accumulatedOffset) final;
40 74
41 virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const; 75 virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const;
42 76
43 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const final; 77 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const final;
44 78
45 int firstLineBoxBaseline() const final; 79 int firstLineBoxBaseline() const final;
46 int lastLineBoxBaseline(LineDirectionMode) const final; 80 int lastLineBoxBaseline(LineDirectionMode) const final;
47 81
48 private: 82 private:
49 virtual const char* renderName() const override; 83 virtual const char* renderName() const override;
50 84
85 void layoutChildren(bool relayoutChildren, SubtreeLayoutScope&, LayoutUnit b eforeEdge, LayoutUnit afterEdge);
86
51 void markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit logicalBot tom, RootInlineBox* highest = 0); 87 void markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit logicalBot tom, RootInlineBox* highest = 0);
52 88
89 void updateLogicalWidthForAlignment(const ETextAlign&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, unsigned expansionOpportunityCount);
90
91 RootInlineBox* createAndAppendRootInlineBox();
92 RootInlineBox* createRootInlineBox();
53 InlineFlowBox* createLineBoxes(RenderObject*, const LineInfo&, InlineBox* ch ildBox); 93 InlineFlowBox* createLineBoxes(RenderObject*, const LineInfo&, InlineBox* ch ildBox);
94 InlineBox* createInlineBoxForRenderer(RenderObject*, bool isRootLineBox, boo l isOnlyRun = false);
54 RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&); 95 RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&);
55 void computeInlineDirectionPositionsForLine(RootInlineBox*, const LineInfo&, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAnd FallbackFontsMap&, VerticalPositionCache&, WordMeasurements&); 96 void computeInlineDirectionPositionsForLine(RootInlineBox*, const LineInfo&, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAnd FallbackFontsMap&, VerticalPositionCache&, WordMeasurements&);
56 BidiRun* computeInlineDirectionPositionsForSegment(RootInlineBox*, const Lin eInfo&, ETextAlign, float& logicalLeft, 97 BidiRun* computeInlineDirectionPositionsForSegment(RootInlineBox*, const Lin eInfo&, ETextAlign, float& logicalLeft,
57 float& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpaceR un, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache&, Wo rdMeasurements&); 98 float& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpaceR un, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache&, Wo rdMeasurements&);
58 void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOv erflowAndFallbackFontsMap&, VerticalPositionCache&); 99 void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOv erflowAndFallbackFontsMap&, VerticalPositionCache&);
59 // Helper function for layoutChildren() 100 // Helper function for layoutChildren()
60 RootInlineBox* createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<B idiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun, WordMeasurements&); 101 RootInlineBox* createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<B idiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun, WordMeasurements&);
61 void layoutRunsAndFloats(LineLayoutState&); 102 void layoutRunsAndFloats(LineLayoutState&);
62 void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, 103 void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&,
63 const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiSta tus); 104 const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiSta tus);
64 void linkToEndLineIfNeeded(LineLayoutState&); 105 void linkToEndLineIfNeeded(LineLayoutState&);
65 void checkFloatsInCleanLine(RootInlineBox*, Vector<FloatWithRect>&, size_t& floatIndex, bool& encounteredNewFloat, bool& dirtiedByFloat);
66 RootInlineBox* determineStartPosition(LineLayoutState&, InlineBidiResolver&) ; 106 RootInlineBox* determineStartPosition(LineLayoutState&, InlineBidiResolver&) ;
67 void determineEndPosition(LineLayoutState&, RootInlineBox* startBox, InlineI terator& cleanLineStart, BidiStatus& cleanLineBidiStatus); 107 void determineEndPosition(LineLayoutState&, RootInlineBox* startBox, InlineI terator& cleanLineStart, BidiStatus& cleanLineBidiStatus);
68 bool checkPaginationAndFloatsAtEndLine(LineLayoutState&); 108 bool checkPaginationAndFloatsAtEndLine(LineLayoutState&);
69 bool matchedEndLine(LineLayoutState&, const InlineBidiResolver&, const Inlin eIterator& endLineStart, const BidiStatus& endLineStatus); 109 bool matchedEndLine(LineLayoutState&, const InlineBidiResolver&, const Inlin eIterator& endLineStart, const BidiStatus& endLineStatus);
70 void deleteEllipsisLineBoxes(); 110 void deleteEllipsisLineBoxes();
71 void checkLinesForTextOverflow(); 111 void checkLinesForTextOverflow();
72 }; 112 };
73 113
74 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderParagraph, isRenderParagraph()); 114 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderParagraph, isRenderParagraph());
75 115
76 } // namespace blink 116 } // namespace blink
77 117
78 #endif // SKY_ENGINE_CORE_RENDERING_RENDERPARAGRAPH_H_ 118 #endif // SKY_ENGINE_CORE_RENDERING_RENDERPARAGRAPH_H_
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderObject.cpp ('k') | sky/engine/core/rendering/RenderParagraph.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698