Changeset 139282 in webkit
- Timestamp:
- Jan 9, 2013 10:23:32 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r139281 r139282 1 2013-01-09 Tien-Ren Chen <trchen@chromium.org> 2 3 Make caret repainting container-aware 4 https://bugs.webkit.org/show_bug.cgi?id=103955 5 6 Reviewed by Simon Fraser. 7 8 The caret repaint padding has been removed. Needs rebaseline. 9 Added test that carets should be repainted correctly on a transformed element. 10 11 * fast/repaint/caret-with-transformation.html: Added. 12 * platform/chromium/TestExpectations: 13 * platform/mac/TestExpectations: 14 1 15 2013-01-09 Noel Gordon <noel.gordon@gmail.com> 2 16 -
trunk/LayoutTests/platform/chromium/TestExpectations
r139251 r139282 4378 4378 crbug.com/166932 [ Debug ] plugins/embed-attributes-setting.html [ Crash Pass ] 4379 4379 4380 # Transient. Needs rebaseline. 4381 webkit.org/b/103955 fast/repaint/4774354.html [ ImageOnlyFailure ] 4382 webkit.org/b/103955 fast/repaint/4776765.html [ ImageOnlyFailure ] 4383 webkit.org/b/103955 fast/repaint/caret-outside-block.html [ ImageOnlyFailure ] 4384 webkit.org/b/103955 fast/repaint/japanese-rl-selection-repaint-in-regions.html [ ImageOnlyFailure ] 4385 webkit.org/b/103955 fast/repaint/japanese-rl-selection-repaint.html [ ImageOnlyFailure ] 4386 webkit.org/b/103955 fast/repaint/repaint-across-writing-mode-boundary.html [ ImageOnlyFailure ] 4387 webkit.org/b/103955 fast/repaint/selection-rl.html [ ImageOnlyFailure ] 4388 webkit.org/b/103955 fast/repaint/caret-with-transformation.html [ Missing ] -
trunk/LayoutTests/platform/mac/TestExpectations
r139229 r139282 1274 1274 webkit.org/b/106415 fast/workers/worker-lifecycle.html [ Pass Failure ] 1275 1275 1276 # Transient. Needs rebaseline. 1277 webkit.org/b/103955 fast/repaint/4774354.html [ ImageOnlyFailure ] 1278 webkit.org/b/103955 fast/repaint/4776765.html [ ImageOnlyFailure ] 1279 webkit.org/b/103955 fast/repaint/caret-outside-block.html [ ImageOnlyFailure ] 1280 webkit.org/b/103955 fast/repaint/japanese-rl-selection-repaint-in-regions.html [ ImageOnlyFailure ] 1281 webkit.org/b/103955 fast/repaint/japanese-rl-selection-repaint.html [ ImageOnlyFailure ] 1282 webkit.org/b/103955 fast/repaint/repaint-across-writing-mode-boundary.html [ ImageOnlyFailure ] 1283 webkit.org/b/103955 fast/repaint/selection-rl.html [ ImageOnlyFailure ] 1284 webkit.org/b/103955 fast/repaint/caret-with-transformation.html [ Missing ] -
trunk/Source/WebCore/ChangeLog
r139280 r139282 1 2013-01-09 Tien-Ren Chen <trchen@chromium.org> 2 3 Make caret repainting container-aware 4 https://bugs.webkit.org/show_bug.cgi?id=103955 5 6 Reviewed by Simon Fraser. 7 8 Only invalidate local rects on the caret's repaint container, 9 instead of invalidating an absolute rect on the whole view. 10 11 Test: fast/repaint/caret-with-transformation.html 12 13 * editing/FrameSelection.cpp: 14 (WebCore::caretRendersInsideNode): 15 (WebCore::caretRenderer): 16 (WebCore::FrameSelection::caretRenderer): 17 (WebCore::DragCaretController::caretRenderer): 18 (WebCore::repaintCaretForLocalRect): 19 (WebCore::FrameSelection::recomputeCaretRect): 20 (WebCore::CaretBase::invalidateCaretRect): 21 (WebCore::FrameSelection::focusedOrActiveStateChanged): 22 * editing/FrameSelection.h: 23 * rendering/RenderView.cpp: 24 (WebCore::RenderView::repaintSelection): 25 * rendering/RenderView.h: 26 1 27 2013-01-09 Ryosuke Niwa <rniwa@webkit.org> 2 28 -
trunk/Source/WebCore/editing/FrameSelection.cpp
r137847 r139282 1220 1220 } 1221 1221 1222 static inline bool caretRendersInsideNode(Node* node) 1223 { 1224 return node && !isTableElement(node) && !editingIgnoresContent(node); 1225 } 1226 1227 static RenderObject* caretRenderer(Node* node) 1228 { 1229 if (!node) 1230 return 0; 1231 1232 RenderObject* renderer = node->renderer(); 1233 if (!renderer) 1234 return 0; 1235 1236 // if caretNode is a block and caret is inside it then caret should be painted by that block 1237 bool paintedByBlock = renderer->isBlockFlow() && caretRendersInsideNode(node); 1238 return paintedByBlock ? renderer : renderer->containingBlock(); 1239 } 1240 1222 1241 bool CaretBase::updateCaretRect(Document* document, const VisiblePosition& caretPosition) 1223 1242 { … … 1258 1277 } 1259 1278 1260 static inline bool caretRendersInsideNode(Node* node)1261 {1262 return node && !isTableElement(node) && !editingIgnoresContent(node);1263 }1264 1265 RenderObject* CaretBase::caretRenderer(Node* node) const1266 {1267 if (!node)1268 return 0;1269 1270 RenderObject* renderer = node->renderer();1271 if (!renderer)1272 return 0;1273 1274 // if caretNode is a block and caret is inside it then caret should be painted by that block1275 bool paintedByBlock = renderer->isBlockFlow() && caretRendersInsideNode(node);1276 return paintedByBlock ? renderer : renderer->containingBlock();1277 }1278 1279 1279 RenderObject* FrameSelection::caretRenderer() const 1280 1280 { 1281 return CaretBase::caretRenderer(m_selection.start().deprecatedNode());1281 return WebCore::caretRenderer(m_selection.start().deprecatedNode()); 1282 1282 } 1283 1283 1284 1284 RenderObject* DragCaretController::caretRenderer() const 1285 1285 { 1286 return CaretBase::caretRenderer(m_position.deepEquivalent().deprecatedNode());1286 return WebCore::caretRenderer(m_position.deepEquivalent().deprecatedNode()); 1287 1287 } 1288 1288 … … 1322 1322 } 1323 1323 1324 static LayoutRect repaintRectForCaret(LayoutRect caret) 1325 { 1326 if (caret.isEmpty()) 1327 return LayoutRect(); 1328 // Ensure that the dirty rect intersects the block that paints the caret even in the case where 1329 // the caret itself is just outside the block. See <https://bugs.webkit.org/show_bug.cgi?id=19086>. 1330 caret.inflateX(1); 1331 caret.inflateY(1); 1332 return caret; 1333 } 1334 1335 IntRect CaretBase::caretRepaintRect(Node* node) const 1336 { 1337 return absoluteBoundsForLocalRect(node, repaintRectForCaret(localCaretRectWithoutUpdate())); 1324 static void repaintCaretForLocalRect(Node* node, const LayoutRect& rect) 1325 { 1326 RenderObject* caretPainter = caretRenderer(node); 1327 if (!caretPainter) 1328 return; 1329 1330 caretPainter->repaintRectangle(rect); 1338 1331 } 1339 1332 … … 1356 1349 1357 1350 IntRect oldAbsCaretBounds = m_absCaretBounds; 1358 // FIXME: Rename m_caretRect to m_localCaretRect.1359 1351 m_absCaretBounds = absoluteBoundsForLocalRect(m_selection.start().deprecatedNode(), localCaretRectWithoutUpdate()); 1360 1352 m_absCaretBoundsDirty = false; … … 1364 1356 1365 1357 #if ENABLE(TEXT_CARET) 1366 IntRect oldAbsoluteCaretRepaintBounds = m_absoluteCaretRepaintBounds;1367 #endif1368 1369 // We believe that we need to inflate the local rect before transforming it to obtain the repaint bounds.1370 m_absoluteCaretRepaintBounds = caretRepaintRect(m_selection.start().deprecatedNode());1371 1372 #if ENABLE(TEXT_CARET)1373 1358 if (RenderView* view = m_frame->document()->renderView()) { 1374 // FIXME: make caret repainting container-aware. 1375 view->repaintRectangleInViewAndCompositedLayers(oldAbsoluteCaretRepaintBounds, false); 1359 Node* node = m_selection.start().deprecatedNode(); 1360 if (m_previousCaretNode) 1361 repaintCaretForLocalRect(m_previousCaretNode.get(), oldRect); 1362 m_previousCaretNode = node; 1376 1363 if (shouldRepaintCaret(view, isContentEditable())) 1377 view->repaintRectangleInViewAndCompositedLayers(m_absoluteCaretRepaintBounds, false);1364 repaintCaretForLocalRect(node, newRect); 1378 1365 } 1379 1366 #endif … … 1417 1404 if (RenderView* view = node->document()->renderView()) { 1418 1405 if (shouldRepaintCaret(view, node->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable))) 1419 view->repaintRectangleInViewAndCompositedLayers(caretRepaintRect(node), false);1406 repaintCaretForLocalRect(node, localCaretRectWithoutUpdate()); 1420 1407 } 1421 1408 } … … 1684 1671 // we have to update places those colors were painted. 1685 1672 if (RenderView* view = m_frame->document()->renderView()) 1686 view->repaint RectangleInViewAndCompositedLayers(enclosingIntRect(bounds()));1673 view->repaintSelection(); 1687 1674 1688 1675 // Caret appears in the active frame. -
trunk/Source/WebCore/editing/FrameSelection.h
r134191 r139282 66 66 bool updateCaretRect(Document*, const VisiblePosition& caretPosition); 67 67 IntRect absoluteBoundsForLocalRect(Node*, const LayoutRect&) const; 68 IntRect caretRepaintRect(Node*) const;69 68 bool shouldRepaintCaret(const RenderView*, bool isContentEditable) const; 70 69 void paintCaret(Node*, GraphicsContext*, const LayoutPoint&, const LayoutRect& clipRect) const; 71 RenderObject* caretRenderer(Node*) const;72 70 73 71 const LayoutRect& localCaretRectWithoutUpdate() const { return m_caretLocalRect; } … … 303 301 TextGranularity m_granularity; 304 302 303 RefPtr<Node> m_previousCaretNode; // The last node which painted the caret. Retained for clearing the old caret when it moves. 304 305 305 RefPtr<EditingStyle> m_typingStyle; 306 306 … … 308 308 // The painted bounds of the caret in absolute coordinates 309 309 IntRect m_absCaretBounds; 310 // Similar to above, but inflated to ensure proper repaint (see https://bugs.webkit.org/show_bug.cgi?id=19086)311 IntRect m_absoluteCaretRepaintBounds;312 310 bool m_absCaretBoundsDirty : 1; 313 311 bool m_caretPaint : 1; -
trunk/Source/WebCore/rendering/RenderView.cpp
r139197 r139282 546 546 } 547 547 548 void RenderView::repaintSelection() const 549 { 550 document()->updateStyleIfNeeded(); 551 552 HashSet<RenderBlock*> processedBlocks; 553 554 RenderObject* end = rendererAfterPosition(m_selectionEnd, m_selectionEndPos); 555 for (RenderObject* o = m_selectionStart; o && o != end; o = o->nextInPreOrder()) { 556 if (!o->canBeSelectionLeaf() && o != m_selectionStart && o != m_selectionEnd) 557 continue; 558 if (o->selectionState() == SelectionNone) 559 continue; 560 561 RenderSelectionInfo(o, true).repaint(); 562 563 // Blocks are responsible for painting line gaps and margin gaps. They must be examined as well. 564 for (RenderBlock* block = o->containingBlock(); block && !block->isRenderView(); block = block->containingBlock()) { 565 if (processedBlocks.contains(block)) 566 break; 567 processedBlocks.add(block); 568 RenderSelectionInfo(block, true).repaint(); 569 } 570 } 571 } 572 548 573 #if USE(ACCELERATED_COMPOSITING) 549 574 // Compositing layer dimensions take outline size into account, so we have to recompute layer -
trunk/Source/WebCore/rendering/RenderView.h
r138838 r139282 96 96 IntRect selectionBounds(bool clipToVisibleContent = true) const; 97 97 void selectionStartEnd(int& startPos, int& endPos) const; 98 void repaintSelection() const; 98 99 99 100 bool printing() const;
Note: See TracChangeset
for help on using the changeset viewer.