Permalink
Browse files

Remove font override for first-letter and first-line

  • Loading branch information...
1 parent 7015663 commit 495e291d4f6178a234c85826ec00a4a1a7e819cb @mhoran mhoran committed Jan 13, 2013
Showing with 6 additions and 31 deletions.
  1. +5 −30 spec/driver_spec.rb
  2. +1 −1 src/WebPage.cpp
View
35 spec/driver_spec.rb
@@ -1334,58 +1334,33 @@ def make_the_server_go_away
p { font-family: "Verdana"; }
p:before { font-family: "Verdana"; }
p:after { font-family: "Verdana"; }
- #first-line-div:first-line { font-family: "Verdana"; }
- #first-letter-div:first-letter { font-family: "Verdana"; }
</style>
</head>
<body>
<p id="text">Hello</p>
- <p id="first-line-div">Hello first line.</p>
- <p id="first-letter-div">Hello first letter.</p>
</body>
</html>
HTML
end
before { visit("/") }
- it "ignores custom fonts" do
- font_family = driver.evaluate_script(<<-SCRIPT)
+ let(:font_family) do
+ driver.evaluate_script(<<-SCRIPT)
var element = document.getElementById("text");
element.ownerDocument.defaultView.getComputedStyle(element, null).getPropertyValue("font-family");
SCRIPT
- font_family.should == "Arial"
- end
-
- it "ignores custom fonts before an element" do
- font_family = driver.evaluate_script(<<-SCRIPT)
- var element = document.getElementById("text");
- element.ownerDocument.defaultView.getComputedStyle(element, 'before').getPropertyValue("font-family");
- SCRIPT
- font_family.should == "Arial"
end
- it "ignores custom fonts after an element" do
- font_family = driver.evaluate_script(<<-SCRIPT)
- var element = document.getElementById("text");
- element.ownerDocument.defaultView.getComputedStyle(element, 'after').getPropertyValue("font-family");
- SCRIPT
+ it "ignores custom fonts" do
font_family.should == "Arial"
end
- it "ignores custom fonts applied to the first-line pseudo element" do
- font_family = driver.evaluate_script(<<-SCRIPT)
- var element = document.getElementById("first-line-div");
- element.ownerDocument.defaultView.getComputedStyle(element, 'first-line').getPropertyValue("font-family");
- SCRIPT
+ it "ignores custom fonts before an element" do
font_family.should == "Arial"
end
- it "ignores custom fonts applied to the first-letter pseudo element" do
- font_family = driver.evaluate_script(<<-SCRIPT)
- var element = document.getElementById("first-letter-div");
- element.ownerDocument.defaultView.getComputedStyle(element, 'first-letter').getPropertyValue("font-family");
- SCRIPT
+ it "ignores custom fonts after an element" do
font_family.should == "Arial"
end
end
View
2 src/WebPage.cpp
@@ -70,7 +70,7 @@ void WebPage::loadJavascript() {
}
void WebPage::setUserStylesheet() {
- QString data = QString("*, :first-line, :first-letter, :before, :after { font-family: 'Arial' ! important; }").toUtf8().toBase64();
+ QString data = QString("*, :before, :after { font-family: 'Arial' ! important; }").toUtf8().toBase64();
QUrl url = QUrl(QString("data:text/css;charset=utf-8;base64,") + data);
settings()->setUserStyleSheetUrl(url);
}

0 comments on commit 495e291

Please sign in to comment.