Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1036)

Unified Diff: Source/core/rendering/HitTestResult.cpp

Issue 639863006: Revert of Convert first letter into a pseudo element. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/HitTestResult.h ('k') | Source/core/rendering/RenderBlock.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/HitTestResult.cpp
diff --git a/Source/core/rendering/HitTestResult.cpp b/Source/core/rendering/HitTestResult.cpp
index 88234cf1c22f0522f6e710be2c5151a490b4b10f..2e112287ed8d5d3050c65a42f7bf6c225216acbf 100644
--- a/Source/core/rendering/HitTestResult.cpp
+++ b/Source/core/rendering/HitTestResult.cpp
@@ -47,6 +47,7 @@ using namespace HTMLNames;
HitTestResult::HitTestResult()
: m_isOverWidget(false)
+ , m_isFirstLetter(false)
{
}
@@ -54,6 +55,7 @@ HitTestResult::HitTestResult(const LayoutPoint& point)
: m_hitTestLocation(point)
, m_pointInInnerNodeFrame(point)
, m_isOverWidget(false)
+ , m_isFirstLetter(false)
{
}
@@ -61,6 +63,7 @@ HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding
: m_hitTestLocation(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding)
, m_pointInInnerNodeFrame(centerPoint)
, m_isOverWidget(false)
+ , m_isFirstLetter(false)
{
}
@@ -68,6 +71,7 @@ HitTestResult::HitTestResult(const HitTestLocation& other)
: m_hitTestLocation(other)
, m_pointInInnerNodeFrame(m_hitTestLocation.point())
, m_isOverWidget(false)
+ , m_isFirstLetter(false)
{
}
@@ -81,6 +85,7 @@ HitTestResult::HitTestResult(const HitTestResult& other)
, m_innerURLElement(other.URLElement())
, m_scrollbar(other.scrollbar())
, m_isOverWidget(other.isOverWidget())
+ , m_isFirstLetter(other.m_isFirstLetter)
{
// Only copy the NodeSet in case of rect hit test.
m_rectBasedTestResult = adoptPtrWillBeNoop(other.m_rectBasedTestResult ? new NodeSet(*other.m_rectBasedTestResult) : 0);
@@ -100,6 +105,7 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other)
m_localPoint = other.localPoint();
m_innerURLElement = other.URLElement();
m_scrollbar = other.scrollbar();
+ m_isFirstLetter = other.m_isFirstLetter;
m_isOverWidget = other.isOverWidget();
// Only copy the NodeSet in case of rect hit test.
@@ -134,7 +140,12 @@ PositionWithAffinity HitTestResult::position() const
RenderObject* HitTestResult::renderer() const
{
- return m_innerNode ? m_innerNode->renderer() : 0;
+ if (!m_innerNode)
+ return 0;
+ RenderObject* renderer = m_innerNode->renderer();
+ if (!m_isFirstLetter || !renderer || !renderer->isText() || !toRenderText(renderer)->isTextFragment())
+ return renderer;
+ return toRenderTextFragment(renderer)->firstRenderTextInFirstLetter();
}
void HitTestResult::setToShadowHostIfInUserAgentShadowRoot()
« no previous file with comments | « Source/core/rendering/HitTestResult.h ('k') | Source/core/rendering/RenderBlock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698