WebKit Bugzilla
Attachment 339562 Details for
Bug 185276
: [Simple line layout] Add support for line layout box generation with multiple text renderers.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185276-20180504102946.patch (text/plain), 5.42 KB, created by
zalan
on 2018-05-04 10:29:46 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-05-04 10:29:46 PDT
Size:
5.42 KB
patch
obsolete
>Subversion Revision: 231175 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 895e2ef9312b218c2c6b621c7208ec1646ab2b6b..fae2c1e0b63c15904fe062f62c0c176b9d19dc60 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2018-05-03 Zalan Bujtas <zalan@apple.com> >+ >+ [Simple line layout] Add support for line layout box generation with multiple text renderers. >+ https://bugs.webkit.org/show_bug.cgi?id=185276 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Covered by existing tests. >+ >+ * rendering/SimpleLineLayoutFunctions.cpp: >+ (WebCore::SimpleLineLayout::canUseForLineBoxTree): >+ (WebCore::SimpleLineLayout::generateLineBoxTree): >+ * rendering/SimpleLineLayoutResolver.cpp: >+ (WebCore::SimpleLineLayout::RunResolver::Run::renderer const): >+ (WebCore::SimpleLineLayout::RunResolver::Run::localStart const): >+ (WebCore::SimpleLineLayout::RunResolver::Run::localEnd const): >+ * rendering/SimpleLineLayoutResolver.h: >+ > 2018-04-30 JF Bastien <jfbastien@apple.com> > > Use some C++17 features >diff --git a/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp b/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp >index 83321b08f65a2d0fbb756de349e85ba3e832736f..43b4d2669d1da5563ba743734e248c27393a7957 100644 >--- a/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp >+++ b/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp >@@ -38,6 +38,7 @@ > #include "LineInfo.h" > #include "PaintInfo.h" > #include "RenderBlockFlow.h" >+#include "RenderChildIterator.h" > #include "RenderIterator.h" > #include "RenderStyle.h" > #include "RenderText.h" >@@ -283,12 +284,13 @@ bool canUseForLineBoxTree(RenderBlockFlow& flow, const Layout& layout) > if (!flow.firstChild()) > return false; > >- if (flow.firstChild() != flow.lastChild()) >- return false; >- >- if (!is<RenderText>(*flow.firstChild())) >- return false; >- >+ for (auto& child : childrenOfType<RenderObject>(flow)) { >+ if (!is<RenderText>(child)) >+ return false; >+ // Simple line layout iterator can't handle renderers with zero length properly. >+ if (!downcast<RenderText>(child).length()) >+ return false; >+ } > return true; > } > >@@ -328,7 +330,7 @@ void generateLineBoxTree(RenderBlockFlow& flow, const Layout& layout) > BidiRunList<BidiRun> bidiRuns; > for (auto it = range.begin(); it != range.end(); ++it) { > auto run = *it; >- bidiRuns.appendRun(std::make_unique<BidiRun>(run.start(), run.end(), *flow.firstChild(), bidiContext.ptr(), U_LEFT_TO_RIGHT)); >+ bidiRuns.appendRun(std::make_unique<BidiRun>(run.localStart(), run.localEnd(), const_cast<RenderObject&>(run.renderer()), bidiContext.ptr(), U_LEFT_TO_RIGHT)); > } > > LineInfo lineInfo; >diff --git a/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp b/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp >index 4764295c21faf006036a37ce572b0a2d2bac8cd5..3e17cc9a21a2d74296a5037a440be7b71869d581 100644 >--- a/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp >+++ b/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp >@@ -88,6 +88,30 @@ StringView RunResolver::Run::text() const > return StringView(segment.text).substring(segment.toSegmentPosition(run.start), run.end - run.start); > } > >+const RenderObject& RunResolver::Run::renderer() const >+{ >+ auto& run = m_iterator.simpleRun(); >+ // FlowContents cannot differentiate empty runs. >+ ASSERT(run.start != run.end); >+ return m_iterator.resolver().m_flowContents.segmentForRun(run.start, run.end).renderer; >+} >+ >+unsigned RunResolver::Run::localStart() const >+{ >+ auto& run = m_iterator.simpleRun(); >+ // FlowContents cannot differentiate empty runs. >+ ASSERT(run.start != run.end); >+ return m_iterator.resolver().m_flowContents.segmentForRun(run.start, run.end).toSegmentPosition(run.start); >+} >+ >+unsigned RunResolver::Run::localEnd() const >+{ >+ auto& run = m_iterator.simpleRun(); >+ // FlowContents cannot differentiate empty runs. >+ ASSERT(run.start != run.end); >+ return m_iterator.resolver().m_flowContents.segmentForRun(run.start, run.end).toSegmentPosition(run.end); >+} >+ > RunResolver::Iterator::Iterator(const RunResolver& resolver, unsigned runIndex, unsigned lineIndex) > : m_resolver(resolver) > , m_runIndex(runIndex) >diff --git a/Source/WebCore/rendering/SimpleLineLayoutResolver.h b/Source/WebCore/rendering/SimpleLineLayoutResolver.h >index 0e8f207a99a6f4ef42bb913dc5ee8b22431b377c..736b8cb253d71a13fc065fd4a7438ef365592e2e 100644 >--- a/Source/WebCore/rendering/SimpleLineLayoutResolver.h >+++ b/Source/WebCore/rendering/SimpleLineLayoutResolver.h >@@ -43,8 +43,13 @@ public: > public: > explicit Run(const Iterator&); > >+ // Position relative to the enclosing flow block. > unsigned start() const; > unsigned end() const; >+ // Position relative to the actual renderer. >+ unsigned localStart() const; >+ unsigned localEnd() const; >+ > float logicalLeft() const; > float logicalRight() const; > >@@ -54,6 +59,7 @@ public: > int baselinePosition() const; > StringView text() const; > String textWithHyphen() const; >+ const RenderObject& renderer() const; > bool isEndOfLine() const; > bool hasHyphen() const { return m_iterator.simpleRun().hasHyphen; } > const SimpleLineLayout::Run& simpleRun() const { return m_iterator.simpleRun(); }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185276
:
339485
|
339513
| 339562