void EditingStyle::init(Node* node, PropertiesToInclude propertiesToInclude) { if (isTabSpanTextNode(node)) node = tabSpanNode(node)->parentNode(); else if (isTabSpanNode(node)) node = node->parentNode(); RefPtr<CSSComputedStyleDeclaration> computedStyleAtPosition = computedStyle(node); m_mutableStyle = propertiesToInclude == AllProperties && computedStyleAtPosition ? computedStyleAtPosition->copy() : editingStyleFromComputedStyle(computedStyleAtPosition); if (node && node->computedStyle()) { RenderStyle* renderStyle = node->computedStyle(); removeTextFillAndStrokeColorsIfNeeded(renderStyle); replaceFontSizeByKeywordIfPossible(renderStyle, computedStyleAtPosition.get()); //SISO_HTMLComposer start if(node->document() && node->document()->frame() && (node->document()->frame()->textZoomFactor() > 1.0 || node->document()->frame()->pageZoomFactor() > 1.0)) { replaceComputedFontSizeBySpecifiedSize(computedStyleAtPosition.get()); } //SISO_HTMLComposer end } m_shouldUseFixedDefaultFontSize = computedStyleAtPosition->useFixedFontDefaultSize(); extractFontSizeDelta(); }
bool EditingStyle::conflictsWithInlineStyleOfElement(StyledElement* element, EditingStyle* extractedStyle, Vector<CSSPropertyID>* conflictingProperties) const { ASSERT(element); ASSERT(!conflictingProperties || conflictingProperties->isEmpty()); CSSMutableStyleDeclaration* inlineStyle = element->inlineStyleDecl(); if (!m_mutableStyle || !inlineStyle) return false; if (!conflictingProperties) { CSSMutableStyleDeclaration::const_iterator end = m_mutableStyle->end(); for (CSSMutableStyleDeclaration::const_iterator it = m_mutableStyle->begin(); it != end; ++it) { CSSPropertyID propertyID = static_cast<CSSPropertyID>(it->id()); // We don't override whitespace property of a tab span because that would collapse the tab into a space. if (propertyID == CSSPropertyWhiteSpace && isTabSpanNode(element)) continue; if (inlineStyle->getPropertyCSSValue(propertyID)) return true; } return false; } CSSMutableStyleDeclaration::const_iterator end = m_mutableStyle->end(); for (CSSMutableStyleDeclaration::const_iterator it = m_mutableStyle->begin(); it != end; ++it) { CSSPropertyID propertyID = static_cast<CSSPropertyID>(it->id()); if ((propertyID == CSSPropertyWhiteSpace && isTabSpanNode(element)) || !inlineStyle->getPropertyCSSValue(propertyID)) continue; if (propertyID == CSSPropertyUnicodeBidi && inlineStyle->getPropertyCSSValue(CSSPropertyDirection)) { if (extractedStyle) extractedStyle->setProperty(propertyID, inlineStyle->getPropertyValue(propertyID), inlineStyle->getPropertyPriority(propertyID)); conflictingProperties->append(CSSPropertyDirection); } conflictingProperties->append(propertyID); if (extractedStyle) extractedStyle->setProperty(propertyID, inlineStyle->getPropertyValue(propertyID), inlineStyle->getPropertyPriority(propertyID)); } return !conflictingProperties->isEmpty(); }
void EditingStyle::init(Node* node, PropertiesToInclude propertiesToInclude) { if (isTabSpanTextNode(node)) node = tabSpanNode(node)->parentNode(); else if (isTabSpanNode(node)) node = node->parentNode(); RefPtr<CSSComputedStyleDeclaration> computedStyleAtPosition = computedStyle(node); m_mutableStyle = propertiesToInclude == AllProperties && computedStyleAtPosition ? computedStyleAtPosition->copy() : editingStyleFromComputedStyle(computedStyleAtPosition); if (node && node->computedStyle()) { RenderStyle* renderStyle = node->computedStyle(); removeTextFillAndStrokeColorsIfNeeded(renderStyle); replaceFontSizeByKeywordIfPossible(renderStyle, computedStyleAtPosition.get()); } m_shouldUseFixedDefaultFontSize = computedStyleAtPosition->useFixedFontDefaultSize(); extractFontSizeDelta(); }