Changeset 177219 in webkit
- Timestamp:
- Dec 12, 2014 3:49:51 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r177203 r177219 1 2014-12-12 Zalan Bujtas <zalan@apple.com> 2 3 Simple line layout: Add 16bit support. 4 https://bugs.webkit.org/show_bug.cgi?id=139469 5 6 Reviewed by Antti Koivisto. 7 8 This patch adds the 16bit support to simple line layout. 9 10 * fast/inline/simple-line-layout-16bit-content-expected.html: Added. 11 * fast/inline/simple-line-layout-16bit-content.html: Added. 12 1 13 2014-12-11 Michael Saboff <msaboff@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r177216 r177219 1 2014-12-12 Zalan Bujtas <zalan@apple.com> 2 3 Simple line layout: Add 16bit support. 4 https://bugs.webkit.org/show_bug.cgi?id=139469 5 6 Reviewed by Antti Koivisto. 7 8 This patch adds the 16bit support to simple line layout. 9 10 Test: fast/inline/simple-line-layout-16bit-content.html 11 12 * rendering/SimpleLineLayout.cpp: 13 (WebCore::SimpleLineLayout::canUseFor): 14 * rendering/SimpleLineLayoutFlowContents.cpp: 15 (WebCore::SimpleLineLayout::nextBreakablePosition): 16 (WebCore::SimpleLineLayout::FlowContents::findNextBreakablePosition): 17 (WebCore::SimpleLineLayout::findNextNonWhitespace): 18 (WebCore::SimpleLineLayout::FlowContents::findNextNonWhitespacePosition): 19 (WebCore::SimpleLineLayout::FlowContents::textWidth): 20 (WebCore::SimpleLineLayout::FlowContents::runWidth): 21 * rendering/SimpleLineLayoutFlowContents.h: 22 * rendering/SimpleLineLayoutResolver.cpp: 23 (WebCore::SimpleLineLayout::RunResolver::Run::text): 24 1 25 2014-12-12 ChangSeok Oh <changseok.oh@collabora.com> 2 26 -
trunk/Source/WebCore/rendering/SimpleLineLayout.cpp
r176534 r177219 98 98 // The <blockflow><inline>#text</inline></blockflow> case is also popular and should be relatively easy to cover. 99 99 for (const auto& renderer : childrenOfType<RenderObject>(flow)) { 100 if (!is<RenderText>(renderer) || !downcast<RenderText>(renderer).text()->is8Bit())100 if (!is<RenderText>(renderer)) 101 101 return false; 102 102 } -
trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp
r176528 r177219 67 67 } 68 68 69 template <typename CharacterType> 70 static unsigned nextBreakablePosition(LazyLineBreakIterator& lineBreakItearator, const FlowContents::Segment& segment, unsigned position) 71 { 72 const auto* characters = segment.text.characters<CharacterType>(); 73 unsigned segmentLength = segment.end - segment.start; 74 unsigned segmentPosition = position - segment.start; 75 return nextBreakablePositionNonLoosely<CharacterType, NBSPBehavior::IgnoreNBSP>(lineBreakItearator, characters, segmentLength, segmentPosition); 76 } 77 69 78 unsigned FlowContents::findNextBreakablePosition(unsigned position) const 70 79 { … … 78 87 } 79 88 80 auto* characters = segment.text.characters8(); 81 unsigned segmentLength = segment.end - segment.start; 82 unsigned segmentPosition = position - segment.start; 83 unsigned breakable = nextBreakablePositionNonLoosely<LChar, NBSPBehavior::IgnoreNBSP>(m_lineBreakIterator, characters, segmentLength, segmentPosition); 89 unsigned breakable = segment.text.is8Bit() ? nextBreakablePosition<LChar>(m_lineBreakIterator, segment, position) : nextBreakablePosition<UChar>(m_lineBreakIterator, segment, position); 84 90 position = segment.start + breakable; 85 91 if (position < segment.end) … … 89 95 } 90 96 97 template <typename CharacterType> 91 98 static bool findNextNonWhitespace(const FlowContents::Segment& segment, const FlowContents::Style& style, unsigned& position, unsigned& spaceCount) 92 99 { 93 const LChar* text = segment.text.characters8();100 const auto* text = segment.text.characters<CharacterType>(); 94 101 for (; position < segment.end; ++position) { 95 102 auto character = text[position - segment.start]; … … 107 114 { 108 115 for (unsigned i = segmentIndexForPosition(position); i < m_segments.size(); ++i) { 109 if (findNextNonWhitespace(m_segments[i], m_style, position, spaceCount)) 116 bool foundNonWhitespace = m_segments[i].text.is8Bit() ? findNextNonWhitespace<LChar>(m_segments[i], m_style, position, spaceCount) : 117 findNextNonWhitespace<UChar>(m_segments[i], m_style, position, spaceCount); 118 if (foundNonWhitespace) 110 119 break; 111 120 } … … 115 124 float FlowContents::textWidth(unsigned from, unsigned to, float xPosition) const 116 125 { 117 auto& fromSegment = segmentForPosition(from);126 const auto& fromSegment = segmentForPosition(from); 118 127 119 128 if ((m_style.font.isFixedPitch() && fromSegment.end >= to) || (from == fromSegment.start && to == fromSegment.end)) 120 129 return fromSegment.renderer.width(from - fromSegment.start, to - from, m_style.font, xPosition, nullptr, nullptr); 121 130 122 auto* segment = &fromSegment;131 const auto* segment = &fromSegment; 123 132 float textWidth = 0; 124 133 unsigned fragmentEnd = 0; 125 134 while (true) { 126 135 fragmentEnd = std::min(to, segment->end); 127 textWidth += runWidth(segment->text, from - segment->start, fragmentEnd - segment->start, xPosition + textWidth); 136 textWidth += segment->text.is8Bit() ? runWidth<LChar>(segment->text, from - segment->start, fragmentEnd - segment->start, xPosition + textWidth) : 137 runWidth<UChar>(segment->text, from - segment->start, fragmentEnd - segment->start, xPosition + textWidth); 128 138 if (fragmentEnd == to) 129 139 break; … … 156 166 } 157 167 168 template <typename CharacterType> 158 169 float FlowContents::runWidth(const String& text, unsigned from, unsigned to, float xPosition) const 159 170 { … … 162 173 if (measureWithEndSpace) 163 174 ++to; 164 TextRun run(text.characters 8() + from, to - from);175 TextRun run(text.characters<CharacterType>() + from, to - from); 165 176 run.setXPos(xPosition); 166 177 run.setTabSize(!!m_style.tabWidth, m_style.tabWidth); -
trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h
r176531 r177219 81 81 82 82 UChar characterAt(unsigned position) const; 83 float runWidth(const String&, unsigned from, unsigned to, float xPosition) const;83 template <typename CharacterType> float runWidth(const String&, unsigned from, unsigned to, float xPosition) const; 84 84 85 85 const Style m_style; -
trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp
r176510 r177219 78 78 auto& run = m_iterator.simpleRun(); 79 79 auto& segment = resolver.m_flowContents.segmentForPosition(run.start); 80 ASSERT(segment.renderer.is8Bit());81 80 // We currently split runs on segment boundaries (different RenderText). 82 81 ASSERT(run.end <= segment.end); 83 return StringView(segment.renderer.characters8(), segment.renderer.textLength()).substring(run.start - segment.start, run.end - run.start); 82 if (segment.renderer.is8Bit()) 83 return StringView(segment.renderer.characters8(), segment.renderer.textLength()).substring(run.start - segment.start, run.end - run.start); 84 return StringView(segment.renderer.characters16(), segment.renderer.textLength()).substring(run.start - segment.start, run.end - run.start); 84 85 } 85 86
Note: See TracChangeset
for help on using the changeset viewer.