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

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp

Issue 2531943002: Unify HTML and SVG coordinates of LayoutSVGText (Closed)
Patch Set: - Created 4 years, 1 month 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
Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
index e5688e916c765961501517c8839e90f135f2aaea..a64f5e1ab3c5e88a067713275914f04df7ee939a 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
@@ -249,17 +249,14 @@ void LayoutSVGText::layout() {
m_needsReordering = false;
- // If we don't have any line boxes, then make sure the frame rect is still
- // cleared.
- if (!firstLineBox())
- setFrameRect(LayoutRect());
+ FloatRect newBoundaries = objectBoundingBox();
+ if (!updateParentBoundaries)
+ updateParentBoundaries = oldBoundaries != newBoundaries;
m_overflow.reset();
+ addSelfVisualOverflow(LayoutRect(newBoundaries));
addVisualEffectOverflow();
- if (!updateParentBoundaries)
- updateParentBoundaries = oldBoundaries != objectBoundingBox();
-
// Invalidate all resources of this client if our layout changed.
if (everHadLayout() && selfNeedsLayout())
SVGResourcesCache::clientLayoutChanged(this);
@@ -330,7 +327,9 @@ PositionWithAffinity LayoutSVGText::positionForPoint(
return createPositionWithAffinity(0);
LayoutPoint clippedPointInContents(pointInContents);
+ clippedPointInContents.moveBy(-rootBox->topLeft());
clippedPointInContents.clampNegativeToZero();
+ clippedPointInContents.moveBy(rootBox->topLeft());
ASSERT(!rootBox->nextRootBox());
ASSERT(childrenInline());
@@ -354,6 +353,12 @@ void LayoutSVGText::paint(const PaintInfo& paintInfo,
SVGTextPainter(*this).paint(paintInfo);
}
+FloatRect LayoutSVGText::objectBoundingBox() const {
+ if (const RootInlineBox* box = firstRootBox())
+ return FloatRect(box->frameRect());
+ return FloatRect();
+}
+
FloatRect LayoutSVGText::strokeBoundingBox() const {
FloatRect strokeBoundaries = objectBoundingBox();
const SVGComputedStyle& svgStyle = style()->svgStyle();
@@ -378,6 +383,12 @@ FloatRect LayoutSVGText::visualRectInLocalSVGCoordinates() const {
return visualRect;
}
+void LayoutSVGText::addOutlineRects(Vector<LayoutRect>& rects,
+ const LayoutPoint&,
+ IncludeBlockVisualOverflowOrNot) const {
+ rects.append(LayoutRect(objectBoundingBox()));
+}
+
bool LayoutSVGText::isObjectBoundingBoxValid() const {
// If we don't have any line boxes, then consider the bbox invalid.
return firstLineBox();

Powered by Google App Engine
This is Rietveld 408576698