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

Side by Side Diff: sky/engine/core/editing/EditingStyle.cpp

Issue 860423004: Remove css !important (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « sky/engine/core/editing/EditingStyle.h ('k') | sky/engine/core/editing/Editor.cpp » ('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) 2007, 2008, 2009 Apple Computer, Inc. 2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc.
3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 { 368 {
369 // If a node's text fill color is currentColor, then its children use 369 // If a node's text fill color is currentColor, then its children use
370 // their font-color as their text fill color (they don't 370 // their font-color as their text fill color (they don't
371 // inherit it). Likewise for stroke color. 371 // inherit it). Likewise for stroke color.
372 if (renderStyle->textFillColor().isCurrentColor()) 372 if (renderStyle->textFillColor().isCurrentColor())
373 m_mutableStyle->removeProperty(CSSPropertyWebkitTextFillColor); 373 m_mutableStyle->removeProperty(CSSPropertyWebkitTextFillColor);
374 if (renderStyle->textStrokeColor().isCurrentColor()) 374 if (renderStyle->textStrokeColor().isCurrentColor())
375 m_mutableStyle->removeProperty(CSSPropertyWebkitTextStrokeColor); 375 m_mutableStyle->removeProperty(CSSPropertyWebkitTextStrokeColor);
376 } 376 }
377 377
378 void EditingStyle::setProperty(CSSPropertyID propertyID, const String& value, bo ol important) 378 void EditingStyle::setProperty(CSSPropertyID propertyID, const String& value)
379 { 379 {
380 if (!m_mutableStyle) 380 if (!m_mutableStyle)
381 m_mutableStyle = MutableStylePropertySet::create(); 381 m_mutableStyle = MutableStylePropertySet::create();
382 382
383 m_mutableStyle->setProperty(propertyID, value, important); 383 m_mutableStyle->setProperty(propertyID, value);
384 } 384 }
385 385
386 void EditingStyle::replaceFontSizeByKeywordIfPossible(RenderStyle* renderStyle, CSSComputedStyleDeclaration* computedStyle) 386 void EditingStyle::replaceFontSizeByKeywordIfPossible(RenderStyle* renderStyle, CSSComputedStyleDeclaration* computedStyle)
387 { 387 {
388 ASSERT(renderStyle); 388 ASSERT(renderStyle);
389 if (renderStyle->fontDescription().keywordSize()) 389 if (renderStyle->fontDescription().keywordSize())
390 m_mutableStyle->setProperty(CSSPropertyFontSize, computedStyle->getFontS izeCSSValuePreferringKeyword()->cssText()); 390 m_mutableStyle->setProperty(CSSPropertyFontSize, computedStyle->getFontS izeCSSValuePreferringKeyword()->cssText());
391 } 391 }
392 392
393 void EditingStyle::extractFontSizeDelta() 393 void EditingStyle::extractFontSizeDelta()
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 // text decorations never override values 545 // text decorations never override values
546 if ((property.id() == textDecorationPropertyForEditing() || property.id( ) == CSSPropertyWebkitTextDecorationsInEffect) && property.value()->isValueList( ) && value) { 546 if ((property.id() == textDecorationPropertyForEditing() || property.id( ) == CSSPropertyWebkitTextDecorationsInEffect) && property.value()->isValueList( ) && value) {
547 if (value->isValueList()) { 547 if (value->isValueList()) {
548 mergeTextDecorationValues(toCSSValueList(value.get()), toCSSValu eList(property.value())); 548 mergeTextDecorationValues(toCSSValueList(value.get()), toCSSValu eList(property.value()));
549 continue; 549 continue;
550 } 550 }
551 value = nullptr; // text-decoration: none is equivalent to not havin g the property 551 value = nullptr; // text-decoration: none is equivalent to not havin g the property
552 } 552 }
553 553
554 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) 554 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value))
555 m_mutableStyle->setProperty(property.id(), property.value()->cssText (), property.isImportant()); 555 m_mutableStyle->setProperty(property.id(), property.value()->cssText ());
556 } 556 }
557 } 557 }
558 558
559 bool isTransparentColorValue(CSSValue* cssValue) 559 bool isTransparentColorValue(CSSValue* cssValue)
560 { 560 {
561 if (!cssValue) 561 if (!cssValue)
562 return true; 562 return true;
563 if (!cssValue->isPrimitiveValue()) 563 if (!cssValue->isPrimitiveValue())
564 return false; 564 return false;
565 CSSPrimitiveValue* value = toCSSPrimitiveValue(cssValue); 565 CSSPrimitiveValue* value = toCSSPrimitiveValue(cssValue);
(...skipping 12 matching lines...) Expand all
578 { 578 {
579 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { 579 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
580 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl aration::create(ancestor); 580 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl aration::create(ancestor);
581 if (!hasTransparentBackgroundColor(ancestorStyle.get())) 581 if (!hasTransparentBackgroundColor(ancestorStyle.get()))
582 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); 582 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor );
583 } 583 }
584 return nullptr; 584 return nullptr;
585 } 585 }
586 586
587 } 587 }
OLDNEW
« no previous file with comments | « sky/engine/core/editing/EditingStyle.h ('k') | sky/engine/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698