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

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

Issue 15821009: Move property setting/removing/addParsedProperty/addParsedProperties functions to MutableStylePrope… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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
« no previous file with comments | « Source/core/css/resolver/ViewportStyleResolver.h ('k') | Source/core/editing/EditingStyle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // text node. To make this possible, add a style span to surround th is text node. 386 // text node. To make this possible, add a style span to surround th is text node.
387 RefPtr<HTMLElement> span = createStyleSpanElement(document()); 387 RefPtr<HTMLElement> span = createStyleSpanElement(document());
388 surroundNodeRangeWithElement(node, node, span.get()); 388 surroundNodeRangeWithElement(node, node, span.get());
389 element = span.release(); 389 element = span.release();
390 } else { 390 } else {
391 // Only handle HTML elements and text nodes. 391 // Only handle HTML elements and text nodes.
392 continue; 392 continue;
393 } 393 }
394 lastStyledNode = node; 394 lastStyledNode = node;
395 395
396 RefPtr<StylePropertySet> inlineStyle = copyStyleOrCreateEmpty(element->i nlineStyle()); 396 RefPtr<MutableStylePropertySet> inlineStyle = copyStyleOrCreateEmpty(ele ment->inlineStyle());
397 float currentFontSize = computedFontSize(node); 397 float currentFontSize = computedFontSize(node);
398 float desiredFontSize = max(MinimumFontSize, startingFontSizes.get(node) + style->fontSizeDelta()); 398 float desiredFontSize = max(MinimumFontSize, startingFontSizes.get(node) + style->fontSizeDelta());
399 RefPtr<CSSValue> value = inlineStyle->getPropertyCSSValue(CSSPropertyFon tSize); 399 RefPtr<CSSValue> value = inlineStyle->getPropertyCSSValue(CSSPropertyFon tSize);
400 if (value) { 400 if (value) {
401 element->removeInlineStyleProperty(CSSPropertyFontSize); 401 element->removeInlineStyleProperty(CSSPropertyFontSize);
402 currentFontSize = computedFontSize(node); 402 currentFontSize = computedFontSize(node);
403 } 403 }
404 if (currentFontSize != desiredFontSize) { 404 if (currentFontSize != desiredFontSize) {
405 inlineStyle->setProperty(CSSPropertyFontSize, cssValuePool().createV alue(desiredFontSize, CSSPrimitiveValue::CSS_PX), false); 405 inlineStyle->setProperty(CSSPropertyFontSize, cssValuePool().createV alue(desiredFontSize, CSSPrimitiveValue::CSS_PX), false);
406 setNodeAttribute(element.get(), styleAttr, inlineStyle->asText()); 406 setNodeAttribute(element.get(), styleAttr, inlineStyle->asText());
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 513
514 // FIXME: This code should really consider the mapped attribute 'dir', t he inline style declaration, 514 // FIXME: This code should really consider the mapped attribute 'dir', t he inline style declaration,
515 // and all matching style rules in order to determine how to best set th e unicode-bidi property to 'normal'. 515 // and all matching style rules in order to determine how to best set th e unicode-bidi property to 'normal'.
516 // For now, it assumes that if the 'dir' attribute is present, then remo ving it will suffice, and 516 // For now, it assumes that if the 'dir' attribute is present, then remo ving it will suffice, and
517 // otherwise it sets the property in the inline style declaration. 517 // otherwise it sets the property in the inline style declaration.
518 if (element->hasAttribute(dirAttr)) { 518 if (element->hasAttribute(dirAttr)) {
519 // FIXME: If this is a BDO element, we should probably just remove i t if it has no 519 // FIXME: If this is a BDO element, we should probably just remove i t if it has no
520 // other attributes, like we (should) do with B and I elements. 520 // other attributes, like we (should) do with B and I elements.
521 removeNodeAttribute(element, dirAttr); 521 removeNodeAttribute(element, dirAttr);
522 } else { 522 } else {
523 RefPtr<StylePropertySet> inlineStyle = copyStyleOrCreateEmpty(elemen t->inlineStyle()); 523 RefPtr<MutableStylePropertySet> inlineStyle = copyStyleOrCreateEmpty (element->inlineStyle());
524 inlineStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal); 524 inlineStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal);
525 inlineStyle->removeProperty(CSSPropertyDirection); 525 inlineStyle->removeProperty(CSSPropertyDirection);
526 setNodeAttribute(element, styleAttr, inlineStyle->asText()); 526 setNodeAttribute(element, styleAttr, inlineStyle->asText());
527 if (isSpanWithoutAttributesOrUnstyledStyleSpan(element)) 527 if (isSpanWithoutAttributesOrUnstyledStyleSpan(element))
528 removeNodePreservingChildren(element); 528 removeNodePreservingChildren(element);
529 } 529 }
530 } 530 }
531 } 531 }
532 532
533 static Node* highestEmbeddingAncestor(Node* startNode, Node* enclosingNode) 533 static Node* highestEmbeddingAncestor(Node* startNode, Node* enclosingNode)
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 continue; 757 continue;
758 758
759 if (!node->rendererIsRichlyEditable() && node->isHTMLElement()) { 759 if (!node->rendererIsRichlyEditable() && node->isHTMLElement()) {
760 // This is a plaintext-only region. Only proceed if it's fully selec ted. 760 // This is a plaintext-only region. Only proceed if it's fully selec ted.
761 // pastEndNode is the node after the last fully selected node, so if it's inside node then 761 // pastEndNode is the node after the last fully selected node, so if it's inside node then
762 // node isn't fully selected. 762 // node isn't fully selected.
763 if (pastEndNode && pastEndNode->isDescendantOf(node.get())) 763 if (pastEndNode && pastEndNode->isDescendantOf(node.get()))
764 break; 764 break;
765 // Add to this element's inline style and skip over its contents. 765 // Add to this element's inline style and skip over its contents.
766 HTMLElement* element = toHTMLElement(node.get()); 766 HTMLElement* element = toHTMLElement(node.get());
767 RefPtr<StylePropertySet> inlineStyle = copyStyleOrCreateEmpty(elemen t->inlineStyle()); 767 RefPtr<MutableStylePropertySet> inlineStyle = copyStyleOrCreateEmpty (element->inlineStyle());
768 inlineStyle->mergeAndOverrideOnConflict(style->style()); 768 inlineStyle->mergeAndOverrideOnConflict(style->style());
769 setNodeAttribute(element, styleAttr, inlineStyle->asText()); 769 setNodeAttribute(element, styleAttr, inlineStyle->asText());
770 next = NodeTraversal::nextSkippingChildren(node.get()); 770 next = NodeTraversal::nextSkippingChildren(node.get());
771 continue; 771 continue;
772 } 772 }
773 773
774 if (isBlock(node.get())) 774 if (isBlock(node.get()))
775 continue; 775 continue;
776 776
777 if (node->childNodeCount()) { 777 if (node->childNodeCount()) {
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 String textToMove = nextText->data(); 1547 String textToMove = nextText->data();
1548 insertTextIntoNode(childText, childText->length(), textToMove); 1548 insertTextIntoNode(childText, childText->length(), textToMove);
1549 removeNode(next); 1549 removeNode(next);
1550 // don't move child node pointer. it may want to merge with more text no des. 1550 // don't move child node pointer. it may want to merge with more text no des.
1551 } 1551 }
1552 1552
1553 updateStartEnd(newStart, newEnd); 1553 updateStartEnd(newStart, newEnd);
1554 } 1554 }
1555 1555
1556 } 1556 }
OLDNEW
« no previous file with comments | « Source/core/css/resolver/ViewportStyleResolver.h ('k') | Source/core/editing/EditingStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698