Title: [181682] trunk/Source/WebCore
- Revision
- 181682
- Author
- [email protected]
- Date
- 2015-03-17 20:40:51 -0700 (Tue, 17 Mar 2015)
Log Message
Simple line layout: Change FlowContents::segmentForPosition() to segmentForRun().
https://bugs.webkit.org/show_bug.cgi?id=142785
Reviewed by Antti Koivisto.
This is in transition to support <br>. A particular position could point to multiple
segments when <br> is directly followed by text.
No change in functionality.
* rendering/SimpleLineLayoutFlowContents.cpp:
(WebCore::SimpleLineLayout::FlowContents::segmentIndexForRunSlow):
(WebCore::SimpleLineLayout::FlowContents::segmentIndexForPositionSlow): Deleted.
* rendering/SimpleLineLayoutFlowContents.h:
(WebCore::SimpleLineLayout::FlowContents::segmentForRun):
(WebCore::SimpleLineLayout::FlowContents::segmentIndexForPosition): Deleted.
(WebCore::SimpleLineLayout::FlowContents::segmentForPosition): Deleted.
* rendering/SimpleLineLayoutResolver.cpp:
(WebCore::SimpleLineLayout::RunResolver::Run::text):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (181681 => 181682)
--- trunk/Source/WebCore/ChangeLog 2015-03-18 02:42:30 UTC (rev 181681)
+++ trunk/Source/WebCore/ChangeLog 2015-03-18 03:40:51 UTC (rev 181682)
@@ -1,3 +1,25 @@
+2015-03-17 Zalan Bujtas <[email protected]>
+
+ Simple line layout: Change FlowContents::segmentForPosition() to segmentForRun().
+ https://bugs.webkit.org/show_bug.cgi?id=142785
+
+ Reviewed by Antti Koivisto.
+
+ This is in transition to support <br>. A particular position could point to multiple
+ segments when <br> is directly followed by text.
+
+ No change in functionality.
+
+ * rendering/SimpleLineLayoutFlowContents.cpp:
+ (WebCore::SimpleLineLayout::FlowContents::segmentIndexForRunSlow):
+ (WebCore::SimpleLineLayout::FlowContents::segmentIndexForPositionSlow): Deleted.
+ * rendering/SimpleLineLayoutFlowContents.h:
+ (WebCore::SimpleLineLayout::FlowContents::segmentForRun):
+ (WebCore::SimpleLineLayout::FlowContents::segmentIndexForPosition): Deleted.
+ (WebCore::SimpleLineLayout::FlowContents::segmentForPosition): Deleted.
+ * rendering/SimpleLineLayoutResolver.cpp:
+ (WebCore::SimpleLineLayout::RunResolver::Run::text):
+
2015-03-17 Chris Dumez <[email protected]>
[Mac][iOS] setSharedTimerFireInterval() / stopSharedTimer() are expensive
Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp (181681 => 181682)
--- trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp 2015-03-18 02:42:30 UTC (rev 181681)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp 2015-03-18 03:40:51 UTC (rev 181682)
@@ -51,12 +51,13 @@
{
}
-unsigned FlowContents::segmentIndexForPositionSlow(unsigned position) const
+unsigned FlowContents::segmentIndexForRunSlow(unsigned start, unsigned end) const
{
- auto it = std::lower_bound(m_segments.begin(), m_segments.end(), position, [](const Segment& segment, unsigned position) {
- return segment.end <= position;
+ auto it = std::lower_bound(m_segments.begin(), m_segments.end(), start, [](const Segment& segment, unsigned start) {
+ return segment.end <= start;
});
ASSERT(it != m_segments.end());
+ ASSERT_UNUSED(end, end <= it->end);
auto index = it - m_segments.begin();
m_lastSegmentIndex = index;
return index;
Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h (181681 => 181682)
--- trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h 2015-03-18 02:42:30 UTC (rev 181681)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h 2015-03-18 03:40:51 UTC (rev 181682)
@@ -43,7 +43,7 @@
String text;
const RenderObject& renderer;
};
- const Segment& segmentForPosition(unsigned) const;
+ const Segment& segmentForRun(unsigned start, unsigned end) const;
const Segment& segmentForRenderer(const RenderObject&) const;
class Iterator {
@@ -69,10 +69,8 @@
Iterator begin() const { return Iterator(*this, 0); }
Iterator end() const { return Iterator(*this, m_segments.size()); }
- unsigned segmentIndexForPosition(unsigned position) const;
-
private:
- unsigned segmentIndexForPositionSlow(unsigned position) const;
+ unsigned segmentIndexForRunSlow(unsigned start, unsigned end) const;
const Vector<Segment, 8> m_segments;
mutable unsigned m_lastSegmentIndex;
};
@@ -111,20 +109,16 @@
return &(m_flowContents.m_segments[m_segmentIndex]);
}
-inline unsigned FlowContents::segmentIndexForPosition(unsigned position) const
+inline const FlowContents::Segment& FlowContents::segmentForRun(unsigned start, unsigned end) const
{
+ ASSERT(start < end);
auto& lastSegment = m_segments[m_lastSegmentIndex];
- if (lastSegment.start <= position && position < lastSegment.end)
- return m_lastSegmentIndex;
- return segmentIndexForPositionSlow(position);
+ if (lastSegment.start <= start && end <= lastSegment.end)
+ return m_segments[m_lastSegmentIndex];
+ return m_segments[segmentIndexForRunSlow(start, end)];
}
-inline const FlowContents::Segment& FlowContents::segmentForPosition(unsigned position) const
-{
- return m_segments[segmentIndexForPosition(position)];
}
-
}
-}
#endif
Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp (181681 => 181682)
--- trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp 2015-03-18 02:42:30 UTC (rev 181681)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp 2015-03-18 03:40:51 UTC (rev 181682)
@@ -76,7 +76,8 @@
{
auto& resolver = m_iterator.resolver();
auto& run = m_iterator.simpleRun();
- auto& segment = resolver.m_flowContents.segmentForPosition(run.start);
+ ASSERT(run.start < run.end);
+ auto& segment = resolver.m_flowContents.segmentForRun(run.start, run.end);
// We currently split runs on segment boundaries (different RenderObject).
ASSERT(run.end <= segment.end);
if (segment.text.is8Bit())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes