Changeset 64610 in webkit
- Timestamp:
- Aug 3, 2010 6:19:14 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r64609 r64610 1 2010-08-03 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 extractAndNegateTextDecorationStyle and maxRangeOffset in ApplyStyleCommand.cpp should be deleted 6 https://bugs.webkit.org/show_bug.cgi?id=43437 7 8 Removed extractAndNegateTextDecorationStyle because we never push down text decorations added by CSS rules 9 as discussed on the bug 27809. Also removed pushDownTextDecorationStyleAtBoundaries because it only existed 10 to encapsulate the complexity of calling pushDownTextDecorationStyleAroundNode first with forceNegate = false 11 (calling pushDownTextDecorationStyleAroundNode) and again with forceNegate = true (calling extractAndNegateTextDecorationStyle) 12 after updating layout but neither the layout update nor the second call to pushDownTextDecorationStyleAroundNode 13 is needed after the removal of extractAndNegateTextDecorationStyle. 14 15 Also replaced maxRangeOffset by lastOffsetForEditing as FIXME (added by r48235) indicated. 16 17 No new tests added since this is a clean up. 18 19 * editing/ApplyStyleCommand.cpp: 20 (WebCore::ApplyStyleCommand::pushDownTextDecorationStyleAroundNode): No longer takes forceNegate as an argument. 21 (WebCore::ApplyStyleCommand::removeInlineStyle): Calls pushDownTextDecorationStyleAroundNode directly. 22 * editing/ApplyStyleCommand.h: 23 1 24 2010-08-03 Ryosuke Niwa <rniwa@webkit.org> 2 25 -
trunk/WebCore/editing/ApplyStyleCommand.cpp
r64432 r64610 1386 1386 } 1387 1387 1388 PassRefPtr<CSSMutableStyleDeclaration> ApplyStyleCommand::extractAndNegateTextDecorationStyle(Node* node)1389 {1390 ASSERT(node);1391 ASSERT(node->isElementNode());1392 1393 // non-html elements not handled yet1394 if (!node->isHTMLElement())1395 return 0;1396 1397 RefPtr<CSSComputedStyleDeclaration> nodeStyle = computedStyle(node);1398 ASSERT(nodeStyle);1399 1400 int properties[1] = { CSSPropertyTextDecoration };1401 RefPtr<CSSMutableStyleDeclaration> textDecorationStyle = nodeStyle->copyPropertiesInSet(properties, 1);1402 1403 RefPtr<CSSValue> property = nodeStyle->getPropertyCSSValue(CSSPropertyTextDecoration);1404 if (property && !equalIgnoringCase(property->cssText(), "none")) {1405 RefPtr<CSSMutableStyleDeclaration> newStyle = textDecorationStyle->copy();1406 newStyle->setProperty(CSSPropertyTextDecoration, "none");1407 applyTextDecorationStyle(node, newStyle.get());1408 }1409 1410 return textDecorationStyle.release();1411 }1412 1413 1388 void ApplyStyleCommand::applyTextDecorationStyle(Node *node, CSSMutableStyleDeclaration *style) 1414 1389 { … … 1444 1419 } 1445 1420 1446 void ApplyStyleCommand::pushDownTextDecorationStyleAroundNode(Node* targetNode , bool forceNegate)1421 void ApplyStyleCommand::pushDownTextDecorationStyleAroundNode(Node* targetNode) 1447 1422 { 1448 1423 ASSERT(targetNode); … … 1456 1431 ASSERT(current); 1457 1432 ASSERT(current->contains(targetNode)); 1458 RefPtr<CSSMutableStyleDeclaration> decoration = forceNegate ? extractAndNegateTextDecorationStyle(current) :extractTextDecorationStyle(current);1433 RefPtr<CSSMutableStyleDeclaration> decoration = extractTextDecorationStyle(current); 1459 1434 1460 1435 // The inner loop will go through children on each level … … 1477 1452 } 1478 1453 1479 void ApplyStyleCommand::pushDownTextDecorationStyleAtBoundaries(const Position &start, const Position &end)1480 {1481 // We need to work in two passes. First we push down any inline1482 // styles that set text decoration. Then we look for any remaining1483 // styles (caused by stylesheets) and explicitly negate text1484 // decoration while pushing down.1485 1486 pushDownTextDecorationStyleAroundNode(start.node(), false);1487 updateLayout();1488 pushDownTextDecorationStyleAroundNode(start.node(), true);1489 1490 pushDownTextDecorationStyleAroundNode(end.node(), false);1491 updateLayout();1492 pushDownTextDecorationStyleAroundNode(end.node(), true);1493 }1494 1495 // FIXME: Why does this exist? Callers should either use lastOffsetForEditing or lastOffsetInNode1496 static int maxRangeOffset(Node *n)1497 {1498 if (n->offsetInCharacters())1499 return n->maxCharacterOffset();1500 1501 if (n->isElementNode())1502 return n->childNodeCount();1503 1504 return 1;1505 }1506 1507 1454 void ApplyStyleCommand::removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration> style, const Position &start, const Position &end) 1508 1455 { … … 1516 1463 1517 1464 if (textDecorationSpecialProperty) { 1518 pushDownTextDecorationStyleAtBoundaries(start.downstream(), end.upstream()); 1465 pushDownTextDecorationStyleAroundNode(start.downstream().node()); 1466 pushDownTextDecorationStyleAroundNode(end.upstream().node()); 1519 1467 style = style->copy(); 1520 1468 style->setProperty(CSSPropertyTextDecoration, textDecorationSpecialProperty->cssText(), style->getPropertyPriority(CSSPropertyWebkitTextDecorationsInEffect)); … … 1546 1494 // of the selection, it is clear we can set the new e offset to 1547 1495 // the max range offset of prev. 1548 ASSERT(e.deprecatedEditingOffset() >= maxRangeOffset(e.node()));1549 e = Position(prev, maxRangeOffset(prev));1496 ASSERT(e.deprecatedEditingOffset() >= lastOffsetForEditing(e.node())); 1497 e = Position(prev, lastOffsetForEditing(prev)); 1550 1498 } 1551 1499 } -
trunk/WebCore/editing/ApplyStyleCommand.h
r64432 r64610 83 83 bool nodeFullyUnselected(Node*, const Position& start, const Position& end) const; 84 84 PassRefPtr<CSSMutableStyleDeclaration> extractTextDecorationStyle(Node*); 85 PassRefPtr<CSSMutableStyleDeclaration> extractAndNegateTextDecorationStyle(Node*);86 85 void applyTextDecorationStyle(Node*, CSSMutableStyleDeclaration *style); 87 void pushDownTextDecorationStyleAroundNode(Node*, bool forceNegate); 88 void pushDownTextDecorationStyleAtBoundaries(const Position& start, const Position& end); 89 86 void pushDownTextDecorationStyleAroundNode(Node*); 87 90 88 // style-application helpers 91 89 void applyBlockStyle(CSSMutableStyleDeclaration*);
Note: See TracChangeset
for help on using the changeset viewer.