Commit 52e1a9f3 authored by antti@apple.com's avatar antti@apple.com
Browse files

Hovering over text using simple line path should not cause switch to line boxes

https://bugs.webkit.org/show_bug.cgi?id=124418

Reviewed by Anders Carlsson.

Source/WebCore: 

Test: fast/text/simple-lines-hover.html

* rendering/RenderText.cpp:
(WebCore::RenderText::absoluteRects):
(WebCore::RenderText::absoluteQuadsClippedToEllipsis):
(WebCore::RenderText::absoluteQuads):
        
    Collect quads and rects directly from simple lines without requiring the line box switch.

* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::collectTextAbsoluteRects):
(WebCore::SimpleLineLayout::collectTextAbsoluteQuads):
        
    Add these.

* rendering/SimpleLineLayoutFunctions.h:
* rendering/SimpleLineLayoutResolver.h:
(WebCore::SimpleLineLayout::RunResolver::Run::start):
(WebCore::SimpleLineLayout::RunResolver::Run::end):
        
    For future use.

LayoutTests: 

* fast/text/simple-lines-hover-expected.html: Added.
* fast/text/simple-lines-hover.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159345 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 17aa01ca
2013-11-15 Antti Koivisto <antti@apple.com>
Hovering over text using simple line path should not cause switch to line boxes
https://bugs.webkit.org/show_bug.cgi?id=124418
Reviewed by Anders Carlsson.
* fast/text/simple-lines-hover-expected.html: Added.
* fast/text/simple-lines-hover.html: Added.
2013-11-15 Zoltan Horvath <zoltan@webkit.org>
 
[CSS Shapes][CSS Regions] Simplify shape-inside-on-multiple-regions-with-negative-shape-top.html
......
<script>
if (window.internals)
internals.settings.setSimpleLineLayoutDebugBordersEnabled(true);
</script>
<div id="target">This text should have border around it indicating it is in simple line layout mode</div>
<style>
#target { }
</style>
<script>
function test() {
if (window.internals)
internals.settings.setSimpleLineLayoutDebugBordersEnabled(true);
var target = document.getElementById("target");
eventSender.mouseMoveTo(target.offsetLeft + 5, target.offsetTop + 5);
}
</script>
<body onload="test()">
<div id="target">This text should have border around it indicating it is in simple line layout mode</div>
2013-11-15 Antti Koivisto <antti@apple.com>
Hovering over text using simple line path should not cause switch to line boxes
https://bugs.webkit.org/show_bug.cgi?id=124418
Reviewed by Anders Carlsson.
Test: fast/text/simple-lines-hover.html
* rendering/RenderText.cpp:
(WebCore::RenderText::absoluteRects):
(WebCore::RenderText::absoluteQuadsClippedToEllipsis):
(WebCore::RenderText::absoluteQuads):
Collect quads and rects directly from simple lines without requiring the line box switch.
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::collectTextAbsoluteRects):
(WebCore::SimpleLineLayout::collectTextAbsoluteQuads):
Add these.
* rendering/SimpleLineLayoutFunctions.h:
* rendering/SimpleLineLayoutResolver.h:
(WebCore::SimpleLineLayout::RunResolver::Run::start):
(WebCore::SimpleLineLayout::RunResolver::Run::end):
For future use.
2013-11-15 Radu Stavila <stavila@adobe.com>
 
[CSS Regions] Implement visual overflow for first & last regions
......
......@@ -276,9 +276,10 @@ String RenderText::originalText() const
void RenderText::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
{
// FIXME: These will go away when simple layout can do everything.
const_cast<RenderText&>(*this).ensureLineBoxes();
if (auto layout = simpleLineLayout()) {
rects.appendVector(collectTextAbsoluteRects(*this, *layout, accumulatedOffset));
return;
}
rects.appendVector(m_lineBoxes.absoluteRects(accumulatedOffset));
}
......@@ -301,15 +302,19 @@ Vector<IntRect> RenderText::absoluteRectsForRange(unsigned start, unsigned end,
Vector<FloatQuad> RenderText::absoluteQuadsClippedToEllipsis() const
{
const_cast<RenderText&>(*this).ensureLineBoxes();
if (auto layout = simpleLineLayout()) {
ASSERT(style().textOverflow() != TextOverflowEllipsis);
return collectTextAbsoluteQuads(*this, *layout, nullptr);
}
return m_lineBoxes.absoluteQuads(*this, nullptr, RenderTextLineBoxes::ClipToEllipsis);
}
void RenderText::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
{
const_cast<RenderText&>(*this).ensureLineBoxes();
if (auto layout = simpleLineLayout()) {
quads.appendVector(collectTextAbsoluteQuads(*this, *layout, wasFixed));
return;
}
quads.appendVector(m_lineBoxes.absoluteQuads(*this, wasFixed, RenderTextLineBoxes::NoClipping));
}
......
......@@ -155,5 +155,29 @@ IntRect computeTextBoundingBox(const RenderText& textRenderer, const Layout& lay
return enclosingIntRect(FloatRect(x, y, width, height));
}
Vector<IntRect> collectTextAbsoluteRects(const RenderText& textRenderer, const Layout& layout, const LayoutPoint& accumulatedOffset)
{
Vector<IntRect> rects;
auto resolver = runResolver(toRenderBlockFlow(*textRenderer.parent()), layout);
for (auto it = resolver.begin(), end = resolver.end(); it != end; ++it) {
auto run = *it;
auto rect = run.rect();
rects.append(enclosingIntRect(FloatRect(accumulatedOffset + rect.location(), rect.size())));
}
return rects;
}
Vector<FloatQuad> collectTextAbsoluteQuads(const RenderText& textRenderer, const Layout& layout, bool* wasFixed)
{
Vector<FloatQuad> quads;
auto resolver = runResolver(toRenderBlockFlow(*textRenderer.parent()), layout);
for (auto it = resolver.begin(), end = resolver.end(); it != end; ++it) {
auto run = *it;
auto rect = run.rect();
quads.append(textRenderer.localToAbsoluteQuad(FloatQuad(rect), 0, wasFixed));
}
return quads;
}
}
}
......@@ -56,6 +56,9 @@ unsigned findTextCaretMinimumOffset(const RenderText&, const Layout&);
unsigned findTextCaretMaximumOffset(const RenderText&, const Layout&);
IntRect computeTextBoundingBox(const RenderText&, const Layout&);
Vector<IntRect> collectTextAbsoluteRects(const RenderText&, const Layout&, const LayoutPoint& accumulatedOffset);
Vector<FloatQuad> collectTextAbsoluteQuads(const RenderText&, const Layout&, bool* wasFixed);
LayoutUnit lineHeightFromFlow(const RenderBlockFlow&);
LayoutUnit baselineFromFlow(const RenderBlockFlow&);
......
......@@ -44,6 +44,9 @@ public:
public:
explicit Run(const Iterator&);
unsigned start() const;
unsigned end() const;
LayoutRect rect() const;
FloatPoint baseline() const;
String text() const;
......@@ -125,6 +128,16 @@ inline RunResolver::Run::Run(const Iterator& iterator)
{
}
inline unsigned RunResolver::Run::start() const
{
return m_iterator.simpleRun().start;
}
inline unsigned RunResolver::Run::end() const
{
return m_iterator.simpleRun().end;
}
inline LayoutRect RunResolver::Run::rect() const
{
auto& resolver = m_iterator.resolver();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment