Title: [124231] trunk
- Revision
- 124231
- Author
- [email protected]
- Date
- 2012-07-31 11:56:26 -0700 (Tue, 31 Jul 2012)
Log Message
Caret position is wrong when a editable container has word-wrap:normal set
https://bugs.webkit.org/show_bug.cgi?id=89649
Patch by Pravin D <[email protected]> on 2012-07-31
Reviewed by Levi Weintraub.
Source/WebCore:
Correcting the incorrect addumption that the min and max position for the caret rect is constrained to
the logical containing block width. This assumption is incorrect when the text has word-wrap:normal and
flows beyound the visible rect of the container.
Test: editing/input/editable-container-with-word-wrap-normal.html
* rendering/RenderText.cpp:
(WebCore::RenderText::localCaretRect):
LayoutTests:
* editing/input/editable-container-with-word-wrap-normal-expected.txt: Added.
* editing/input/editable-container-with-word-wrap-normal.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (124230 => 124231)
--- trunk/LayoutTests/ChangeLog 2012-07-31 18:48:17 UTC (rev 124230)
+++ trunk/LayoutTests/ChangeLog 2012-07-31 18:56:26 UTC (rev 124231)
@@ -1,3 +1,13 @@
+2012-07-31 Pravin D <[email protected]>
+
+ Caret position is wrong when a editable container has word-wrap:normal set
+ https://bugs.webkit.org/show_bug.cgi?id=89649
+
+ Reviewed by Levi Weintraub.
+
+ * editing/input/editable-container-with-word-wrap-normal-expected.txt: Added.
+ * editing/input/editable-container-with-word-wrap-normal.html: Added.
+
2012-07-31 Thiago Marcos P. Santos <[email protected]>
[EFL] Gardening of failing tests and new passes
Added: trunk/LayoutTests/editing/input/editable-container-with-word-wrap-normal-expected.txt (0 => 124231)
--- trunk/LayoutTests/editing/input/editable-container-with-word-wrap-normal-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/input/editable-container-with-word-wrap-normal-expected.txt 2012-07-31 18:56:26 UTC (rev 124231)
@@ -0,0 +1,15 @@
+Testcase for bug http://www.webkit.org/b/89649. The test case checks if caret is drawn properly(especially scrolls properly) inside a editable container having word-wrap:normal.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+The content must scroll for the caret to reach the end of the editable text.
+PASS editableContainer.scrollLeft > 0 is true
+
+Final caret rect is calculated by following constraints
+1) ScrollWidth = text content width + caret width
+2) Caret rect is always within container bounding box (thus substracting the scroll left)
+PASS startCaretRect.left + editableContainer.scrollWidth - editableContainer.scrollLeft - caretWidth is finalCaretRect.right
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/editing/input/editable-container-with-word-wrap-normal.html (0 => 124231)
--- trunk/LayoutTests/editing/input/editable-container-with-word-wrap-normal.html (rev 0)
+++ trunk/LayoutTests/editing/input/editable-container-with-word-wrap-normal.html 2012-07-31 18:56:26 UTC (rev 124231)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title> Testcase for bug https://bugs.webkit.org/show_bug.cgi?id=89649 </title>
+<style>
+@font-face {
+ font-family:ahem;
+ src: url(../../resources/Ahem.ttf);
+}
+.editableDiv {
+ overflow:auto;
+ height:50px;
+ width:500px;
+ word-wrap:normal;
+ font-family:ahem;
+}
+</style>
+<script src=""
+<script>
+startCaretRect = null;
+finalCaretRect = null;
+editableContainer = null;
+caretWidth = null;
+function runTest() {
+ description('Testcase for bug <a href="" \
+The test case checks if caret is drawn properly(especially scrolls properly) inside a editable container having word-wrap:normal.');
+
+ editableContainer = document.getElementById('test');
+ editableContainer.focus();
+ if (window.internals)
+ startCaretRect = internals.absoluteCaretBounds(document);
+
+ window.getSelection().setPosition(editableContainer,0);
+ if (window.eventSender)
+ eventSender.keyDown('end');
+
+ if (window.internals)
+ finalCaretRect = internals.absoluteCaretBounds(document);
+
+ caretWidth = finalCaretRect.right - finalCaretRect.left;
+
+ debug("The content must scroll for the caret to reach the end of the editable text.")
+ shouldBeTrue("editableContainer.scrollLeft > 0");
+
+ debug('<br>Final caret rect is calculated by following constraints');
+ debug('1) ScrollWidth = text content width + caret width');
+ debug('2) Caret rect is always within container bounding box (thus substracting the scroll left)');
+ shouldBe("startCaretRect.left + editableContainer.scrollWidth - editableContainer.scrollLeft - caretWidth", "finalCaretRect.right");
+
+ document.body.removeChild(editableContainer);
+ isSuccessfullyParsed();
+ }
+</script>
+</head>
+<body _onload_="runTest();">
+ <div id="test" contenteditable="true" class="editableDiv" >
+ SOMEFILLERTEXTSOMEFILLERTEXTSOMEFILLERFILLERSFILLERSFILLERSFILLERSFILLERS
+ </div>
+ <div id="description"></div>
+ <div id="console"></div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (124230 => 124231)
--- trunk/Source/WebCore/ChangeLog 2012-07-31 18:48:17 UTC (rev 124230)
+++ trunk/Source/WebCore/ChangeLog 2012-07-31 18:56:26 UTC (rev 124231)
@@ -1,3 +1,19 @@
+2012-07-31 Pravin D <[email protected]>
+
+ Caret position is wrong when a editable container has word-wrap:normal set
+ https://bugs.webkit.org/show_bug.cgi?id=89649
+
+ Reviewed by Levi Weintraub.
+
+ Correcting the incorrect addumption that the min and max position for the caret rect is constrained to
+ the logical containing block width. This assumption is incorrect when the text has word-wrap:normal and
+ flows beyound the visible rect of the container.
+
+ Test: editing/input/editable-container-with-word-wrap-normal.html
+
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::localCaretRect):
+
2012-07-31 Antti Koivisto <[email protected]>
Crash in FrameLoader::checkLoadComplete with non-browser client app
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (124230 => 124231)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2012-07-31 18:48:17 UTC (rev 124230)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2012-07-31 18:56:26 UTC (rev 124231)
@@ -678,15 +678,11 @@
RenderBlock* cb = containingBlock();
RenderStyle* cbStyle = cb->style();
+
float leftEdge;
float rightEdge;
- if (style()->autoWrap()) {
- leftEdge = 0;
- rightEdge = cb->logicalWidth();
- } else {
- leftEdge = min(static_cast<float>(0), rootLeft);
- rightEdge = max(static_cast<float>(cb->logicalWidth()), rootRight);
- }
+ leftEdge = min<float>(0, rootLeft);
+ rightEdge = max<float>(cb->logicalWidth(), rootRight);
bool rightAligned = false;
switch (cbStyle->textAlign()) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes