Modified: trunk/Source/WebCore/ChangeLog (168436 => 168437)
--- trunk/Source/WebCore/ChangeLog 2014-05-07 19:59:16 UTC (rev 168436)
+++ trunk/Source/WebCore/ChangeLog 2014-05-07 20:03:13 UTC (rev 168437)
@@ -1,3 +1,17 @@
+2014-05-07 Dean Jackson <d...@apple.com>
+
+ Clean up the difference between painting focus rings and adding PDF annotations
+ https://bugs.webkit.org/show_bug.cgi?id=132638
+
+ Follow-up comments from Darin Adler.
+
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::paintOutline): Move "else if" to a separate "if" for clarity.
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::paintFocusRing): Don't guard against outlineIsAuto(). ASSERT instead.
+ (WebCore::RenderObject::addPDFURLRect): Give "rect" variable a better name.
+ (WebCore::RenderObject::paintOutline): Move "else if" to a separate "if" for clarity.
+
2014-05-07 Alexey Proskuryakov <a...@apple.com>
Make blob size computation lazy
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (168436 => 168437)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2014-05-07 19:59:16 UTC (rev 168436)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2014-05-07 20:03:13 UTC (rev 168437)
@@ -1490,12 +1490,13 @@
{
if (!hasOutline())
return;
-
+
RenderStyle& styleToUse = style();
// Only paint the focus ring by hand if the theme isn't able to draw it.
if (styleToUse.outlineStyleIsAuto() && !theme().supportsFocusRing(&styleToUse))
paintFocusRing(paintInfo, paintOffset, &styleToUse);
- else if (hasOutlineAnnotation() && !theme().supportsFocusRing(&styleToUse))
+
+ if (hasOutlineAnnotation() && !styleToUse.outlineStyleIsAuto() && !theme().supportsFocusRing(&styleToUse))
addPDFURLRect(paintInfo, paintOffset);
GraphicsContext* graphicsContext = paintInfo.context;
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (168436 => 168437)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2014-05-07 19:59:16 UTC (rev 168436)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2014-05-07 20:03:13 UTC (rev 168437)
@@ -999,27 +999,27 @@
void RenderObject::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paintOffset, RenderStyle* style)
{
- if (style->outlineStyleIsAuto()) {
- Vector<IntRect> focusRingRects;
- addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer);
+ ASSERT(style->outlineStyleIsAuto());
+
+ Vector<IntRect> focusRingRects;
+ addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer);
#if PLATFORM(MAC)
- bool needsRepaint;
- paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), document().page()->focusController().timeSinceFocusWasSet(), needsRepaint);
- if (needsRepaint)
- document().page()->focusController().setFocusedElementNeedsRepaint();
+ bool needsRepaint;
+ paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), document().page()->focusController().timeSinceFocusWasSet(), needsRepaint);
+ if (needsRepaint)
+ document().page()->focusController().setFocusedElementNeedsRepaint();
#else
- paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), style->visitedDependentColor(CSSPropertyOutlineColor));
+ paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), style->visitedDependentColor(CSSPropertyOutlineColor));
#endif
- }
}
void RenderObject::addPDFURLRect(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
Vector<IntRect> focusRingRects;
addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer);
- IntRect rect = unionRect(focusRingRects);
+ IntRect urlRect = unionRect(focusRingRects);
- if (rect.isEmpty())
+ if (urlRect.isEmpty())
return;
Node* n = node();
if (!n || !n->isLink() || !n->isElementNode())
@@ -1027,7 +1027,7 @@
const AtomicString& href = ""
if (href.isNull())
return;
- paintInfo.context->setURLForRect(n->document().completeURL(href), pixelSnappedIntRect(rect));
+ paintInfo.context->setURLForRect(n->document().completeURL(href), pixelSnappedIntRect(urlRect));
}
void RenderObject::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRect)
@@ -1043,7 +1043,8 @@
// Only paint the focus ring by hand if the theme isn't able to draw it.
if (styleToUse.outlineStyleIsAuto() && !theme().supportsFocusRing(&styleToUse))
paintFocusRing(paintInfo, paintRect.location(), &styleToUse);
- else if (hasOutlineAnnotation() && !theme().supportsFocusRing(&styleToUse))
+
+ if (hasOutlineAnnotation() && !styleToUse.outlineStyleIsAuto() && !theme().supportsFocusRing(&styleToUse))
addPDFURLRect(paintInfo, paintRect.location());
if (styleToUse.outlineStyleIsAuto() || styleToUse.outlineStyle() == BNONE)