Title: [151322] trunk/Source/WebCore
- Revision
- 151322
- Author
- [email protected]
- Date
- 2013-06-07 08:36:15 -0700 (Fri, 07 Jun 2013)
Log Message
[rendering] Use foreground color to render the overtype caret
https://bugs.webkit.org/show_bug.cgi?id=117347
Reviewed by Darin Adler.
Currently, the overtype caret is rendered using the colors of
a normal selection, which is confusing. This patch enables RenderObject
to differentiate between a normal and a overtype caret selection,
in order to use a different color for the latter.
Also, let RenderView update the selection if this is unchanged
when going from a overtype caret to one character selection and
viceversa.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::selectionBackgroundColor):
* rendering/RenderView.cpp:
(WebCore::RenderView::setSelection):
* rendering/RenderView.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (151321 => 151322)
--- trunk/Source/WebCore/ChangeLog 2013-06-07 15:32:38 UTC (rev 151321)
+++ trunk/Source/WebCore/ChangeLog 2013-06-07 15:36:15 UTC (rev 151322)
@@ -1,3 +1,25 @@
+2013-06-07 Claudio Saavedra <[email protected]>
+
+ [rendering] Use foreground color to render the overtype caret
+ https://bugs.webkit.org/show_bug.cgi?id=117347
+
+ Reviewed by Darin Adler.
+
+ Currently, the overtype caret is rendered using the colors of
+ a normal selection, which is confusing. This patch enables RenderObject
+ to differentiate between a normal and a overtype caret selection,
+ in order to use a different color for the latter.
+
+ Also, let RenderView update the selection if this is unchanged
+ when going from a overtype caret to one character selection and
+ viceversa.
+
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::selectionBackgroundColor):
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::setSelection):
+ * rendering/RenderView.h:
+
2013-06-07 Christophe Dumez <[email protected]>
Get rid of outdated getter / setter raises from Web IDL
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (151321 => 151322)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2013-06-07 15:32:38 UTC (rev 151321)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2013-06-07 15:36:15 UTC (rev 151322)
@@ -1628,13 +1628,15 @@
{
Color color;
if (style()->userSelect() != SELECT_NONE) {
- RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
- if (pseudoStyle && pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
- color = pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).blendWithWhite();
- else
- color = frame()->selection()->isFocusedAndActive() ?
- theme()->activeSelectionBackgroundColor() :
- theme()->inactiveSelectionBackgroundColor();
+ if (frame()->selection()->shouldShowBlockCursor() && frame()->selection()->isCaret())
+ color = style()->visitedDependentColor(CSSPropertyColor).blendWithWhite();
+ else {
+ RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
+ if (pseudoStyle && pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
+ color = pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).blendWithWhite();
+ else
+ color = frame()->selection()->isFocusedAndActive() ? theme()->activeSelectionBackgroundColor() : theme()->inactiveSelectionBackgroundColor();
+ }
}
return color;
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (151321 => 151322)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2013-06-07 15:32:38 UTC (rev 151321)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2013-06-07 15:36:15 UTC (rev 151322)
@@ -27,6 +27,7 @@
#include "FloatQuad.h"
#include "FlowThreadController.h"
#include "Frame.h"
+#include "FrameSelection.h"
#include "FrameView.h"
#include "GraphicsContext.h"
#include "HTMLFrameOwnerElement.h"
@@ -68,6 +69,7 @@
, m_layoutStateDisableCount(0)
, m_renderQuoteHead(0)
, m_renderCounterCount(0)
+ , m_selectionWasCaret(false)
{
// init RenderObject attributes
setInline(false);
@@ -691,9 +693,11 @@
if ((start && !end) || (end && !start))
return;
+ bool caretChanged = m_selectionWasCaret != view()->frame()->selection()->isCaret();
+ m_selectionWasCaret = view()->frame()->selection()->isCaret();
// Just return if the selection hasn't changed.
if (m_selectionStart == start && m_selectionStartPos == startPos &&
- m_selectionEnd == end && m_selectionEndPos == endPos)
+ m_selectionEnd == end && m_selectionEndPos == endPos && !caretChanged)
return;
if ((start && end) && (start->flowThreadContainingBlock() != end->flowThreadContainingBlock()))
Modified: trunk/Source/WebCore/rendering/RenderView.h (151321 => 151322)
--- trunk/Source/WebCore/rendering/RenderView.h 2013-06-07 15:32:38 UTC (rev 151321)
+++ trunk/Source/WebCore/rendering/RenderView.h 2013-06-07 15:36:15 UTC (rev 151322)
@@ -340,6 +340,8 @@
RenderQuote* m_renderQuoteHead;
unsigned m_renderCounterCount;
+
+ bool m_selectionWasCaret;
};
inline RenderView* toRenderView(RenderObject* object)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes