Commit fa291313 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Remove never-reached if block in StyleSheetContents::WrapperDeleteRule

|StyleSheetContents::import_rules_| is of type
HeapVector<Member<StyleRuleImport>>. Its members will always
resolve |import_rules_[index]->IsFontFaceRule()| to false (once
StyleRuleBase::IsImportRule() is the one that resolves to true.

This CL removes the if-block that checks that altogether,
allowing the removal of the remaining DEFINE_STYLE_RULE_TYPE_CASTS
occurrence.

Note: This was caught because trying to use To<StyleRuleFaceRule>
failed to compile.

  ../../third_party/blink/renderer/platform/wtf/casting.h:102:10: error:
  non-const lvalue reference to type 'blink::StyleRuleFontFace'
  cannot bind to a value of unrelated type 'blink::StyleRuleImport'
  return static_cast<Derived&>(from);
         ^                     ~~~~

R=jbroman@chromium.org
CC=​blink-reviews-vendor@chromium.org

BUG=891908

Change-Id: I6bbf992b3654601a50fc68b18961de79899d5284
Reviewed-on: https://chromium-review.googlesource.com/c/1496056Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#636879}
parent 05d8f300
...@@ -371,12 +371,6 @@ class CORE_EXPORT StyleRuleFontFeatureValues : public StyleRuleBase { ...@@ -371,12 +371,6 @@ class CORE_EXPORT StyleRuleFontFeatureValues : public StyleRuleBase {
Member<const CSSIdentifierValue> font_display_; Member<const CSSIdentifierValue> font_display_;
}; };
#define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \
DEFINE_TYPE_CASTS(StyleRule##Type, StyleRuleBase, rule, \
rule->Is##Type##Rule(), rule.Is##Type##Rule())
DEFINE_STYLE_RULE_TYPE_CASTS(FontFace);
template <> template <>
struct DowncastTraits<StyleRule> { struct DowncastTraits<StyleRule> {
static bool AllowFrom(const StyleRuleBase& rule) { static bool AllowFrom(const StyleRuleBase& rule) {
......
...@@ -284,11 +284,6 @@ bool StyleSheetContents::WrapperDeleteRule(unsigned index) { ...@@ -284,11 +284,6 @@ bool StyleSheetContents::WrapperDeleteRule(unsigned index) {
if (index < import_rules_.size()) { if (index < import_rules_.size()) {
import_rules_[index]->ClearParentStyleSheet(); import_rules_[index]->ClearParentStyleSheet();
// TODO(tonikitoo): If |import_rules_| members are of type
// blink::StyleRuleImport, the if-check blink::StyleRuleBase::IsFontFaceRule
// is never going to resolve to true. Get rid of it altogether?
if (import_rules_[index]->IsFontFaceRule())
NotifyRemoveFontFaceRule(ToStyleRuleFontFace(import_rules_[index].Get()));
import_rules_.EraseAt(index); import_rules_.EraseAt(index);
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment