Title: [175009] branches/safari-600.2-branch

Diff

Modified: branches/safari-600.2-branch/LayoutTests/ChangeLog (175008 => 175009)


--- branches/safari-600.2-branch/LayoutTests/ChangeLog	2014-10-22 01:35:50 UTC (rev 175008)
+++ branches/safari-600.2-branch/LayoutTests/ChangeLog	2014-10-22 01:40:47 UTC (rev 175009)
@@ -1,3 +1,19 @@
+2014-10-21  Dana Burkart  <[email protected]>
+
+        Merge r173246
+
+    2014-09-03  Myles C. Maxfield  <[email protected]>
+
+            Text caret changes to color of text in Mail and Notes
+            https://bugs.webkit.org/show_bug.cgi?id=135904
+
+            Reviewed by Simon Fraser.
+
+            Make sure the caret is the correct color.
+
+            * editing/caret/color-span-inside-editable-expected.html: Added.
+            * editing/caret/color-span-inside-editable.html: Added.
+
 2014-10-20  Dana Burkart  <[email protected]>
 
         Mark remainder of failing tests as green so we can branch.

Copied: branches/safari-600.2-branch/LayoutTests/editing/caret/color-span-inside-editable-expected.html (from rev 173246, trunk/LayoutTests/editing/caret/color-span-inside-editable-expected.html) (0 => 175009)


--- branches/safari-600.2-branch/LayoutTests/editing/caret/color-span-inside-editable-expected.html	                        (rev 0)
+++ branches/safari-600.2-branch/LayoutTests/editing/caret/color-span-inside-editable-expected.html	2014-10-22 01:40:47 UTC (rev 175009)
@@ -0,0 +1,4 @@
+This test makes sure that carets in content editable divs remain black even if there is a span inside them with a foreground color specified.
+<div style="width: 505px; height: 505px; overflow: hidden;">
+<div style="width: 50px; height: 500px; background-color: black"></div>
+</div>

Copied: branches/safari-600.2-branch/LayoutTests/editing/caret/color-span-inside-editable.html (from rev 173246, trunk/LayoutTests/editing/caret/color-span-inside-editable.html) (0 => 175009)


--- branches/safari-600.2-branch/LayoutTests/editing/caret/color-span-inside-editable.html	                        (rev 0)
+++ branches/safari-600.2-branch/LayoutTests/editing/caret/color-span-inside-editable.html	2014-10-22 01:40:47 UTC (rev 175009)
@@ -0,0 +1,8 @@
+This test makes sure that carets in content editable divs remain black even if there is a span inside them with a foreground color specified.
+<div style="width: 505px; height: 505px; overflow: hidden;">
+<div id="edit" contenteditable="true" style="-webkit-transform-origin: left top; -webkit-transform: scale(50, 50); outline: none; font-family: Ahem; font-size: 10px;"><span id="spn" style="color: red;">&nbsp;&nbsp;</span></div>
+</div>
+<script>
+var edit = document.getElementById("edit");
+edit.focus();
+</script>

Modified: branches/safari-600.2-branch/Source/WebCore/ChangeLog (175008 => 175009)


--- branches/safari-600.2-branch/Source/WebCore/ChangeLog	2014-10-22 01:35:50 UTC (rev 175008)
+++ branches/safari-600.2-branch/Source/WebCore/ChangeLog	2014-10-22 01:40:47 UTC (rev 175009)
@@ -1,3 +1,22 @@
+2014-10-21  Dana Burkart  <[email protected]>
+
+        Merge r173246
+
+    2014-09-03  Myles C. Maxfield  <[email protected]>
+
+            Text caret changes to color of text in Mail and Notes
+            https://bugs.webkit.org/show_bug.cgi?id=135904
+
+            Reviewed by Simon Fraser.
+
+            Consult with the background color of spans inside editable divs to determine what color
+            the caret should be.
+
+            Test: editing/caret/color-span-inside-editable.html
+
+            * editing/FrameSelection.cpp:
+            (WebCore::CaretBase::paintCaret):
+
 2014-09-23  Lucas Forschler  <[email protected]>
 
     Rollout trunk r173848 | (r173897 on branch)

Modified: branches/safari-600.2-branch/Source/WebCore/editing/FrameSelection.cpp (175008 => 175009)


--- branches/safari-600.2-branch/Source/WebCore/editing/FrameSelection.cpp	2014-10-22 01:35:50 UTC (rev 175008)
+++ branches/safari-600.2-branch/Source/WebCore/editing/FrameSelection.cpp	2014-10-22 01:40:47 UTC (rev 175009)
@@ -1509,10 +1509,23 @@
     Color caretColor = Color::black;
     ColorSpace colorSpace = ColorSpaceDeviceRGB;
     Element* element = node->isElementNode() ? toElement(node) : node->parentElement();
+    Element* rootEditableElement = node->rootEditableElement();
 
     if (element && element->renderer()) {
-        caretColor = element->renderer()->style().visitedDependentColor(CSSPropertyColor);
-        colorSpace = element->renderer()->style().colorSpace();
+        bool setToRootEditableElement = false;
+        if (rootEditableElement && rootEditableElement->renderer()) {
+            const auto& rootEditableStyle = rootEditableElement->renderer()->style();
+            const auto& elementStyle = element->renderer()->style();
+            if (rootEditableStyle.visitedDependentColor(CSSPropertyBackgroundColor) == elementStyle.visitedDependentColor(CSSPropertyBackgroundColor)) {
+                caretColor = rootEditableElement->renderer()->style().visitedDependentColor(CSSPropertyColor);
+                colorSpace = rootEditableElement->renderer()->style().colorSpace();
+                setToRootEditableElement = true;
+            }
+        }
+        if (!setToRootEditableElement) {
+            caretColor = element->renderer()->style().visitedDependentColor(CSSPropertyColor);
+            colorSpace = element->renderer()->style().colorSpace();
+        }
     }
 
     context->fillRect(caret, caretColor, colorSpace);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to