Changeset 158268 in webkit
- Timestamp:
- Oct 30, 2013 7:12:32 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r158265 r158268 1 2013-10-30 Antti Koivisto <antti@apple.com> 2 3 Make SimpleLineLayout::Layout a class 4 https://bugs.webkit.org/show_bug.cgi?id=123508 5 6 Reviewed by Mario Sanchez Prada. 7 8 Improve encapsulation. 9 1 10 2013-10-30 Antti Koivisto <antti@apple.com> 2 11 -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r158163 r158268 3149 3149 3150 3150 if (m_simpleLineLayout) 3151 return m_simpleLineLayout->lineCount ;3151 return m_simpleLineLayout->lineCount(); 3152 3152 3153 3153 return lineBoxes().firstLineBox(); -
trunk/Source/WebCore/rendering/SimpleLineLayout.cpp
r158225 r158268 335 335 336 336 Layout::Layout(const RunVector& runVector, unsigned lineCount) 337 : runCount(runVector.size())338 , lineCount(lineCount)339 { 340 memcpy( runs, runVector.data(),runCount * sizeof(Run));341 } 342 343 } 344 } 337 : m_lineCount(lineCount) 338 , m_runCount(runVector.size()) 339 { 340 memcpy(m_runs, runVector.data(), m_runCount * sizeof(Run)); 341 } 342 343 } 344 } -
trunk/Source/WebCore/rendering/SimpleLineLayout.h
r158265 r158268 60 60 }; 61 61 62 structLayout {62 class Layout { 63 63 WTF_MAKE_FAST_ALLOCATED; 64 64 public: … … 66 66 static std::unique_ptr<Layout> create(const RunVector&, unsigned lineCount); 67 67 68 unsigned runCount; 69 unsigned lineCount; 70 Run runs[0]; 68 unsigned lineCount() const { return m_lineCount; } 69 70 unsigned runCount() const { return m_runCount; } 71 const Run& runAt(unsigned i) const { return m_runs[i]; } 71 72 72 73 private: 73 74 Layout(const RunVector&, unsigned lineCount); 75 76 unsigned m_lineCount; 77 unsigned m_runCount; 78 Run m_runs[0]; 74 79 }; 75 80 -
trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
r158214 r158268 75 75 return false; 76 76 77 if (!layout.runCount )77 if (!layout.runCount()) 78 78 return false; 79 79 -
trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.h
r158214 r158268 66 66 inline LayoutUnit computeFlowHeight(const RenderBlockFlow& flow, const Layout& layout) 67 67 { 68 return lineHeightFromFlow(flow) * layout.lineCount ;68 return lineHeightFromFlow(flow) * layout.lineCount(); 69 69 } 70 70 71 71 inline LayoutUnit computeFlowFirstLineBaseline(const RenderBlockFlow& flow, const Layout& layout) 72 72 { 73 ASSERT_UNUSED(layout, layout.runCount );73 ASSERT_UNUSED(layout, layout.runCount()); 74 74 return flow.borderAndPaddingBefore() + baselineFromFlow(flow); 75 75 } … … 77 77 inline LayoutUnit computeFlowLastLineBaseline(const RenderBlockFlow& flow, const Layout& layout) 78 78 { 79 ASSERT(layout.runCount );80 return flow.borderAndPaddingBefore() + lineHeightFromFlow(flow) * (layout.runCount - 1) + baselineFromFlow(flow);79 ASSERT(layout.runCount()); 80 return flow.borderAndPaddingBefore() + lineHeightFromFlow(flow) * (layout.runCount() - 1) + baselineFromFlow(flow); 81 81 } 82 82 83 83 inline unsigned findTextCaretMinimumOffset(const RenderText&, const Layout& layout) 84 84 { 85 if (!layout.runCount )85 if (!layout.runCount()) 86 86 return 0; 87 return layout.run s[0].textOffset;87 return layout.runAt(0).textOffset; 88 88 } 89 89 90 90 inline unsigned findTextCaretMaximumOffset(const RenderText& renderer, const Layout& layout) 91 91 { 92 if (!layout.runCount )92 if (!layout.runCount()) 93 93 return renderer.textLength(); 94 auto& last = layout.run s[layout.runCount - 1];94 auto& last = layout.runAt(layout.runCount() - 1); 95 95 return last.textOffset + last.textLength; 96 96 } … … 98 98 inline bool containsTextCaretOffset(const RenderText&, const Layout& layout, unsigned offset) 99 99 { 100 for (unsigned i = 0; i < layout.runCount ; ++i) {101 auto& line = layout.runs[i];102 if (offset < line.textOffset)100 for (unsigned i = 0; i < layout.runCount(); ++i) { 101 auto& run = layout.runAt(i); 102 if (offset < run.textOffset) 103 103 return false; 104 if (offset <= line.textOffset + line.textLength)104 if (offset <= run.textOffset + run.textLength) 105 105 return true; 106 106 } … … 110 110 inline bool isTextRendered(const RenderText&, const Layout& layout) 111 111 { 112 for (unsigned i = 0; i < layout.runCount ; ++i) {113 if (layout.run s[i].textLength)112 for (unsigned i = 0; i < layout.runCount(); ++i) { 113 if (layout.runAt(i).textLength) 114 114 return true; 115 115 } -
trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.h
r158225 r158268 190 190 inline const SimpleLineLayout::Run& RunResolver::Iterator::simpleRun() const 191 191 { 192 return m_resolver.m_layout.run s[m_runIndex];192 return m_resolver.m_layout.runAt(m_runIndex); 193 193 } 194 194 … … 211 211 inline RunResolver::Iterator RunResolver::end() const 212 212 { 213 return Iterator(*this, m_layout.runCount );213 return Iterator(*this, m_layout.runCount()); 214 214 } 215 215
Note: See TracChangeset
for help on using the changeset viewer.