Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: Source/core/editing/ApplyStyleCommand.cpp

Issue 204373003: Oilpan: Change references to MutableStylePropertySet to transition types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 paragraphStart = nextParagraphStart; 285 paragraphStart = nextParagraphStart;
286 nextParagraphStart = endOfParagraph(paragraphStart).next(); 286 nextParagraphStart = endOfParagraph(paragraphStart).next();
287 } 287 }
288 288
289 startRange = PlainTextRange(startIndex).createRangeForSelection(toContainerN ode(scope)); 289 startRange = PlainTextRange(startIndex).createRangeForSelection(toContainerN ode(scope));
290 endRange = PlainTextRange(endIndex).createRangeForSelection(toContainerNode( scope)); 290 endRange = PlainTextRange(endIndex).createRangeForSelection(toContainerNode( scope));
291 if (startRange && endRange) 291 if (startRange && endRange)
292 updateStartEnd(startRange->startPosition(), endRange->startPosition()); 292 updateStartEnd(startRange->startPosition(), endRange->startPosition());
293 } 293 }
294 294
295 static PassRefPtr<MutableStylePropertySet> copyStyleOrCreateEmpty(const StylePro pertySet* style) 295 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> copyStyleOrCreateEmpty(co nst StylePropertySet* style)
296 { 296 {
297 if (!style) 297 if (!style)
298 return MutableStylePropertySet::create(); 298 return MutableStylePropertySet::create();
299 return style->mutableCopy(); 299 return style->mutableCopy();
300 } 300 }
301 301
302 void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style) 302 void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style)
303 { 303 {
304 static const float MinimumFontSize = 0.1f; 304 static const float MinimumFontSize = 0.1f;
305 305
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // text node. To make this possible, add a style span to surround th is text node. 394 // text node. To make this possible, add a style span to surround th is text node.
395 RefPtr<HTMLElement> span = createStyleSpanElement(document()); 395 RefPtr<HTMLElement> span = createStyleSpanElement(document());
396 surroundNodeRangeWithElement(node, node, span.get()); 396 surroundNodeRangeWithElement(node, node, span.get());
397 element = span.release(); 397 element = span.release();
398 } else { 398 } else {
399 // Only handle HTML elements and text nodes. 399 // Only handle HTML elements and text nodes.
400 continue; 400 continue;
401 } 401 }
402 lastStyledNode = node; 402 lastStyledNode = node;
403 403
404 RefPtr<MutableStylePropertySet> inlineStyle = copyStyleOrCreateEmpty(ele ment->inlineStyle()); 404 RefPtrWillBeRawPtr<MutableStylePropertySet> inlineStyle = copyStyleOrCre ateEmpty(element->inlineStyle());
405 float currentFontSize = computedFontSize(node); 405 float currentFontSize = computedFontSize(node);
406 float desiredFontSize = max(MinimumFontSize, startingFontSizes.get(node) + style->fontSizeDelta()); 406 float desiredFontSize = max(MinimumFontSize, startingFontSizes.get(node) + style->fontSizeDelta());
407 RefPtrWillBeRawPtr<CSSValue> value = inlineStyle->getPropertyCSSValue(CS SPropertyFontSize); 407 RefPtrWillBeRawPtr<CSSValue> value = inlineStyle->getPropertyCSSValue(CS SPropertyFontSize);
408 if (value) { 408 if (value) {
409 element->removeInlineStyleProperty(CSSPropertyFontSize); 409 element->removeInlineStyleProperty(CSSPropertyFontSize);
410 currentFontSize = computedFontSize(node); 410 currentFontSize = computedFontSize(node);
411 } 411 }
412 if (currentFontSize != desiredFontSize) { 412 if (currentFontSize != desiredFontSize) {
413 inlineStyle->setProperty(CSSPropertyFontSize, cssValuePool().createV alue(desiredFontSize, CSSPrimitiveValue::CSS_PX), false); 413 inlineStyle->setProperty(CSSPropertyFontSize, cssValuePool().createV alue(desiredFontSize, CSSPrimitiveValue::CSS_PX), false);
414 setNodeAttribute(element.get(), styleAttr, AtomicString(inlineStyle- >asText())); 414 setNodeAttribute(element.get(), styleAttr, AtomicString(inlineStyle- >asText()));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 518
519 // FIXME: This code should really consider the mapped attribute 'dir', t he inline style declaration, 519 // FIXME: This code should really consider the mapped attribute 'dir', t he inline style declaration,
520 // and all matching style rules in order to determine how to best set th e unicode-bidi property to 'normal'. 520 // and all matching style rules in order to determine how to best set th e unicode-bidi property to 'normal'.
521 // For now, it assumes that if the 'dir' attribute is present, then remo ving it will suffice, and 521 // For now, it assumes that if the 'dir' attribute is present, then remo ving it will suffice, and
522 // otherwise it sets the property in the inline style declaration. 522 // otherwise it sets the property in the inline style declaration.
523 if (element->hasAttribute(dirAttr)) { 523 if (element->hasAttribute(dirAttr)) {
524 // FIXME: If this is a BDO element, we should probably just remove i t if it has no 524 // FIXME: If this is a BDO element, we should probably just remove i t if it has no
525 // other attributes, like we (should) do with B and I elements. 525 // other attributes, like we (should) do with B and I elements.
526 removeNodeAttribute(element, dirAttr); 526 removeNodeAttribute(element, dirAttr);
527 } else { 527 } else {
528 RefPtr<MutableStylePropertySet> inlineStyle = copyStyleOrCreateEmpty (element->inlineStyle()); 528 RefPtrWillBeRawPtr<MutableStylePropertySet> inlineStyle = copyStyleO rCreateEmpty(element->inlineStyle());
529 inlineStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal); 529 inlineStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal);
530 inlineStyle->removeProperty(CSSPropertyDirection); 530 inlineStyle->removeProperty(CSSPropertyDirection);
531 setNodeAttribute(element, styleAttr, AtomicString(inlineStyle->asTex t())); 531 setNodeAttribute(element, styleAttr, AtomicString(inlineStyle->asTex t()));
532 if (isSpanWithoutAttributesOrUnstyledStyleSpan(element)) 532 if (isSpanWithoutAttributesOrUnstyledStyleSpan(element))
533 removeNodePreservingChildren(element); 533 removeNodePreservingChildren(element);
534 } 534 }
535 } 535 }
536 } 536 }
537 537
538 static Node* highestEmbeddingAncestor(Node* startNode, Node* enclosingNode) 538 static Node* highestEmbeddingAncestor(Node* startNode, Node* enclosingNode)
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 // This is a plaintext-only region. Only proceed if it's fully selec ted. 766 // This is a plaintext-only region. Only proceed if it's fully selec ted.
767 // pastEndNode is the node after the last fully selected node, so if it's inside node then 767 // pastEndNode is the node after the last fully selected node, so if it's inside node then
768 // node isn't fully selected. 768 // node isn't fully selected.
769 if (pastEndNode && pastEndNode->isDescendantOf(node.get())) 769 if (pastEndNode && pastEndNode->isDescendantOf(node.get()))
770 break; 770 break;
771 // Add to this element's inline style and skip over its contents. 771 // Add to this element's inline style and skip over its contents.
772 HTMLElement* element = toHTMLElement(node); 772 HTMLElement* element = toHTMLElement(node);
773 next = NodeTraversal::nextSkippingChildren(*node); 773 next = NodeTraversal::nextSkippingChildren(*node);
774 if (!style->style()) 774 if (!style->style())
775 continue; 775 continue;
776 RefPtr<MutableStylePropertySet> inlineStyle = copyStyleOrCreateEmpty (element->inlineStyle()); 776 RefPtrWillBeRawPtr<MutableStylePropertySet> inlineStyle = copyStyleO rCreateEmpty(element->inlineStyle());
777 inlineStyle->mergeAndOverrideOnConflict(style->style()); 777 inlineStyle->mergeAndOverrideOnConflict(style->style());
778 setNodeAttribute(element, styleAttr, AtomicString(inlineStyle->asTex t())); 778 setNodeAttribute(element, styleAttr, AtomicString(inlineStyle->asTex t()));
779 continue; 779 continue;
780 } 780 }
781 781
782 if (isBlock(node.get())) 782 if (isBlock(node.get()))
783 continue; 783 continue;
784 784
785 if (node->hasChildren()) { 785 if (node->hasChildren()) {
786 if (node->contains(pastEndNode.get()) || containsNonEditableRegion(* node) || !node->parentNode()->rendererIsEditable()) 786 if (node->contains(pastEndNode.get()) || containsNonEditableRegion(* node) || !node->parentNode()->rendererIsEditable())
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 String textToMove = nextText->data(); 1542 String textToMove = nextText->data();
1543 insertTextIntoNode(childText, childText->length(), textToMove); 1543 insertTextIntoNode(childText, childText->length(), textToMove);
1544 removeNode(next); 1544 removeNode(next);
1545 // don't move child node pointer. it may want to merge with more text no des. 1545 // don't move child node pointer. it may want to merge with more text no des.
1546 } 1546 }
1547 1547
1548 updateStartEnd(newStart, newEnd); 1548 updateStartEnd(newStart, newEnd);
1549 } 1549 }
1550 1550
1551 } 1551 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698