Diff
Modified: trunk/LayoutTests/ChangeLog (119676 => 119677)
--- trunk/LayoutTests/ChangeLog 2012-06-07 04:20:47 UTC (rev 119676)
+++ trunk/LayoutTests/ChangeLog 2012-06-07 04:23:35 UTC (rev 119677)
@@ -1,3 +1,17 @@
+2012-06-06 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r119668.
+ http://trac.webkit.org/changeset/119668
+ https://bugs.webkit.org/show_bug.cgi?id=88493
+
+ Hitting assertions in debug builds (Requested by rniwa on
+ #webkit).
+
+ * editing/selection/caret-in-empty-inline-1-expected.txt: Removed.
+ * editing/selection/caret-in-empty-inline-1.html: Removed.
+ * editing/selection/caret-in-empty-inline-2-expected.txt: Removed.
+ * editing/selection/caret-in-empty-inline-2.html: Removed.
+
2012-06-06 Ryosuke Niwa <[email protected]>
One more Chromium rebaseline for r119617.
Deleted: trunk/LayoutTests/editing/selection/caret-in-empty-inline-1-expected.txt (119676 => 119677)
--- trunk/LayoutTests/editing/selection/caret-in-empty-inline-1-expected.txt 2012-06-07 04:20:47 UTC (rev 119676)
+++ trunk/LayoutTests/editing/selection/caret-in-empty-inline-1-expected.txt 2012-06-07 04:23:35 UTC (rev 119677)
@@ -1,13 +0,0 @@
-Bug 85793: Caret is not rendered in empty inline contenteditable elements
-
-This test verifies that an empty inline contenteditable element gets a valid caret rect.
-
-
-PASS caretRect.left is 8
-PASS caretRect.top is 160
-PASS caretRect.width is 1
-PASS caretRect.height is 20
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/editing/selection/caret-in-empty-inline-1.html (119676 => 119677)
--- trunk/LayoutTests/editing/selection/caret-in-empty-inline-1.html 2012-06-07 04:20:47 UTC (rev 119676)
+++ trunk/LayoutTests/editing/selection/caret-in-empty-inline-1.html 2012-06-07 04:23:35 UTC (rev 119677)
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="" type="text/_javascript_"></script>
-<style>
- body {
- font: 20px Ahem;
- }
-</style>
-</head>
-<body>
-<p> Bug <a href="" Caret is not rendered in empty inline contenteditable elements</p>
-<p>This test verifies that an empty inline contenteditable element gets a valid caret rect.</p>
-<span id="testInline" CONTENTEDITABLE></span><br>
-<div id="console"></div>
-</body>
-<script>
- var testInline = document.getElementById("testInline");
- getSelection().collapse(testInline, 0);
- if (window.internals) {
- var caretRect = internals.absoluteCaretBounds(document);
- shouldBe("caretRect.left", "8");
- shouldBe("caretRect.top", "160");
- shouldBe("caretRect.width", "1");
- shouldBe("caretRect.height", "20");
- }
-</script>
-<script src="" type="text/_javascript_"></script>
-</html>
Deleted: trunk/LayoutTests/editing/selection/caret-in-empty-inline-2-expected.txt (119676 => 119677)
--- trunk/LayoutTests/editing/selection/caret-in-empty-inline-2-expected.txt 2012-06-07 04:20:47 UTC (rev 119676)
+++ trunk/LayoutTests/editing/selection/caret-in-empty-inline-2-expected.txt 2012-06-07 04:23:35 UTC (rev 119677)
@@ -1,13 +0,0 @@
-Bug 85793: Caret is not rendered in empty inline contenteditable elements
-
-This test verifies that an empty inline contenteditable element, placed after another inline element, gets a valid caret rect.
-
-Previous span
-PASS caretRect.left is 268
-PASS caretRect.top is 180
-PASS caretRect.width is 1
-PASS caretRect.height is 20
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/editing/selection/caret-in-empty-inline-2.html (119676 => 119677)
--- trunk/LayoutTests/editing/selection/caret-in-empty-inline-2.html 2012-06-07 04:20:47 UTC (rev 119676)
+++ trunk/LayoutTests/editing/selection/caret-in-empty-inline-2.html 2012-06-07 04:23:35 UTC (rev 119677)
@@ -1,30 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="" type="text/_javascript_"></script>
-<style>
- body {
- font: 20px Ahem;
- }
-</style>
-</head>
-<body>
-<p> Bug <a href="" Caret is not rendered in empty inline contenteditable elements</p>
-<p>This test verifies that an empty inline contenteditable element, placed after
-another inline element, gets a valid caret rect.</p>
-<span>Previous span</span><span id="testInline" CONTENTEDITABLE></span><br>
-<div id="console"></div>
-</body>
-<script>
- var testInline = document.getElementById("testInline");
- getSelection().collapse(testInline, 0);
- if (window.internals) {
- var caretRect = internals.absoluteCaretBounds(document);
- shouldBe("caretRect.left", "268");
- shouldBe("caretRect.top", "180");
- shouldBe("caretRect.width", "1");
- shouldBe("caretRect.height", "20");
- }
-</script>
-<script src="" type="text/_javascript_"></script>
-</html>
Modified: trunk/Source/WebCore/ChangeLog (119676 => 119677)
--- trunk/Source/WebCore/ChangeLog 2012-06-07 04:20:47 UTC (rev 119676)
+++ trunk/Source/WebCore/ChangeLog 2012-06-07 04:23:35 UTC (rev 119677)
@@ -1,3 +1,21 @@
+2012-06-06 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r119668.
+ http://trac.webkit.org/changeset/119668
+ https://bugs.webkit.org/show_bug.cgi?id=88493
+
+ Hitting assertions in debug builds (Requested by rniwa on
+ #webkit).
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::localCaretRect):
+ * rendering/RenderBoxModelObject.cpp:
+ * rendering/RenderBoxModelObject.h:
+ (RenderBoxModelObject):
+ * rendering/RenderInline.cpp:
+ * rendering/RenderInline.h:
+ (RenderInline):
+
2012-06-06 Julien Chaffraix <[email protected]>
Cache isSelfPaintingLayer() for better performance
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (119676 => 119677)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-06-07 04:20:47 UTC (rev 119676)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-06-07 04:23:35 UTC (rev 119677)
@@ -6489,17 +6489,80 @@
if (firstChild())
return RenderBox::localCaretRect(inlineBox, caretOffset, extraWidthToEndOfLine);
- LayoutRect caretRect = localCaretRectForEmptyElement(width(), textIndentOffset());
+ // This is a special case:
+ // The element is not an inline element, and it's empty. So we have to
+ // calculate a fake position to indicate where objects are to be inserted.
+
+ // FIXME: This does not take into account either :first-line or :first-letter
+ // However, as soon as some content is entered, the line boxes will be
+ // constructed and this kludge is not called any more. So only the caret size
+ // of an empty :first-line'd block is wrong. I think we can live with that.
+ RenderStyle* currentStyle = firstLineStyle();
+ LayoutUnit height = lineHeight(true, currentStyle->isHorizontalWritingMode() ? HorizontalLine : VerticalLine);
+ enum CaretAlignment { alignLeft, alignRight, alignCenter };
+
+ CaretAlignment alignment = alignLeft;
+
+ switch (currentStyle->textAlign()) {
+ case TAAUTO:
+ case JUSTIFY:
+ if (!currentStyle->isLeftToRightDirection())
+ alignment = alignRight;
+ break;
+ case LEFT:
+ case WEBKIT_LEFT:
+ break;
+ case CENTER:
+ case WEBKIT_CENTER:
+ alignment = alignCenter;
+ break;
+ case RIGHT:
+ case WEBKIT_RIGHT:
+ alignment = alignRight;
+ break;
+ case TASTART:
+ if (!currentStyle->isLeftToRightDirection())
+ alignment = alignRight;
+ break;
+ case TAEND:
+ if (currentStyle->isLeftToRightDirection())
+ alignment = alignRight;
+ break;
+ }
+
+ LayoutUnit x = borderLeft() + paddingLeft();
+ LayoutUnit w = width();
+
+ switch (alignment) {
+ case alignLeft:
+ if (currentStyle->isLeftToRightDirection())
+ x += textIndentOffset();
+ break;
+ case alignCenter:
+ x = (x + w - (borderRight() + paddingRight())) / 2;
+ if (currentStyle->isLeftToRightDirection())
+ x += textIndentOffset() / 2;
+ else
+ x -= textIndentOffset() / 2;
+ break;
+ case alignRight:
+ x = w - (borderRight() + paddingRight()) - caretWidth;
+ if (!currentStyle->isLeftToRightDirection())
+ x -= textIndentOffset();
+ break;
+ }
+ x = min(x, w - borderRight() - paddingRight() - caretWidth);
+
if (extraWidthToEndOfLine) {
if (isRenderBlock()) {
- *extraWidthToEndOfLine = width() - caretRect.maxX();
+ *extraWidthToEndOfLine = w - (x + caretWidth);
} else {
// FIXME: This code looks wrong.
// myRight and containerRight are set up, but then clobbered.
// So *extraWidthToEndOfLine will always be 0 here.
- LayoutUnit myRight = caretRect.maxX();
+ LayoutUnit myRight = x + caretWidth;
// FIXME: why call localToAbsoluteForContent() twice here, too?
FloatPoint absRightPoint = localToAbsolute(FloatPoint(myRight, 0));
@@ -6510,7 +6573,9 @@
}
}
- return caretRect;
+ LayoutUnit y = paddingTop() + borderTop();
+
+ return LayoutRect(x, y, caretWidth, height);
}
void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset)
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (119676 => 119677)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-06-07 04:20:47 UTC (rev 119676)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-06-07 04:23:35 UTC (rev 119677)
@@ -2971,76 +2971,6 @@
firstLetterRemainingTextMap->remove(this);
}
-LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIndentOffset)
-{
- ASSERT(!firstChild());
-
- // FIXME: This does not take into account either :first-line or :first-letter
- // However, as soon as some content is entered, the line boxes will be
- // constructed and this kludge is not called any more. So only the caret size
- // of an empty :first-line'd block is wrong. I think we can live with that.
- RenderStyle* currentStyle = firstLineStyle();
- LayoutUnit height = lineHeight(true, currentStyle->isHorizontalWritingMode() ? HorizontalLine : VerticalLine);
-
- enum CaretAlignment { alignLeft, alignRight, alignCenter };
-
- CaretAlignment alignment = alignLeft;
-
- switch (currentStyle->textAlign()) {
- case TAAUTO:
- case JUSTIFY:
- if (!currentStyle->isLeftToRightDirection())
- alignment = alignRight;
- break;
- case LEFT:
- case WEBKIT_LEFT:
- break;
- case CENTER:
- case WEBKIT_CENTER:
- alignment = alignCenter;
- break;
- case RIGHT:
- case WEBKIT_RIGHT:
- alignment = alignRight;
- break;
- case TASTART:
- if (!currentStyle->isLeftToRightDirection())
- alignment = alignRight;
- break;
- case TAEND:
- if (currentStyle->isLeftToRightDirection())
- alignment = alignRight;
- break;
- }
-
- LayoutUnit x = borderLeft() + paddingLeft();
- LayoutUnit maxX = width - borderRight() - paddingRight();
-
- switch (alignment) {
- case alignLeft:
- if (currentStyle->isLeftToRightDirection())
- x += textIndentOffset;
- break;
- case alignCenter:
- x = (x + maxX) / 2;
- if (currentStyle->isLeftToRightDirection())
- x += textIndentOffset / 2;
- else
- x -= textIndentOffset / 2;
- break;
- case alignRight:
- x = maxX - caretWidth;
- if (!currentStyle->isLeftToRightDirection())
- x -= textIndentOffset;
- break;
- }
- x = min(x, max(maxX - caretWidth, ZERO_LAYOUT_UNIT));
-
- LayoutUnit y = paddingTop() + borderTop();
-
- return LayoutRect(x, y, caretWidth, height);
-}
-
bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context)
{
// FIXME: We may want to not antialias when scaled by an integral value,
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (119676 => 119677)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2012-06-07 04:20:47 UTC (rev 119676)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2012-06-07 04:23:35 UTC (rev 119677)
@@ -237,8 +237,6 @@
RenderBoxModelObject* continuation() const;
void setContinuation(RenderBoxModelObject*);
- LayoutRect localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIndentOffset);
-
static bool shouldAntialiasLines(GraphicsContext*);
public:
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (119676 => 119677)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2012-06-07 04:20:47 UTC (rev 119676)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2012-06-07 04:23:35 UTC (rev 119677)
@@ -233,24 +233,6 @@
}
}
-LayoutRect RenderInline::localCaretRect(InlineBox* inlineBox, int, LayoutUnit* extraWidthToEndOfLine)
-{
- // This will only be called if the RenderInline is empty.
- // Otherwise, RenderText::localCaretRect will be called.
- ASSERT(!firstChild());
- ASSERT_UNUSED(inlineBox, !inlineBox);
-
- if (extraWidthToEndOfLine)
- *extraWidthToEndOfLine = 0;
-
- LayoutRect caretRect = localCaretRectForEmptyElement(borderAndPaddingWidth(), 0);
-
- if (InlineBox* firstBox = firstLineBox())
- caretRect.moveBy(roundedLayoutPoint(firstBox->topLeft()));
-
- return caretRect;
-}
-
void RenderInline::addChild(RenderObject* newChild, RenderObject* beforeChild)
{
if (continuation())
Modified: trunk/Source/WebCore/rendering/RenderInline.h (119676 => 119677)
--- trunk/Source/WebCore/rendering/RenderInline.h 2012-06-07 04:20:47 UTC (rev 119676)
+++ trunk/Source/WebCore/rendering/RenderInline.h 2012-06-07 04:23:35 UTC (rev 119677)
@@ -84,8 +84,6 @@
void setAlwaysCreateLineBoxes() { m_alwaysCreateLineBoxes = true; }
void updateAlwaysCreateLineBoxes(bool fullLayout);
- virtual LayoutRect localCaretRect(InlineBox*, int, LayoutUnit* extraWidthToEndOfLine) OVERRIDE;
-
protected:
virtual void willBeDestroyed();