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

Unified Diff: sky/engine/core/rendering/RenderInline.cpp

Issue 867653005: Remove outline painting on inlines. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
Index: sky/engine/core/rendering/RenderInline.cpp
diff --git a/sky/engine/core/rendering/RenderInline.cpp b/sky/engine/core/rendering/RenderInline.cpp
index ca9f658d5680a3ce85fdebf895a9d3f869e8ae21..5e05b733d9f225d7af9e409cc9e1720a1aec1a94 100644
--- a/sky/engine/core/rendering/RenderInline.cpp
+++ b/sky/engine/core/rendering/RenderInline.cpp
@@ -256,17 +256,6 @@ private:
const LayoutPoint& m_accumulatedOffset;
};
-} // unnamed namespace
-
-void RenderInline::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
-{
- AbsoluteRectsGeneratorContext context(rects, accumulatedOffset);
- generateLineBoxRects(context);
-}
-
-
-namespace {
-
class AbsoluteQuadsGeneratorContext {
public:
AbsoluteQuadsGeneratorContext(const RenderInline* renderer, Vector<FloatQuad>& quads)
@@ -787,175 +776,4 @@ void RenderInline::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&
addChildFocusRingRects(rects, additionalOffset, paintContainer);
}
-namespace {
-
-class AbsoluteLayoutRectsGeneratorContext {
-public:
- AbsoluteLayoutRectsGeneratorContext(Vector<LayoutRect>& rects, const LayoutPoint& accumulatedOffset)
- : m_rects(rects)
- , m_accumulatedOffset(accumulatedOffset) { }
-
- void operator()(const FloatRect& rect)
- {
- LayoutRect layoutRect(rect);
- layoutRect.move(m_accumulatedOffset.x(), m_accumulatedOffset.y());
- m_rects.append(layoutRect);
- }
-private:
- Vector<LayoutRect>& m_rects;
- const LayoutPoint& m_accumulatedOffset;
-};
-
-}
-
-void RenderInline::paintOutline(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
-{
- RenderStyle* styleToUse = style();
- if (!styleToUse->hasOutline())
- return;
-
- if (styleToUse->outlineStyleIsAuto())
- return;
-
- if (styleToUse->outlineStyle() == BNONE)
- return;
-
- Vector<LayoutRect> rects;
-
- rects.append(LayoutRect());
- for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
- RootInlineBox& root = curr->root();
- LayoutUnit top = std::max<LayoutUnit>(root.lineTop(), curr->logicalTop());
- LayoutUnit bottom = std::min<LayoutUnit>(root.lineBottom(), curr->logicalBottom());
- rects.append(LayoutRect(curr->x(), top, curr->logicalWidth(), bottom - top));
- }
- rects.append(LayoutRect());
-
- Color outlineColor = resolveColor(styleToUse, CSSPropertyOutlineColor);
- bool useTransparencyLayer = outlineColor.hasAlpha();
-
- GraphicsContext* graphicsContext = paintInfo.context;
- if (useTransparencyLayer) {
- graphicsContext->beginTransparencyLayer(static_cast<float>(outlineColor.alpha()) / 255);
- outlineColor = Color(outlineColor.red(), outlineColor.green(), outlineColor.blue());
- }
-
- for (unsigned i = 1; i < rects.size() - 1; i++)
- paintOutlineForLine(graphicsContext, paintOffset, rects.at(i - 1), rects.at(i), rects.at(i + 1), outlineColor);
-
- if (useTransparencyLayer)
- graphicsContext->endLayer();
-}
-
-void RenderInline::paintOutlineForLine(GraphicsContext* graphicsContext, const LayoutPoint& paintOffset,
- const LayoutRect& lastline, const LayoutRect& thisline, const LayoutRect& nextline,
- const Color outlineColor)
-{
- RenderStyle* styleToUse = style();
- int outlineWidth = styleToUse->outlineWidth();
- EBorderStyle outlineStyle = styleToUse->outlineStyle();
-
- bool antialias = shouldAntialiasLines(graphicsContext);
-
- int offset = style()->outlineOffset();
-
- LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - offset, paintOffset.y() + thisline.y() - offset),
- LayoutSize(thisline.width() + offset, thisline.height() + offset));
-
- IntRect pixelSnappedBox = pixelSnappedIntRect(box);
- if (pixelSnappedBox.width() < 0 || pixelSnappedBox.height() < 0)
- return;
- IntRect pixelSnappedLastLine = pixelSnappedIntRect(paintOffset.x() + lastline.x(), 0, lastline.width(), 0);
- IntRect pixelSnappedNextLine = pixelSnappedIntRect(paintOffset.x() + nextline.x(), 0, nextline.width(), 0);
-
- // left edge
- drawLineForBoxSide(graphicsContext,
- pixelSnappedBox.x() - outlineWidth,
- pixelSnappedBox.y() - (lastline.isEmpty() || thisline.x() < lastline.x() || (lastline.maxX() - 1) <= thisline.x() ? outlineWidth : 0),
- pixelSnappedBox.x(),
- pixelSnappedBox.maxY() + (nextline.isEmpty() || thisline.x() <= nextline.x() || (nextline.maxX() - 1) <= thisline.x() ? outlineWidth : 0),
- BSLeft,
- outlineColor, outlineStyle,
- (lastline.isEmpty() || thisline.x() < lastline.x() || (lastline.maxX() - 1) <= thisline.x() ? outlineWidth : -outlineWidth),
- (nextline.isEmpty() || thisline.x() <= nextline.x() || (nextline.maxX() - 1) <= thisline.x() ? outlineWidth : -outlineWidth),
- antialias);
-
- // right edge
- drawLineForBoxSide(graphicsContext,
- pixelSnappedBox.maxX(),
- pixelSnappedBox.y() - (lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.maxX() - 1) <= lastline.x() ? outlineWidth : 0),
- pixelSnappedBox.maxX() + outlineWidth,
- pixelSnappedBox.maxY() + (nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.maxX() - 1) <= nextline.x() ? outlineWidth : 0),
- BSRight,
- outlineColor, outlineStyle,
- (lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.maxX() - 1) <= lastline.x() ? outlineWidth : -outlineWidth),
- (nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.maxX() - 1) <= nextline.x() ? outlineWidth : -outlineWidth),
- antialias);
- // upper edge
- if (thisline.x() < lastline.x())
- drawLineForBoxSide(graphicsContext,
- pixelSnappedBox.x() - outlineWidth,
- pixelSnappedBox.y() - outlineWidth,
- std::min(pixelSnappedBox.maxX() + outlineWidth, (lastline.isEmpty() ? 1000000 : pixelSnappedLastLine.x())),
- pixelSnappedBox.y(),
- BSTop, outlineColor, outlineStyle,
- outlineWidth,
- (!lastline.isEmpty() && paintOffset.x() + lastline.x() + 1 < pixelSnappedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth,
- antialias);
-
- if (lastline.maxX() < thisline.maxX())
- drawLineForBoxSide(graphicsContext,
- std::max(lastline.isEmpty() ? -1000000 : pixelSnappedLastLine.maxX(), pixelSnappedBox.x() - outlineWidth),
- pixelSnappedBox.y() - outlineWidth,
- pixelSnappedBox.maxX() + outlineWidth,
- pixelSnappedBox.y(),
- BSTop, outlineColor, outlineStyle,
- (!lastline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOffset.x() + lastline.maxX()) ? -outlineWidth : outlineWidth,
- outlineWidth, antialias);
-
- if (thisline.x() == thisline.maxX())
- drawLineForBoxSide(graphicsContext,
- pixelSnappedBox.x() - outlineWidth,
- pixelSnappedBox.y() - outlineWidth,
- pixelSnappedBox.maxX() + outlineWidth,
- pixelSnappedBox.y(),
- BSTop, outlineColor, outlineStyle,
- outlineWidth,
- outlineWidth,
- antialias);
-
- // lower edge
- if (thisline.x() < nextline.x())
- drawLineForBoxSide(graphicsContext,
- pixelSnappedBox.x() - outlineWidth,
- pixelSnappedBox.maxY(),
- std::min(pixelSnappedBox.maxX() + outlineWidth, !nextline.isEmpty() ? pixelSnappedNextLine.x() + 1 : 1000000),
- pixelSnappedBox.maxY() + outlineWidth,
- BSBottom, outlineColor, outlineStyle,
- outlineWidth,
- (!nextline.isEmpty() && paintOffset.x() + nextline.x() + 1 < pixelSnappedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth,
- antialias);
-
- if (nextline.maxX() < thisline.maxX())
- drawLineForBoxSide(graphicsContext,
- std::max(!nextline.isEmpty() ? pixelSnappedNextLine.maxX() : -1000000, pixelSnappedBox.x() - outlineWidth),
- pixelSnappedBox.maxY(),
- pixelSnappedBox.maxX() + outlineWidth,
- pixelSnappedBox.maxY() + outlineWidth,
- BSBottom, outlineColor, outlineStyle,
- (!nextline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOffset.x() + nextline.maxX()) ? -outlineWidth : outlineWidth,
- outlineWidth, antialias);
-
- if (thisline.x() == thisline.maxX())
- drawLineForBoxSide(graphicsContext,
- pixelSnappedBox.x() - outlineWidth,
- pixelSnappedBox.maxY(),
- pixelSnappedBox.maxX() + outlineWidth,
- pixelSnappedBox.maxY() + outlineWidth,
- BSBottom, outlineColor, outlineStyle,
- outlineWidth,
- outlineWidth,
- antialias);
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698